Subject: Re: Warnings when loading amd-pstate-ut kernel module in linux-next-202507{29,31}

From: "Limonciello, Mario" <[email-masked]>
Date: Tue, 5 Aug 2025 20:57:38 +0000

On 7/31/25 7:49 AM, Bert Karwatzki wrote:
> When loading the amd-pstate-ut kernel module in next-202507{29,31} the
> following warnings appear in dmesg (both with and without PREEMPT_RT):
> 
> 2025-07-30T09:47:04.974193+02:00 lisa kernel: [ T3205] amd_pstate_ut: 1    amd_pstate_ut_acpi_cpc_valid	 success!
> 2025-07-30T09:47:04.974204+02:00 lisa kernel: [ T3205] amd_pstate_ut: 2    amd_pstate_ut_check_enabled	 success!
> 2025-07-30T09:47:04.974206+02:00 lisa kernel: [ T3205] amd_pstate_ut: 3    amd_pstate_ut_check_perf	 success!
> 2025-07-30T09:47:04.974207+02:00 lisa kernel: [ T3205] amd_pstate_ut: 4    amd_pstate_ut_check_freq	 success!
> 2025-07-30T09:47:04.974209+02:00 lisa kernel: [ T3205] ------------[ cut here ]------------
> 
> The following message appears about ~100 times (almost identical, some are on a differnent CPU)
> 
> 2025-07-30T09:47:04.974210+02:00 lisa kernel: [ T3205] freq_qos_remove_request() called for unknown object
> 2025-07-30T09:47:04.974212+02:00 lisa kernel: [ T3205] WARNING: kernel/power/qos.c:607 at freq_qos_remove_request+0x89/0xa0, CPU#6: modprobe/3205
> 2025-07-30T09:47:04.974225+02:00 lisa kernel: [ T3205] Modules linked in: amd_pstate_ut(+) ccm snd_seq_dummy snd_hrtimer snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device rfcomm bnep nls_ascii nls_cp437 vfat fat snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg btusb snd_soc_dmic snd_acp3x_pdm_dma snd_acp3x_rn snd_hda_codec btrtl snd_soc_core btintel uvcvideo snd_hda_core btbcm btmtk snd_hwdep videobuf2_vmalloc snd_pcm_oss videobuf2_memops uvc videobuf2_v4l2 snd_mixer_oss bluetooth videodev snd_pcm snd_rn_pci_acp3x snd_acp_config snd_timer videobuf2_common msi_wmi snd_soc_acpi ecdh_generic ecc sparse_keymap mc wmi_bmof snd edac_mce_amd k10temp ccp snd_pci_acp3x soundcore ac battery button joydev hid_sensor_accel_3d hid_sensor_prox hid_sensor_gyro_3d hid_sensor_magn_3d hid_sensor_als hid_sensor_trigger industrialio_triggered_buffer kfifo_buf industrialio amd_pmc evdev hid_sensor_iio_common mt7921e mt7921_common mt792x_lib mt76_connac_lib mt76 mac80211 libarc4 cfg80211 rfkill msr fuse nvme_fabrics efi_pstore configfs
> 2025-07-30T09:47:04.974227+02:00 lisa kernel: [ T3205]  efivarfs autofs4 ext4 mbcache jbd2 usbhid amdgpu drm_client_lib i2c_algo_bit drm_ttm_helper ttm drm_panel_backlight_quirks drm_exec drm_suballoc_helper amdxcp drm_buddy xhci_pci gpu_sched hid_multitouch xhci_hcd drm_display_helper hid_sensor_hub mfd_core hid_generic i2c_hid_acpi psmouse usbcore amd_sfh i2c_hid nvme drm_kms_helper serio_raw hid nvme_core r8169 cec i2c_piix4 usb_common crc16 i2c_smbus i2c_designware_platform i2c_designware_core
> 2025-07-30T09:47:04.974229+02:00 lisa kernel: [ T3205] CPU: 6 UID: 0 PID: 3205 Comm: modprobe Not tainted 6.16.0-next-20250729-master #178 PREEMPT_{RT,(full)}
> 2025-07-30T09:47:04.974230+02:00 lisa kernel: [ T3205] Hardware name: Micro-Star International Co., Ltd. Alpha 15 B5EEK/MS-158L, BIOS E158LAMS.10F 11/11/2024
> 2025-07-30T09:47:04.974232+02:00 lisa kernel: [ T3205] RIP: 0010:freq_qos_remove_request+0x89/0xa0
> 2025-07-30T09:47:04.974233+02:00 lisa kernel: [ T3205] Code: eb e5 48 8d 73 08 b9 ff ff ff ff ba 02 00 00 00 e8 6c fb ff ff eb d0 48 c7 c6 c0 ea 20 bb 48 c7 c7 40 f5 44 bb e8 c7 a1 f9 ff <0f> 0b b8 ea ff ff ff 5b e9 e5 a4 e0 ff b8 ea ff ff ff e9 db a4 e0
> 2025-07-30T09:47:04.974235+02:00 lisa kernel: [ T3205] RSP: 0018:ffff9f57d26f7ba0 EFLAGS: 00010282
> 2025-07-30T09:47:04.974236+02:00 lisa kernel: [ T3205] RAX: 0000000000000000 RBX: ffff9262c1b22b70 RCX: 0000000000000027
> 2025-07-30T09:47:04.974238+02:00 lisa kernel: [ T3205] RDX: ffff92652e796d48 RSI: 0000000000000001 RDI: ffff92652e796d40
> 2025-07-30T09:47:04.974240+02:00 lisa kernel: [ T3205] RBP: ffff9262c0cb2400 R08: 0000000000000000 R09: ffff9f57d26f7970
> 2025-07-30T09:47:04.974241+02:00 lisa kernel: [ T3205] R10: ffff92648f9fffa8 R11: 0000000000000003 R12: ffffffffffffffff
> 2025-07-30T09:47:04.974242+02:00 lisa kernel: [ T3205] R13: ffff9262c0cb2400 R14: ffffffffbb6df900 R15: 00000000ffffffff
> 2025-07-30T09:47:04.974244+02:00 lisa kernel: [ T3205] FS:  00007f1bf1501f00(0000) GS:ffff926572bce000(0000) knlGS:0000000000000000
> 2025-07-30T09:47:04.974245+02:00 lisa kernel: [ T3205] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> 2025-07-30T09:47:04.974247+02:00 lisa kernel: [ T3205] CR2: 00007f1695746002 CR3: 00000001f81e2000 CR4: 0000000000750ef0
> 2025-07-30T09:47:04.974248+02:00 lisa kernel: [ T3205] PKRU: 55555554
> 2025-07-30T09:47:04.974250+02:00 lisa kernel: [ T3205] Call Trace:
> 2025-07-30T09:47:04.974251+02:00 lisa kernel: [ T3205]  <TASK>
> 2025-07-30T09:47:04.974252+02:00 lisa kernel: [ T3205]  acpi_processor_ppc_exit+0x55/0x70
> 2025-07-30T09:47:04.974254+02:00 lisa kernel: [ T3205]  acpi_processor_notifier+0x3b/0x60
> 2025-07-30T09:47:04.974255+02:00 lisa kernel: [ T3205]  blocking_notifier_call_chain+0x5b/0x80
> 2025-07-30T09:47:04.974257+02:00 lisa kernel: [ T3205]  cpufreq_policy_free+0xfc/0x140
> 2025-07-30T09:47:04.974258+02:00 lisa kernel: [ T3205]  subsys_interface_unregister+0x11d/0x130
> 2025-07-30T09:47:04.974260+02:00 lisa kernel: [ T3205]  cpufreq_unregister_driver+0x2f/0xc0
> 2025-07-30T09:47:04.974261+02:00 lisa kernel: [ T3205]  amd_pstate_unregister_driver+0x10/0x40
> 2025-07-30T09:47:04.974262+02:00 lisa kernel: [ T3205]  amd_pstate_update_status+0x9c/0xe0
> 2025-07-30T09:47:04.974263+02:00 lisa kernel: [ T3205]  amd_pstate_ut_check_driver+0x22/0xb0 [amd_pstate_ut]
> 2025-07-30T09:47:04.974265+02:00 lisa kernel: [ T3205]  amd_pstate_ut_init+0x1c/0x1000 [amd_pstate_ut]
> 2025-07-30T09:47:04.974267+02:00 lisa kernel: [ T3205]  ? wmi_bmof_driver_exit+0xf30/0xf30 [wmi_bmof]
> 2025-07-30T09:47:04.974268+02:00 lisa kernel: [ T3205]  do_one_initcall+0x48/0x290
> 2025-07-30T09:47:04.974270+02:00 lisa kernel: [ T3205]  ? srso_alias_return_thunk+0x5/0xfbef5
> 2025-07-30T09:47:04.974281+02:00 lisa kernel: [ T3205]  ? __kmalloc_cache_noprof+0x7c/0x160
> 2025-07-30T09:47:04.974283+02:00 lisa kernel: [ T3205]  do_init_module+0x5b/0x230
> 2025-07-30T09:47:04.974285+02:00 lisa kernel: [ T3205]  init_module_from_file+0x83/0xd0
> 2025-07-30T09:47:04.974286+02:00 lisa kernel: [ T3205]  idempotent_init_module+0xf9/0x2f0
> 2025-07-30T09:47:04.974288+02:00 lisa kernel: [ T3205]  __x64_sys_finit_module+0x68/0xd0
> 2025-07-30T09:47:04.974289+02:00 lisa kernel: [ T3205]  ? srso_alias_return_thunk+0x5/0xfbef5
> 2025-07-30T09:47:04.974291+02:00 lisa kernel: [ T3205]  do_syscall_64+0x65/0xfc0
> 2025-07-30T09:47:04.974292+02:00 lisa kernel: [ T3205]  entry_SYSCALL_64_after_hwframe+0x55/0x5d
> 2025-07-30T09:47:04.974293+02:00 lisa kernel: [ T3205] RIP: 0033:0x7f1bf16fb779
> 2025-07-30T09:47:04.974294+02:00 lisa kernel: [ T3205] Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 4f 86 0d 00 f7 d8 64 89 01 48
> 2025-07-30T09:47:04.974295+02:00 lisa kernel: [ T3205] RSP: 002b:00007fff3e7ea698 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
> 2025-07-30T09:47:04.974297+02:00 lisa kernel: [ T3205] RAX: ffffffffffffffda RBX: 000056406adbfa30 RCX: 00007f1bf16fb779
> 2025-07-30T09:47:04.974298+02:00 lisa kernel: [ T3205] RDX: 0000000000000004 RSI: 000056406410632b RDI: 0000000000000003
> 2025-07-30T09:47:04.974300+02:00 lisa kernel: [ T3205] RBP: 0000000000000004 R08: 0000000000000000 R09: 000056406adc1420
> 2025-07-30T09:47:04.974301+02:00 lisa kernel: [ T3205] R10: 0000000000000000 R11: 0000000000000246 R12: 000056406410632b
> 2025-07-30T09:47:04.974303+02:00 lisa kernel: [ T3205] R13: 0000000000040000 R14: 000056406adbfb60 R15: 0000000000000000
> 2025-07-30T09:47:04.974304+02:00 lisa kernel: [ T3205]  </TASK>
> 2025-07-30T09:47:04.974306+02:00 lisa kernel: [ T3205] ---[ end trace 0000000000000000 ]---
> 
> [...]
> 
> 2025-07-30T09:47:05.985112+02:00 lisa kernel: [ T3205] amd_pstate_ut: 5    amd_pstate_ut_check_driver	 success!
> 
> 
> I bisected this (in between v6.16 and next-20250729) and found
> the first bad commit to be
> commit d33bd88ac0eb ("ACPI: processor: perflib: Fix initial _PPC limit application").
> 
> Note that there is another bug [0] when loading amd-pstate-ut. This bug
> is present in every version since at least v6.13 while the warning issue
> reported in this email is only present in linux-next.
> 
> [0] https://lore.kernel.org/lkml/[email-masked]/T/#u
> 
> 
> Bert Karwatzki
>      

Considering the changes in d33bd88ac0eb would it make sense to do 
something like this:

diff --git a/drivers/acpi/processor_perflib.c 
b/drivers/acpi/processor_perflib.c
index 755003bf3a45..c70e9e89854f 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -211,7 +211,7 @@ void acpi_processor_ppc_exit(struct cpufreq_policy 
*policy)
         for_each_cpu(cpu, policy->related_cpus) {
                 struct acpi_processor *pr = per_cpu(processors, cpu);

-               if (pr)
+               if (pr && pr->performance)
                         freq_qos_remove_request(&pr->perflib_req);
         }
  }