powerpc stacktrace and lockdep support

Johannes Berg johannes at sipsolutions.net
Fri Jul 6 19:54:21 EST 2007


*sigh* I really shouldn't have mailed this out in the first place. Every
time I look at it I find new bugs despite the fact that it actually
works on my machine.

>  	ld	r3,SOFTE(r1)
> -	bl	.local_irq_restore
> +#ifdef CONFIG_TRACE_IRQFLAGS
> +	cmpdi	r3,0
> +	beq	14f
> +	bl	.trace_hardirqs_on
> +	ld	r3,SOFTE(r1)
> +14:
> +	bl	.raw_local_irq_restore
> +	cmpdi	r3,0

This should reload r3 before the second compare as raw_local_irq_restore
returns nothing (void). And why does it need a second compare anyway?
Just rewrite as

	ld	r3, SOFTE(r1)
#ifdef CONFIG_TRACE_IRQFLAGS
	cmpdi	r3, 0
	bne	14f
	bl	.raw_local_irq_restore
	bl	.trace_hardirqs_off
	b	15f
14:
	bl	.trace_hardirqs_on
	li	r3, 1
#endif
	bl	.raw_local_irq_restore
15:

which has the advantage of having only one conditional branch and less
preprocessor foo.

> +#ifdef CONFIG_TRACE_IRQFLAGS
> +	cmpdi	r5,0
> +	beq	5f
> +	bl	.trace_hardirqs_on
> +	ld	r5,SOFTE(r1)
>  	stb	r5,PACASOFTIRQEN(r13)
> -
> +	b	6f
> +5:
> +	stb	r5,PACASOFTIRQEN(r13)
> +	bl	.trace_hardirqs_off
> +6:
> +#else
> +	stb	r5,PACASOFTIRQEN(r13)
> +#endif

Similarly, that could be rewritten as

#ifdef CONFIG_TRACE_IRQFLAGS
	cmpdi	r5, 0
	bne	5f
	stb	r5, PACASOFTIRQEN(r13)
	bl	.trace_hardirqs_off
	b	6f
5:
	bl	.trace_hardirqs_on
	li	r5, 1
#endif
	stb	r5, PACASOFTIRQEN(r13)
6:

I can't test these modifications over the weekend but they should be
fine.

johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20070706/b4279fb8/attachment.pgp>


More information about the Linuxppc-dev mailing list