Re: [PATCH] lockdep: make print_lock_name() robust against non-existing lock_class
From: Sebastian Andrzej Siewior
Date: Thu Apr 16 2015 - 11:39:47 EST
* Peter Zijlstra | 2015-04-16 17:35:03 [+0200]:
>On Thu, Apr 16, 2015 at 04:50:21PM +0200, Sebastian Andrzej Siewior wrote:
>
>> Andreas confirmed that it works for him on v3.18 with minor adjustment.
>>
>> <---
>> + struct held_lock lock = READ_ONCE(*hlock);
>> + unsigned int class_idx = lock.class_idx;
>> --->
>>
>
>I'm confused by the need for that. What was the failure with the
>proposed patch?
It was tested on v3.18, there might have been a change between v3.18 &
4.0. The patch as-is did no compile:
in file included from arch/x86/include/asm/current.h:4:0,
from include/linux/mutex.h:13,
from kernel/locking/lockdep.c:29:
kernel/locking/lockdep.c: In function âprint_lockâ:
kernel/locking/lockdep.c:558:37: error: âtypeofâ applied to a bit-field
unsigned int class_idx = READ_ONCE(hlock->class_idx);
^
include/linux/compiler.h:262:20: note: in definition of macro âREAD_ONCEâ
({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; })
^
include/linux/compiler.h:262:11: error: cannot take address of bit-field âclass_idxâ
({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; })
^
kernel/locking/lockdep.c:558:27: note: in expansion of macro âREAD_ONCEâ
unsigned int class_idx = READ_ONCE(hlock->class_idx);
^
include/linux/compiler.h:262:88: error: âsizeofâ applied to a bit-field
({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; })
^
kernel/locking/lockdep.c:558:27: note: in expansion of macro âREAD_ONCEâ
unsigned int class_idx = READ_ONCE(hlock->class_idx);
^
scripts/Makefile.build:258: recipe for target 'kernel/locking/lockdep.o' failed
Sebastian
--
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/