Commit 1fa8d710573f02ae9118bc5f53e7ede09d6920da produces warnings on dual GPU system
Commit 1fa8d710573f02ae9118bc5f53e7ede09d6920da introduced an additional WARN_ON into amdgpu_irq_put
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index d0a1cc88832c..fafebec5b7b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -596,6 +596,9 @@ int amdgpu_irq_put(struct amdgpu_device *adev, struct amdgpu_irq_src *src,
if (!src->enabled_types || !src->funcs->set)
return -EINVAL;
+ if (WARN_ON(!amdgpu_irq_enabled(adev, src, type)))
+ return -EINVAL;
+
if (atomic_dec_and_test(&src->enabled_types[type]))
return amdgpu_irq_update(adev, src, type);
which produces a warning on my dual GPU Laptop each time the discrete GPU gets suspended: Hardware:
$ lspci -nn
00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne Root Complex [1022:1630]
00:00.2 IOMMU [0806]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne IOMMU [1022:1631]
00:01.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
00:01.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge [1022:1633]
00:02.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
00:02.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge [1022:1634]
00:02.2 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge [1022:1634]
00:02.3 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge [1022:1634]
00:02.4 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge [1022:1634]
00:08.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
00:08.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir Internal PCIe GPP Bridge to Bus [1022:1635]
00:14.0 SMBus [0c05]: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller [1022:790b] (rev 51)
00:14.3 ISA bridge [0601]: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge [1022:790e] (rev 51)
00:18.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Cezanne Data Fabric; Function 0 [1022:166a]
00:18.1 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Cezanne Data Fabric; Function 1 [1022:166b]
00:18.2 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Cezanne Data Fabric; Function 2 [1022:166c]
00:18.3 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Cezanne Data Fabric; Function 3 [1022:166d]
00:18.4 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Cezanne Data Fabric; Function 4 [1022:166e]
00:18.5 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Cezanne Data Fabric; Function 5 [1022:166f]
00:18.6 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Cezanne Data Fabric; Function 6 [1022:1670]
00:18.7 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Cezanne Data Fabric; Function 7 [1022:1671]
01:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Upstream Port of PCI Express Switch [1002:1478] (rev c3)
02:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Downstream Port of PCI Express Switch [1002:1479]
03:00.0 Display controller [0380]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 23 [Radeon RX 6600/6600 XT/6600M] [1002:73ff] (rev c3)
03:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21/23 HDMI/DP Audio Controller [1002:ab28]
04:00.0 Network controller [0280]: MEDIATEK Corp. MT7921K (RZ608) Wi-Fi 6E 80MHz [14c3:0608]
05:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15)
06:00.0 Non-Volatile memory controller [0108]: Micron/Crucial Technology P1 NVMe PCIe SSD [c0a9:2263] (rev 03)
07:00.0 Non-Volatile memory controller [0108]: Kingston Technology Company, Inc. Device [2646:500c] (rev 01)
08:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1638] (rev c5)
08:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Renoir Radeon High Definition Audio Controller [1002:1637]
08:00.2 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor [1022:15df]
08:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639]
08:00.4 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639]
08:00.5 Multimedia controller [0480]: Advanced Micro Devices, Inc. [AMD] ACP/ACP3X/ACP6x Audio Coprocessor [1022:15e2] (rev 01)
08:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller [1022:15e3]
08:00.7 Signal processing controller [1180]: Advanced Micro Devices, Inc. [AMD] Sensor Fusion Hub [1022:15e4]
Warning:
2023-04-20T12:57:35.450532+02:00 lisa kernel: [ 253.558714][ T487] ------------[ cut here ]------------
2023-04-20T12:57:35.450552+02:00 lisa kernel: [ 253.558721][ T487] WARNING: CPU: 0 PID: 487 at drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:599 amdgpu_irq_put+0x48/0x80 [amdgpu]
2023-04-20T12:57:35.450557+02:00 lisa kernel: [ 253.559029][ T487] Modules linked in: ccm rfcomm snd_seq_dummy snd_hrtimer snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device bnep cpufreq_conservative cpufreq_powersave cpufreq_userspace nls_ascii nls_cp437 vfat fat snd_ctl_led snd_hda_codec_realtek btusb snd_hda_codec_generic btrtl btbcm ledtrig_audio btintel btmtk snd_hda_codec_hdmi bluetooth snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_acp3x_rn snd_soc_dmic snd_acp3x_pdm_dma uvcvideo jitterentropy_rng snd_hwdep snd_soc_core videobuf2_vmalloc snd_hda_core uvc videobuf2_memops sha512_generic snd_pcm_oss videobuf2_v4l2 snd_mixer_oss snd_acp_pci snd_rn_pci_acp3x videodev joydev snd_pcm snd_acp_config msi_wmi snd_soc_acpi ctr drbg ecdh_generic snd_timer ecc videobuf2_common edac_mce_amd rapl snd wmi_bmof sparse_keymap snd_pci_acp3x acpi_cpufreq soundcore ccp k10temp battery ac button hid_sensor_magn_3d hid_sensor_gyro_3d hid_sensor_accel_3d hid_sensor_prox hid_sensor_als hid_sensor_trigger industrialio_triggered_buffer kfifo_buf industrialio amd_pmc
2023-04-20T12:57:35.450561+02:00 lisa kernel: [ 253.559102][ T487] hid_sensor_iio_common hid_multitouch evdev serio_raw mt7921e mt7921_common mt76_connac_lib mt76 mac80211 libarc4 cfg80211 rfkill msr dm_mod loop fuse efi_pstore configfs efivarfs autofs4 ext4 crc32c_generic crc16 mbcache jbd2 usbhid amdgpu drm_ttm_helper ttm gpu_sched i2c_algo_bit xhci_pci drm_buddy nvme drm_suballoc_helper xhci_hcd nvme_core drm_display_helper hid_sensor_hub t10_pi mfd_core hid_generic drm_kms_helper usbcore crc32c_intel psmouse crc64_rocksoft amd_sfh crc64 syscopyarea i2c_hid_acpi crc_t10dif sysfillrect i2c_hid crct10dif_generic sysimgblt i2c_piix4 usb_common crct10dif_common cec hid i2c_designware_platform i2c_designware_core
2023-04-20T12:57:35.450565+02:00 lisa kernel: [ 253.559161][ T487] CPU: 0 PID: 487 Comm: kworker/0:2 Tainted: G W 6.3.0-rc7-next-20230419-dirty #515
2023-04-20T12:57:35.450567+02:00 lisa kernel: [ 253.559166][ T487] Hardware name: Micro-Star International Co., Ltd. Alpha 15 B5EEK/MS-158L, BIOS E158LAMS.107 11/10/2021
2023-04-20T12:57:35.450569+02:00 lisa kernel: [ 253.559168][ T487] Workqueue: pm pm_runtime_work
2023-04-20T12:57:35.450572+02:00 lisa kernel: [ 253.559178][ T487] RIP: 0010:amdgpu_irq_put+0x48/0x80 [amdgpu]
2023-04-20T12:57:35.450574+02:00 lisa kernel: [ 253.559440][ T487] Code: 74 3c 89 d1 48 8d 04 88 8b 08 85 c9 74 1c f0 ff 08 b8 00 00 00 00 74 0d 31 d2 31 c9 31 f6 31 ff c3 cc cc cc cc e9 68 fd ff ff <0f> 0b b8 ea ff ff ff 31 d2 31 c9 31 f6 31 ff c3 cc cc cc cc b8 ea
2023-04-20T12:57:35.450577+02:00 lisa kernel: [ 253.559444][ T487] RSP: 0018:ffffb1cc02c3fce8 EFLAGS: 00010246
2023-04-20T12:57:35.450578+02:00 lisa kernel: [ 253.559448][ T487] RAX: ffff8e6700b14d30 RBX: ffff8e6730900000 RCX: 0000000000000000
2023-04-20T12:57:35.450581+02:00 lisa kernel: [ 253.559450][ T487] RDX: 0000000000000000 RSI: ffff8e6730902d10 RDI: ffff8e6730900000
2023-04-20T12:57:35.450583+02:00 lisa kernel: [ 253.559453][ T487] RBP: ffff8e6730900000 R08: 0000000000000000 R09: 0000000000000000
2023-04-20T12:57:35.450585+02:00 lisa kernel: [ 253.559455][ T487] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000001050
2023-04-20T12:57:35.450587+02:00 lisa kernel: [ 253.559457][ T487] R13: ffff8e6730927a50 R14: 0000000000000000 R15: ffff8e69de61ef80
2023-04-20T12:57:35.450589+02:00 lisa kernel: [ 253.559459][ T487] FS: 0000000000000000(0000) GS:ffff8e69de600000(0000) knlGS:0000000000000000
2023-04-20T12:57:35.450591+02:00 lisa kernel: [ 253.559462][ T487] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
2023-04-20T12:57:35.450593+02:00 lisa kernel: [ 253.559464][ T487] CR2: 00007f1a3ebee000 CR3: 00000003a6c14000 CR4: 0000000000750ef0
2023-04-20T12:57:35.450595+02:00 lisa kernel: [ 253.559467][ T487] PKRU: 55555554
2023-04-20T12:57:35.450598+02:00 lisa kernel: [ 253.559468][ T487] Call Trace:
2023-04-20T12:57:35.450600+02:00 lisa kernel: [ 253.559472][ T487] <TASK>
2023-04-20T12:57:35.450602+02:00 lisa kernel: [ 253.559474][ T487] gmc_v10_0_hw_fini+0x4a/0x90 [amdgpu]
2023-04-20T12:57:35.451317+02:00 lisa kernel: [ 253.559751][ T487] gmc_v10_0_suspend+0x5/0x10 [amdgpu]
2023-04-20T12:57:35.451329+02:00 lisa kernel: [ 253.560030][ T487] amdgpu_device_ip_suspend_phase2+0x102/0x1a0 [amdgpu]
2023-04-20T12:57:35.451332+02:00 lisa kernel: [ 253.560266][ T487] amdgpu_device_suspend+0xfe/0x180 [amdgpu]
2023-04-20T12:57:35.451998+02:00 lisa kernel: [ 253.560575][ T487] amdgpu_pmops_runtime_suspend+0xbb/0x1d0 [amdgpu]
2023-04-20T12:57:35.452011+02:00 lisa kernel: [ 253.560907][ T487] pci_pm_runtime_suspend+0x61/0x1e0
2023-04-20T12:57:35.452014+02:00 lisa kernel: [ 253.560916][ T487] ? pci_dev_put+0x20/0x20
2023-04-20T12:57:35.452016+02:00 lisa kernel: [ 253.560921][ T487] __rpm_callback+0x3f/0x170
2023-04-20T12:57:35.452018+02:00 lisa kernel: [ 253.560927][ T487] ? pci_dev_put+0x20/0x20
2023-04-20T12:57:35.452020+02:00 lisa kernel: [ 253.560932][ T487] rpm_callback+0x5e/0x70
2023-04-20T12:57:35.452022+02:00 lisa kernel: [ 253.560937][ T487] ? pci_dev_put+0x20/0x20
2023-04-20T12:57:35.452025+02:00 lisa kernel: [ 253.560941][ T487] rpm_suspend+0x110/0x5e0
2023-04-20T12:57:35.452028+02:00 lisa kernel: [ 253.560946][ T487] ? __switch_to_asm+0x3a/0x60
2023-04-20T12:57:35.452030+02:00 lisa kernel: [ 253.560951][ T487] ? finish_task_switch.isra.0+0x84/0x280
2023-04-20T12:57:35.452032+02:00 lisa kernel: [ 253.560957][ T487] pm_runtime_work+0x8f/0xa0
2023-04-20T12:57:35.452034+02:00 lisa kernel: [ 253.560962][ T487] process_one_work+0x1fe/0x380
2023-04-20T12:57:35.452035+02:00 lisa kernel: [ 253.560968][ T487] worker_thread+0x45/0x3c0
2023-04-20T12:57:35.452038+02:00 lisa kernel: [ 253.560973][ T487] ? rescuer_thread+0x3b0/0x3b0
2023-04-20T12:57:35.452041+02:00 lisa kernel: [ 253.560977][ T487] kthread+0xdf/0x110
2023-04-20T12:57:35.452043+02:00 lisa kernel: [ 253.560981][ T487] ? kthread_complete_and_exit+0x20/0x20
2023-04-20T12:57:35.452045+02:00 lisa kernel: [ 253.560984][ T487] ret_from_fork+0x22/0x30
2023-04-20T12:57:35.452047+02:00 lisa kernel: [ 253.560989][ T487] </TASK>
2023-04-20T12:57:35.452050+02:00 lisa kernel: [ 253.560991][ T487] ---[ end trace 0000000000000000 ]---
Is the WARN_ON really necessary here?
Edited by Bert Karwatzki