Lyude Paul
319e53f155
drm/panic: Fix uninitialized spinlock acquisition with CONFIG_DRM_PANIC=n
It turns out that if you happen to have a kernel config where
CONFIG_DRM_PANIC is disabled and spinlock debugging is enabled, along with
KMS being enabled - we'll end up trying to acquire an uninitialized
spin_lock with drm_panic_lock() when we try to do a commit:
rvkms rvkms.0: [drm:drm_atomic_commit] committing 0000000068d2ade1
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 4 PID: 1347 Comm: modprobe Not tainted 6.10.0-rc1Lyude-Test+ #272
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS edk2-20240524-3.fc40 05/24/2024
Call Trace:
<TASK>
dump_stack_lvl+0x77/0xa0
assign_lock_key+0x114/0x120
register_lock_class+0xa8/0x2c0
__lock_acquire+0x7d/0x2bd0
? __vmap_pages_range_noflush+0x3a8/0x550
? drm_atomic_helper_swap_state+0x2ad/0x3a0
lock_acquire+0xec/0x290
? drm_atomic_helper_swap_state+0x2ad/0x3a0
? lock_release+0xee/0x310
_raw_spin_lock_irqsave+0x4e/0x70
? drm_atomic_helper_swap_state+0x2ad/0x3a0
drm_atomic_helper_swap_state+0x2ad/0x3a0
drm_atomic_helper_commit+0xb1/0x270
drm_atomic_commit+0xaf/0xe0
? __pfx___drm_printfn_info+0x10/0x10
drm_client_modeset_commit_atomic+0x1a1/0x250
drm_client_modeset_commit_locked+0x4b/0x180
drm_client_modeset_commit+0x27/0x50
__drm_fb_helper_restore_fbdev_mode_unlocked+0x76/0x90
drm_fb_helper_set_par+0x38/0x40
fbcon_init+0x3c4/0x690
visual_init+0xc0/0x120
do_bind_con_driver+0x409/0x4c0
do_take_over_console+0x233/0x280
do_fb_registered+0x11f/0x210
fbcon_fb_registered+0x2c/0x60
register_framebuffer+0x248/0x2a0
__drm_fb_helper_initial_config_and_unlock+0x58a/0x720
drm_fbdev_generic_client_hotplug+0x6e/0xb0
drm_client_register+0x76/0xc0
_RNvXs_CsHeezP08sTT_5rvkmsNtB4_5RvkmsNtNtCs1cdwasc6FUb_6kernel8platform6Driver5probe+0xed2/0x1060 [rvkms]
? _RNvMs_NtCs1cdwasc6FUb_6kernel8platformINtB4_7AdapterNtCsHeezP08sTT_5rvkms5RvkmsE14probe_callbackBQ_+0x2b/0x70 [rvkms]
? acpi_dev_pm_attach+0x25/0x110
? platform_probe+0x6a/0xa0
? really_probe+0x10b/0x400
? __driver_probe_device+0x7c/0x140
? driver_probe_device+0x22/0x1b0
? __device_attach_driver+0x13a/0x1c0
? __pfx___device_attach_driver+0x10/0x10
? bus_for_each_drv+0x114/0x170
? __device_attach+0xd6/0x1b0
? bus_probe_device+0x9e/0x120
? device_add+0x288/0x4b0
? platform_device_add+0x75/0x230
? platform_device_register_full+0x141/0x180
? rust_helper_platform_device_register_simple+0x85/0xb0
? _RNvMs2_NtCs1cdwasc6FUb_6kernel8platformNtB5_6Device13create_simple+0x1d/0x60
? _RNvXs0_CsHeezP08sTT_5rvkmsNtB5_5RvkmsNtCs1cdwasc6FUb_6kernel6Module4init+0x11e/0x160 [rvkms]
? 0xffffffffc083f000
? init_module+0x20/0x1000 [rvkms]
? kernfs_xattr_get+0x3e/0x80
? do_one_initcall+0x148/0x3f0
? __lock_acquire+0x5ef/0x2bd0
? __lock_acquire+0x5ef/0x2bd0
? __lock_acquire+0x5ef/0x2bd0
? put_cpu_partial+0x51/0x1d0
? lock_acquire+0xec/0x290
? put_cpu_partial+0x51/0x1d0
? lock_release+0xee/0x310
? put_cpu_partial+0x51/0x1d0
? fs_reclaim_acquire+0x69/0xf0
? lock_acquire+0xec/0x290
? fs_reclaim_acquire+0x69/0xf0
? kfree+0x22f/0x340
? lock_release+0xee/0x310
? kmalloc_trace_noprof+0x48/0x340
? do_init_module+0x22/0x240
? kmalloc_trace_noprof+0x155/0x340
? do_init_module+0x60/0x240
? __se_sys_finit_module+0x2e0/0x3f0
? do_syscall_64+0xa4/0x180
? syscall_exit_to_user_mode+0x108/0x140
? do_syscall_64+0xb0/0x180
? vma_end_read+0xd0/0xe0
? do_user_addr_fault+0x309/0x640
? clear_bhb_loop+0x45/0xa0
? clear_bhb_loop+0x45/0xa0
? clear_bhb_loop+0x45/0xa0
? entry_SYSCALL_64_after_hwframe+0x76/0x7e
</TASK>
Fix this by stubbing these macros out when this config option isn't
enabled, along with fixing the unused variable warning that introduces.
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Fixes: e2a1cda3e0 ("drm/panic: Add drm panic locking")
Cc: <stable@vger.kernel.org> # v6.10+
Link: https://patchwork.freedesktop.org/patch/msgid/20240916230103.611490-1-lyude@redhat.com
2024-09-16 19:03:29 -04:00
..
2024-09-03 02:35:35 +03:00
2024-08-30 13:40:38 +10:00
2024-03-11 14:29:19 +02:00
2024-08-27 13:23:58 +03:00
2024-09-11 09:18:15 +02:00
2024-03-07 17:17:25 +02:00
2024-08-26 17:06:22 +02:00
2023-04-16 14:17:41 +02:00
2023-12-19 17:07:32 +10:00
2022-11-24 12:42:40 +01:00
2024-08-26 16:28:48 +02:00
2022-11-29 14:14:51 +02:00
2023-12-06 10:08:37 +01:00
2023-12-04 21:33:10 +02:00
2023-01-05 15:08:10 +01:00
2024-06-12 10:56:57 +03:00
2024-08-07 18:19:00 -04:00
2024-03-11 13:33:50 +01:00
2023-12-19 15:29:17 +02:00
2024-08-02 11:28:53 -04:00
2023-01-18 09:25:32 +01:00
2023-07-29 21:25:16 +02:00
2024-03-07 17:17:25 +02:00
2023-09-26 01:51:28 +02:00
2024-07-26 17:40:10 -04:00
2024-08-13 16:21:12 +02:00
2024-08-14 12:16:34 +03:00
2023-11-09 16:48:27 +02:00
2024-03-11 11:47:06 +02:00
2023-12-04 16:07:29 +02:00
2024-01-29 14:20:23 +01:00
2024-04-15 13:50:40 -03:00
2024-08-13 16:21:11 +02:00
2023-03-14 17:07:47 +01:00
2024-05-02 11:33:15 +02:00
2024-05-02 11:33:32 +02:00
2024-08-26 17:06:22 +02:00
2024-08-13 12:13:45 +03:00
2023-11-14 10:23:12 +01:00
2024-03-07 17:17:25 +02:00
2023-10-12 09:51:19 +02:00
2023-11-24 11:58:02 +01:00
2023-11-14 10:01:14 +01:00
2023-06-26 11:08:41 +02:00
2024-03-11 13:33:50 +01:00
2022-12-06 12:54:14 +01:00
2024-09-06 14:41:38 +02:00
2024-03-11 13:33:50 +01:00
2024-01-29 14:20:23 +01:00
2023-12-06 10:08:32 +01:00
2024-03-07 17:17:25 +02:00
2024-03-07 17:17:25 +02:00
2024-01-17 10:38:39 +01:00
2024-06-07 16:09:05 +02:00
2024-08-20 14:17:54 -07:00
2024-06-06 10:24:13 -04:00
2024-08-13 16:21:13 +02:00
2023-12-13 15:09:53 -05:00
2024-01-05 21:14:46 +01:00
2024-04-15 16:12:49 +02:00
2024-03-07 17:17:25 +02:00
2023-08-03 10:21:27 +02:00
2024-09-16 19:03:29 -04:00
2023-01-13 09:44:56 +01:00
2023-12-06 10:35:49 +01:00
2024-06-24 17:08:53 +03:00
2023-11-30 14:46:04 -05:00
2024-08-01 11:00:12 -07:00
2024-04-02 10:40:52 +02:00
2023-12-13 15:09:53 -05:00
2024-08-23 16:47:56 +02:00
2022-12-05 13:35:37 +01:00
2024-03-07 17:17:25 +02:00
2023-07-20 12:01:03 +02:00
2023-06-23 15:54:00 +02:00
2024-06-24 18:03:18 +02:00
2024-07-26 17:40:10 -04:00
2023-01-19 14:16:55 +01:00
2024-09-06 18:05:52 +02:00
2023-07-29 21:11:54 +02:00