Message ID | 20240722210648.80892-8-lucas.demarchi@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix i915 pmu on bind/unbind | expand |
Hello, kernel test robot noticed "INFO:trying_to_register_non-static_key" on: commit: a236f4d92e214998f7606430282249580f709423 ("[PATCH 7/7] drm/i915/pmu: Do not set event_init to NULL") url: https://github.com/intel-lab-lkp/linux/commits/Lucas-De-Marchi/perf-core-Add-pmu-get-put/20240723-051755 base: https://git.kernel.org/cgit/linux/kernel/git/perf/perf-tools-next.git perf-tools-next patch link: https://lore.kernel.org/all/20240722210648.80892-8-lucas.demarchi@intel.com/ patch subject: [PATCH 7/7] drm/i915/pmu: Do not set event_init to NULL in testcase: kernel-selftests version: kernel-selftests-x86_64-977d51cf-1_20240508 with following parameters: group: locking compiler: gcc-13 test machine: 4 threads Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz (Skylake) with 16G memory (please refer to attached dmesg/kmsg for entire log/backtrace) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <oliver.sang@intel.com> | Closes: https://lore.kernel.org/oe-lkp/202408051423.839b16eb-oliver.sang@intel.com [ 45.439542][ T194] INFO: trying to register non-static key. [ 45.445246][ T194] The code is fine but needs lockdep annotation, or maybe [ 45.452244][ T194] you didn't initialize this object before use? [ 45.458370][ T194] turning off the locking correctness validator. [ 45.464586][ T194] CPU: 3 PID: 194 Comm: (udev-worker) Tainted: G S 6.10.0-rc3-00133-ga236f4d92e21 #1 [ 45.475322][ T194] Hardware name: HP HP Z238 Microtower Workstation/8183, BIOS N51 Ver. 01.63 10/05/2017 [ 45.484923][ T194] Call Trace: [ 45.488094][ T194] <TASK> [ 45.490908][ T194] dump_stack_lvl (lib/dump_stack.c:118) [ 45.495297][ T194] register_lock_class (kernel/locking/lockdep.c:1290) [ 45.500377][ T194] ? lock_acquire (kernel/locking/lockdep.c:467 (discriminator 4) kernel/locking/lockdep.c:5756 (discriminator 4) kernel/locking/lockdep.c:5719 (discriminator 4)) [ 45.504938][ T194] ? intel_display_power_get (drivers/gpu/drm/i915/display/intel_display_power.c:504 drivers/gpu/drm/i915/display/intel_display_power.c:532) i915 [ 45.511333][ T194] ? __pfx_register_lock_class (kernel/locking/lockdep.c:1276) [ 45.516848][ T194] ? __pfx_lock_acquire (kernel/locking/lockdep.c:5722) [ 45.521748][ T194] ? lock_is_held_type (kernel/locking/lockdep.c:5495 (discriminator 1) kernel/locking/lockdep.c:5825 (discriminator 1)) [ 45.526654][ T194] ? find_held_lock (kernel/locking/lockdep.c:5244 (discriminator 1)) [ 45.531306][ T194] __lock_acquire (kernel/locking/lockdep.c:5015) [ 45.535870][ T194] ? trace_contention_end (include/trace/events/lock.h:122 (discriminator 2)) [ 45.541042][ T194] ? __mutex_lock (arch/x86/include/asm/preempt.h:94 (discriminator 1) kernel/locking/mutex.c:618 (discriminator 1) kernel/locking/mutex.c:752 (discriminator 1)) [ 45.545688][ T194] lock_acquire (kernel/locking/lockdep.c:467 (discriminator 4) kernel/locking/lockdep.c:5756 (discriminator 4) kernel/locking/lockdep.c:5719 (discriminator 4)) [ 45.550069][ T194] ? i915_pmu_gt_unparked (drivers/gpu/drm/i915/i915_pmu.c:336) i915 [ 45.556233][ T194] ? __pfx_lock_acquire (kernel/locking/lockdep.c:5722) [ 45.561162][ T194] ? __pfx___mutex_unlock_slowpath (kernel/locking/mutex.c:907) [ 45.567023][ T194] ? __pfx_intel_display_power_grab_async_put_ref (drivers/gpu/drm/i915/display/intel_display_power.c:471) i915 [ 45.575181][ T194] _raw_spin_lock_irq (include/linux/spinlock_api_smp.h:120 kernel/locking/spinlock.c:170) [ 45.579937][ T194] ? i915_pmu_gt_unparked (drivers/gpu/drm/i915/i915_pmu.c:336) i915 [ 45.586041][ T194] i915_pmu_gt_unparked (drivers/gpu/drm/i915/i915_pmu.c:336) i915 [ 45.591960][ T194] __gt_unpark (drivers/gpu/drm/i915/gt/intel_gt_pm.c:93) i915 [ 45.597075][ T194] __intel_wakeref_get_first (drivers/gpu/drm/i915/intel_wakeref.c:32) i915 [ 45.603498][ T194] intel_gt_resume (drivers/gpu/drm/i915/gt/intel_gt_pm.c:259) i915 [ 45.609021][ T194] ? __pfx_intel_execlists_submission_setup (drivers/gpu/drm/i915/gt/intel_execlists_submission.c:3541) i915 [ 45.616560][ T194] intel_gt_init (drivers/gpu/drm/i915/gt/intel_gt.c:740) i915 [ 45.621888][ T194] i915_gem_init (drivers/gpu/drm/i915/i915_gem.c:1193) i915 [ 45.627261][ T194] i915_driver_probe (drivers/gpu/drm/i915/i915_driver.c:798) i915 [ 45.632922][ T194] ? __pfx_i915_driver_probe (drivers/gpu/drm/i915/i915_driver.c:750) i915 [ 45.639091][ T194] ? drm_privacy_screen_get (drivers/gpu/drm/drm_privacy_screen.c:168) drm [ 45.645110][ T194] ? intel_display_driver_probe_defer (drivers/gpu/drm/i915/display/intel_display_driver.c:81) i915 [ 45.652258][ T194] ? i915_pci_probe (drivers/gpu/drm/i915/i915_pci.c:998 (discriminator 1)) i915 [ 45.657875][ T194] ? __pfx_i915_pci_probe (drivers/gpu/drm/i915/i915_pci.c:959) i915 [ 45.663785][ T194] local_pci_probe (drivers/pci/pci-driver.c:324) [ 45.668340][ T194] pci_call_probe (drivers/pci/pci-driver.c:392 (discriminator 1)) [ 45.672893][ T194] ? __pfx_do_raw_spin_lock (kernel/locking/spinlock_debug.c:114) [ 45.678141][ T194] ? __pfx_pci_call_probe (drivers/pci/pci-driver.c:352) [ 45.683232][ T194] ? pci_match_device (drivers/pci/pci-driver.c:159) [ 45.688169][ T194] ? pci_match_device (drivers/pci/pci-driver.c:159 (discriminator 1)) [ 45.693077][ T194] ? kernfs_put (arch/x86/include/asm/atomic.h:67 (discriminator 1) include/linux/atomic/atomic-arch-fallback.h:2278 (discriminator 1) include/linux/atomic/atomic-instrumented.h:1384 (discriminator 1) fs/kernfs/dir.c:557 (discriminator 1)) [ 45.697294][ T194] pci_device_probe (drivers/pci/pci-driver.c:452) [ 45.701942][ T194] ? pci_dma_configure (drivers/pci/pci-driver.c:1656) [ 45.706941][ T194] really_probe (drivers/base/dd.c:578 drivers/base/dd.c:656) [ 45.711328][ T194] __driver_probe_device (drivers/base/dd.c:798) [ 45.716492][ T194] driver_probe_device (drivers/base/dd.c:828) [ 45.721401][ T194] __driver_attach (drivers/base/dd.c:1215) [ 45.726051][ T194] ? __pfx___driver_attach (drivers/base/dd.c:1155) [ 45.731235][ T194] bus_for_each_dev (drivers/base/bus.c:367) [ 45.735991][ T194] ? lockdep_init_map_type (kernel/locking/lockdep.c:4892 (discriminator 1)) [ 45.741332][ T194] ? __pfx_bus_for_each_dev (drivers/base/bus.c:356) [ 45.746592][ T194] ? bus_add_driver (drivers/base/bus.c:672) [ 45.751332][ T194] bus_add_driver (drivers/base/bus.c:673) [ 45.755895][ T194] driver_register (drivers/base/driver.c:246) [ 45.760539][ T194] i915_init (drivers/gpu/drm/i915/i915_driver.c:1436) i915 [ 45.765494][ T194] ? __pfx_i915_init (drivers/gpu/drm/i915/i915_config.c:13) i915 [ 45.770985][ T194] do_one_initcall (init/main.c:1267) [ 45.775534][ T194] ? asm_sysvec_apic_timer_interrupt (arch/x86/include/asm/idtentry.h:702) [ 45.781568][ T194] ? __pfx_do_one_initcall (init/main.c:1258) [ 45.786741][ T194] ? kasan_unpoison (mm/kasan/shadow.c:156 mm/kasan/shadow.c:182) [ 45.791304][ T194] do_init_module (kernel/module/main.c:2541) [ 45.795868][ T194] init_module_from_file (kernel/module/main.c:3173) [ 45.800951][ T194] ? __pfx_init_module_from_file (kernel/module/main.c:3149) [ 45.806647][ T194] ? __lock_release+0x103/0x440 [ 45.811991][ T194] ? idempotent_init_module (kernel/module/main.c:3119 kernel/module/main.c:3184) [ 45.817423][ T194] ? idempotent_init_module (kernel/module/main.c:3119 kernel/module/main.c:3184) [ 45.822857][ T194] ? do_raw_spin_unlock (arch/x86/include/asm/atomic.h:23 include/linux/atomic/atomic-arch-fallback.h:457 include/linux/atomic/atomic-instrumented.h:33 include/asm-generic/qspinlock.h:57 kernel/locking/spinlock_debug.c:101 kernel/locking/spinlock_debug.c:141) [ 45.827853][ T194] idempotent_init_module (kernel/module/main.c:3190) [ 45.833104][ T194] ? __pfx_idempotent_init_module (kernel/module/main.c:3177) [ 45.838879][ T194] ? __seccomp_filter (arch/x86/include/asm/bitops.h:227 arch/x86/include/asm/bitops.h:239 include/asm-generic/bitops/instrumented-non-atomic.h:142 kernel/seccomp.c:359 kernel/seccomp.c:386 kernel/seccomp.c:418 kernel/seccomp.c:1222) [ 45.843791][ T194] ? security_capable (security/security.c:1036 (discriminator 13)) [ 45.848531][ T194] __x64_sys_finit_module (include/linux/file.h:47 kernel/module/main.c:3212 kernel/module/main.c:3194 kernel/module/main.c:3194) [ 45.853704][ T194] do_syscall_64 (arch/x86/entry/common.c:52 (discriminator 1) arch/x86/entry/common.c:83 (discriminator 1)) [ 45.858092][ T194] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) [ 45.863871][ T194] RIP: 0033:0x7f5179545719 [ 45.868164][ T194] Code: 08 89 e8 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d b7 06 0d 00 f7 d8 64 89 01 48 All code ======== 0: 08 89 e8 5b 5d c3 or %cl,-0x3ca2a418(%rcx) 6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) d: 00 00 00 10: 90 nop 11: 48 89 f8 mov %rdi,%rax 14: 48 89 f7 mov %rsi,%rdi 17: 48 89 d6 mov %rdx,%rsi 1a: 48 89 ca mov %rcx,%rdx 1d: 4d 89 c2 mov %r8,%r10 20: 4d 89 c8 mov %r9,%r8 23: 4c 8b 4c 24 08 mov 0x8(%rsp),%r9 28: 0f 05 syscall 2a:* 48 3d 01 f0 ff ff cmp $0xfffffffffffff001,%rax <-- trapping instruction 30: 73 01 jae 0x33 32: c3 retq 33: 48 8b 0d b7 06 0d 00 mov 0xd06b7(%rip),%rcx # 0xd06f1 3a: f7 d8 neg %eax 3c: 64 89 01 mov %eax,%fs:(%rcx) 3f: 48 rex.W Code starting with the faulting instruction =========================================== 0: 48 3d 01 f0 ff ff cmp $0xfffffffffffff001,%rax 6: 73 01 jae 0x9 8: c3 retq 9: 48 8b 0d b7 06 0d 00 mov 0xd06b7(%rip),%rcx # 0xd06c7 10: f7 d8 neg %eax 12: 64 89 01 mov %eax,%fs:(%rcx) 15: 48 rex.W The kernel config and materials to reproduce are available at: https://download.01.org/0day-ci/archive/20240805/202408051423.839b16eb-oliver.sang@intel.com
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index df53a8fe53ec..c5738035bc2f 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -303,7 +303,7 @@ void i915_pmu_gt_parked(struct intel_gt *gt) { struct i915_pmu *pmu = >->i915->pmu; - if (!pmu->base.event_init) + if (pmu->closed) return; spin_lock_irq(&pmu->lock); @@ -325,7 +325,7 @@ void i915_pmu_gt_unparked(struct intel_gt *gt) { struct i915_pmu *pmu = >->i915->pmu; - if (!pmu->base.event_init) + if (pmu->closed) return; spin_lock_irq(&pmu->lock); @@ -1325,12 +1325,12 @@ void i915_pmu_register(struct drm_i915_private *i915) err_groups: kfree(pmu->base.attr_groups); err_attr: - pmu->base.event_init = NULL; free_event_attributes(pmu); err_name: if (IS_DGFX(i915)) kfree(pmu->name); err: + pmu->closed = true; drm_notice(&i915->drm, "Failed to register PMU!\n"); } @@ -1346,6 +1346,4 @@ void i915_pmu_unregister(struct drm_i915_private *i915) hrtimer_cancel(&pmu->timer); i915_pmu_unregister_cpuhp_state(pmu); - - pmu->base.event_init = NULL; }
event_init is not an optional function pointer from perf events. Now that pmu unregister happens only when freeing i915, setting it to NULL only protects other functions in i915. Replace that by checking pmu->closed. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> --- drivers/gpu/drm/i915/i915_pmu.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)