Re: pmu_dev_alloc; warning at at kernel/locking/lockdep.c:3002 lockdep_init_map

Tvrtko Ursulin
2015-05-07T16:30:08Z

On 05/07/2015 05:25 PM, Tejun Heo wrote:
> Hello,
>
> On Thu, May 07, 2015 at 04:05:57PM +0200, Peter Zijlstra wrote:
>> On Thu, May 07, 2015 at 02:54:00PM +0100, Tvrtko Ursulin wrote:
>>>
>>> Hi,
>>>
>>> 4.1.0-rc2 spews the below warning and disables lockdep for me at boot.
>>>
>>> Any ideas?
>>>
>>> May 7 11:58:20 skl kernel: [ 6.066696] futex hash table entries: 1024 (order: 5, 131072 bytes)
>>> May 7 11:58:20 skl kernel: [ 6.075774] BUG: key ffff88014973b850 not in .data!
> ...
>>> May 7 11:58:20 skl kernel: [ 6.188202] [<ffffffff811dc06a>] __kernfs_create_file+0x7a/0xf0
>>> May 7 11:58:20 skl kernel: [ 6.195069] [<ffffffff811dcb4e>] sysfs_add_file_mode_ns+0x16e/0x1b0
>>> May 7 11:58:20 skl kernel: [ 6.202346] [<ffffffff811dd92a>] internal_create_group+0x19a/0x280
>>> May 7 11:58:20 skl kernel: [ 6.209515] [<ffffffff811dda43>] sysfs_create_group+0x13/0x20
>>> May 7 11:58:20 skl kernel: [ 6.216185] [<ffffffff811dda88>] sysfs_create_groups+0x38/0x90
>>> May 7 11:58:20 skl kernel: [ 6.222958] [<ffffffff8145c3d6>] device_add+0x276/0x5d0
>>> May 7 11:58:20 skl kernel: [ 6.229040] [<ffffffff8110a80b>] pmu_dev_alloc+0x8b/0xd0
>>> May 7 11:58:20 skl kernel: [ 6.242184] [<ffffffff81d44cd9>] perf_event_sysfs_init+0x46/0x95
>>> May 7 11:58:20 skl kernel: [ 6.256118] [<ffffffff81000352>] do_one_initcall+0x122/0x1f0
>>> May 7 11:58:20 skl kernel: [ 6.268980] [<ffffffff81d27126>] kernel_init_freeable+0x106/0x19a
>>> May 7 11:58:20 skl kernel: [ 6.288120] [<ffffffff8161a38e>] kernel_init+0xe/0xf0
>>> May 7 11:58:20 skl kernel: [ 6.294004] [<ffffffff81629e92>] ret_from_fork+0x42/0x70
>>> May 7 11:58:20 skl kernel: [ 6.306367] ---[ end trace 98f2b03275198a56 ]---
>>> May 7 11:58:20 skl kernel: [ 6.311703] BUG: key ffff88014973b888 not in .data!
>>> May 7 11:58:20 skl kernel: [ 6.317300] BUG: key ffff88014973b8c0 not in .data!
>>> May 7 11:58:20 skl kernel: [ 6.322895] BUG: key ffff88014973b8f8 not in .data!
>>> May 7 11:58:20 skl kernel: [ 6.329549] HugeTLB registered 2 MB page size, pre-allocated 0 pages
>>
>> That's in sysfs magic mushroom land, lets Cc people who know about this.
>
> sysfs by default uses lockdep key embedded in attrs. It looks like
> somebody is making on-heap copies of attrs and using them as the group
> attrs. What's the offending pmu type?

I am not familiar with this area, is this the answer?

May 7 11:58:20 skl kernel: [ 0.849877] Performance Events: no PEBS fmt3+, generic architected perfmon, full-width counters, Intel PMU driver.
May 7 11:58:20 skl kernel: [ 0.861827] ... version: 4
May 7 11:58:20 skl kernel: [ 0.866406] ... bit width: 48
May 7 11:58:20 skl kernel: [ 0.871083] ... generic registers: 4
May 7 11:58:20 skl kernel: [ 0.875664] ... value mask: 0000ffffffffffff
May 7 11:58:20 skl kernel: [ 0.881724] ... max period: 0000ffffffffffff
May 7 11:58:20 skl kernel: [ 0.887778] ... fixed-purpose events: 3
May 7 11:58:20 skl kernel: [ 0.892352] ... event mask: 000000070000000f
May 7 11:58:20 skl kernel: [ 0.909665] NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.

Regards,

Tvrtko