* [PATCH] lockdep: fix spurious 'inconsistent lock state' warning
@ 2008-08-18 0:26 Dmitry Baryshkov
2008-08-18 7:42 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Baryshkov @ 2008-08-18 0:26 UTC (permalink / raw)
To: linux-kernel; +Cc: peterz, mingo, Dmitry Baryshkov
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@gmail.com>
---
kernel/lockdep.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 1aa91fd..b298888 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2584,7 +2584,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
hlock->trylock = trylock;
hlock->read = read;
hlock->check = check;
- hlock->hardirqs_off = hardirqs_off;
+ hlock->hardirqs_off = !!hardirqs_off;
#ifdef CONFIG_LOCK_STAT
hlock->waittime_stamp = 0;
hlock->holdtime_stamp = sched_clock();
--
1.5.6.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lockdep: fix spurious 'inconsistent lock state' warning
2008-08-18 0:26 [PATCH] lockdep: fix spurious 'inconsistent lock state' warning Dmitry Baryshkov
@ 2008-08-18 7:42 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-08-18 7:42 UTC (permalink / raw)
To: Dmitry Baryshkov; +Cc: linux-kernel, peterz, mingo, Alexander Viro
* Dmitry Baryshkov <dbaryshkov@gmail.com> 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@gmail.com>
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-18 7:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-18 0:26 [PATCH] lockdep: fix spurious 'inconsistent lock state' warning Dmitry Baryshkov
2008-08-18 7:42 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox