Re: [PATCH] lockdep: fix spurious 'inconsistent lock state' warning

From: Ingo Molnar
Date: Mon Aug 18 2008 - 03:42:46 EST



* Dmitry Baryshkov <dbaryshkov@xxxxxxxxx> wrote:

> Since f82b217e3513fe3af342c0f3ee1494e86250c21c lockdep can output
> spurious warnings related to hwirqs due to hardirq_off shrinkage from
> int to bit-sized flag. Guard it with double negation to fix the
> warning.
>
> Signed-off-by: Dmitry Baryshkov <dbaryshkov@xxxxxxxxx>

good spotting! Applied to tip/core/urgent, thanks Dmitry.

I'm wondering, is there any way to teach gcc some sanity here - a safer
variant of bitfields, that is just not allowed to overflow into or
corrupt nearby fields? The fact that a benign looking hlock->state = 15
can corrupt other fields worries me quite a bit. Valid C semantics or
not, this is a totally dangerous construct. The space savings are very
real though, so it would be nice to get 'safer bitfields', somehow.

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