Re: [PATCH] generic-ipi: add lock context annotations

From: Namhyung Kim
Date: Wed Nov 24 2010 - 00:24:53 EST


2010-11-23 (í), 12:40 +0300, Dan Carpenter:
> On Tue, Nov 23, 2010 at 09:49:56AM +0100, Jens Axboe wrote:
> > I guess what Peter means is that the fact that the function grabs the
> > lock is apparent in the code, if sparse was a bit "smarter", it would
> > see and note this itself.
>
> The sparse warning messages should have been included in the commit
> message. Here they are:
>
> kernel/smp.c:513:6: warning: context imbalance in 'ipi_call_lock' - wrong count at exit
> kernel/smp.c:518:6: warning: context imbalance in 'ipi_call_unlock' - unexpected unlock
> kernel/smp.c:523:6: warning: context imbalance in 'ipi_call_lock_irq' - wrong count at exit
> kernel/smp.c:528:6: warning: context imbalance in 'ipi_call_unlock_irq' - unexpected unlock
>
> What happens is that sparse *does* see that the locks are unlocked and
> that's what it complains about.
>
> Sparse works before the code is linked so this change doesn't affect
> anything outside kernel/smp.c. If we added these annotations to
> include/linux/smp.h then they would be used for checking
> kernel/smpboot.c
>
> regards,
> dan carpenter
>

I tried to annotate declations in include/linux/smp.h but it didn't work
well. Maybe that's what we need to fix the sparse?

Anyway, Jens, do you want new patch which includes above warnings?

Thanks.

--
Regards,
Namhyung Kim



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/