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

From: Dan Carpenter
Date: Tue Nov 23 2010 - 04:40:35 EST


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

--
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/