Kai-Heng Feng
90f039c3ff
power: supply: core: Use blocking_notifier_call_chain to avoid RCU complaint
[ Upstream commit bbaa6ffa5b ]
AMD PMF driver can cause the following warning:
[ 196.159546] ------------[ cut here ]------------
[ 196.159556] Voluntary context switch within RCU read-side critical section!
[ 196.159571] WARNING: CPU: 0 PID: 9 at kernel/rcu/tree_plugin.h:320 rcu_note_context_switch+0x43d/0x560
[ 196.159604] Modules linked in: nvme_fabrics ccm rfcomm snd_hda_scodec_cs35l41_spi cmac algif_hash algif_skcipher af_alg bnep joydev btusb btrtl uvcvideo btintel btbcm videobuf2_vmalloc intel_rapl_msr btmtk videobuf2_memops uvc videobuf2_v4l2 intel_rapl_common binfmt_misc hid_sensor_als snd_sof_amd_vangogh hid_sensor_trigger bluetooth industrialio_triggered_buffer videodev snd_sof_amd_rembrandt hid_sensor_iio_common amdgpu ecdh_generic kfifo_buf videobuf2_common hp_wmi kvm_amd sparse_keymap snd_sof_amd_renoir wmi_bmof industrialio ecc mc nls_iso8859_1 kvm snd_sof_amd_acp irqbypass snd_sof_xtensa_dsp crct10dif_pclmul crc32_pclmul mt7921e snd_sof_pci snd_ctl_led polyval_clmulni mt7921_common polyval_generic snd_sof ghash_clmulni_intel mt792x_lib mt76_connac_lib sha512_ssse3 snd_sof_utils aesni_intel snd_hda_codec_realtek crypto_simd mt76 snd_hda_codec_generic cryptd snd_soc_core snd_hda_codec_hdmi rapl ledtrig_audio input_leds snd_compress i2c_algo_bit drm_ttm_helper mac80211 snd_pci_ps hid_multitouch ttm drm_exec
[ 196.159970] drm_suballoc_helper snd_rpl_pci_acp6x amdxcp drm_buddy snd_hda_intel snd_acp_pci snd_hda_scodec_cs35l41_i2c serio_raw gpu_sched snd_hda_scodec_cs35l41 snd_acp_legacy_common snd_intel_dspcfg snd_hda_cs_dsp_ctls snd_hda_codec libarc4 drm_display_helper snd_pci_acp6x cs_dsp snd_hwdep snd_soc_cs35l41_lib video k10temp snd_pci_acp5x thunderbolt snd_hda_core drm_kms_helper cfg80211 snd_seq snd_rn_pci_acp3x snd_pcm snd_acp_config cec snd_soc_acpi snd_seq_device rc_core ccp snd_pci_acp3x snd_timer snd soundcore wmi amd_pmf platform_profile amd_pmc mac_hid serial_multi_instantiate wireless_hotkey hid_sensor_hub sch_fq_codel msr parport_pc ppdev lp parport efi_pstore ip_tables x_tables autofs4 btrfs blake2b_generic raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx libcrc32c xor raid6_pq raid1 raid0 multipath linear dm_mirror dm_region_hash dm_log cdc_ether usbnet r8152 mii hid_generic nvme i2c_hid_acpi i2c_hid nvme_core i2c_piix4 xhci_pci amd_sfh drm xhci_pci_renesas nvme_common hid
[ 196.160382] CPU: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.6.0-rc1 #4
[ 196.160397] Hardware name: HP HP EliteBook 845 14 inch G10 Notebook PC/8B6E, BIOS V82 Ver. 01.02.00 08/24/2023
[ 196.160405] Workqueue: events power_supply_changed_work
[ 196.160426] RIP: 0010:rcu_note_context_switch+0x43d/0x560
[ 196.160440] Code: 00 48 89 be 40 08 00 00 48 89 86 48 08 00 00 48 89 10 e9 63 fe ff ff 48 c7 c7 10 e7 b0 9e c6 05 e8 d8 20 02 01 e8 13 0f f3 ff <0f> 0b e9 27 fc ff ff a9 ff ff ff 7f 0f 84 cf fc ff ff 65 48 8b 3c
[ 196.160450] RSP: 0018:ffffc900001878f0 EFLAGS: 00010046
[ 196.160462] RAX: 0000000000000000 RBX: ffff88885e834040 RCX: 0000000000000000
[ 196.160470] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 196.160476] RBP: ffffc90000187910 R08: 0000000000000000 R09: 0000000000000000
[ 196.160482] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 196.160488] R13: 0000000000000000 R14: ffff888100990000 R15: ffff888100990000
[ 196.160495] FS: 0000000000000000(0000) GS:ffff88885e800000(0000) knlGS:0000000000000000
[ 196.160504] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 196.160512] CR2: 000055cb053c8246 CR3: 000000013443a000 CR4: 0000000000750ef0
[ 196.160520] PKRU: 55555554
[ 196.160526] Call Trace:
[ 196.160532] <TASK>
[ 196.160548] ? show_regs+0x72/0x90
[ 196.160570] ? rcu_note_context_switch+0x43d/0x560
[ 196.160580] ? __warn+0x8d/0x160
[ 196.160600] ? rcu_note_context_switch+0x43d/0x560
[ 196.160613] ? report_bug+0x1bb/0x1d0
[ 196.160637] ? handle_bug+0x46/0x90
[ 196.160658] ? exc_invalid_op+0x19/0x80
[ 196.160675] ? asm_exc_invalid_op+0x1b/0x20
[ 196.160709] ? rcu_note_context_switch+0x43d/0x560
[ 196.160727] __schedule+0xb9/0x15f0
[ 196.160746] ? srso_alias_return_thunk+0x5/0x7f
[ 196.160765] ? srso_alias_return_thunk+0x5/0x7f
[ 196.160778] ? acpi_ns_search_one_scope+0xbe/0x270
[ 196.160806] schedule+0x68/0x110
[ 196.160820] schedule_timeout+0x151/0x160
[ 196.160829] ? srso_alias_return_thunk+0x5/0x7f
[ 196.160842] ? srso_alias_return_thunk+0x5/0x7f
[ 196.160855] ? acpi_ns_lookup+0x3c5/0xa90
[ 196.160878] __down_common+0xff/0x220
[ 196.160905] __down_timeout+0x16/0x30
[ 196.160920] down_timeout+0x64/0x70
[ 196.160938] acpi_os_wait_semaphore+0x85/0x200
[ 196.160959] acpi_ut_acquire_mutex+0x9e/0x280
[ 196.160979] acpi_ex_enter_interpreter+0x2d/0xb0
[ 196.160992] acpi_ns_evaluate+0x2f0/0x5f0
[ 196.161005] acpi_evaluate_object+0x172/0x490
[ 196.161018] ? acpi_os_signal_semaphore+0x8a/0xd0
[ 196.161038] acpi_evaluate_integer+0x52/0xe0
[ 196.161055] ? kfree+0x79/0x120
[ 196.161071] ? srso_alias_return_thunk+0x5/0x7f
[ 196.161089] acpi_ac_get_state.part.0+0x27/0x80
[ 196.161110] get_ac_property+0x5c/0x70
[ 196.161127] ? __pfx___power_supply_is_system_supplied+0x10/0x10
[ 196.161146] __power_supply_is_system_supplied+0x44/0xb0
[ 196.161166] class_for_each_device+0x124/0x160
[ 196.161184] ? acpi_ac_get_state.part.0+0x27/0x80
[ 196.161203] ? srso_alias_return_thunk+0x5/0x7f
[ 196.161223] power_supply_is_system_supplied+0x3c/0x70
[ 196.161243] amd_pmf_get_power_source+0xe/0x20 [amd_pmf]
[ 196.161276] amd_pmf_power_slider_update_event+0x49/0x90 [amd_pmf]
[ 196.161310] amd_pmf_pwr_src_notify_call+0xe7/0x100 [amd_pmf]
[ 196.161340] notifier_call_chain+0x5f/0xe0
[ 196.161362] atomic_notifier_call_chain+0x33/0x60
[ 196.161378] power_supply_changed_work+0x84/0x110
[ 196.161394] process_one_work+0x178/0x360
[ 196.161412] ? __pfx_worker_thread+0x10/0x10
[ 196.161424] worker_thread+0x307/0x430
[ 196.161440] ? __pfx_worker_thread+0x10/0x10
[ 196.161451] kthread+0xf4/0x130
[ 196.161467] ? __pfx_kthread+0x10/0x10
[ 196.161486] ret_from_fork+0x43/0x70
[ 196.161502] ? __pfx_kthread+0x10/0x10
[ 196.161518] ret_from_fork_asm+0x1b/0x30
[ 196.161558] </TASK>
[ 196.161562] ---[ end trace 0000000000000000 ]---
Since there's no guarantee that all the callbacks can work in atomic
context, switch to use blocking_notifier_call_chain to relax the
constraint.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reported-by: Allen Zhong <allen@atr.me>
Fixes: 4c71ae4144 ("platform/x86/amd/pmf: Add support SPS PMF feature")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217571
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20230913033233.602986-1-kai.heng.feng@canonical.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-08 11:56:20 +01:00
..
2023-10-26 07:43:28 +02:00
2023-10-22 12:47:43 +02:00
2023-08-22 15:50:57 +02:00
2023-10-05 12:48:08 +02:00
2023-10-27 10:00:19 +09:00
2023-08-30 13:34:34 -07:00
2023-10-18 09:30:03 -07:00
2023-10-06 15:43:19 -07:00
2023-10-13 20:03:04 -07:00
2023-09-13 10:24:53 +03:00
2023-10-26 09:42:37 +02:00
2023-09-13 11:44:20 -07:00
2023-10-27 16:52:51 -10:00
2023-09-04 13:15:57 -07:00
2023-09-12 15:49:20 +02:00
2023-10-24 10:53:45 +02:00
2023-10-02 13:13:15 +02:00
2023-08-29 20:51:40 +02:00
2023-08-31 12:43:10 -07:00
2023-10-18 11:30:06 -04:00
2023-09-22 14:31:04 -07:00
2023-08-24 16:20:30 -07:00
2023-10-13 08:52:57 -07:00
2023-10-05 11:05:58 +02:00
2023-08-30 19:23:00 -07:00
2023-10-27 10:00:19 +09:00
2023-10-26 08:17:26 -10:00
2023-10-24 19:32:39 +02:00
2023-08-22 15:51:33 +02:00
2023-10-20 11:24:16 +02:00
2023-11-08 11:56:20 +01:00
2023-10-06 16:09:14 +02:00
2023-08-28 13:31:06 -05:00
2023-09-04 11:26:29 -07:00
2023-09-18 11:52:18 -07:00
2023-09-20 10:46:30 +01:00
2023-10-21 20:31:04 +02:00
2023-09-06 01:21:47 +02:00
2023-08-28 16:35:01 -07:00
2023-10-17 20:25:32 +01:00
2023-10-05 20:01:47 +03:00
2023-10-13 23:19:16 -07:00
2023-08-30 19:53:39 -07:00
2023-10-27 08:57:09 +02:00
2023-10-28 08:12:34 -10:00
2023-10-23 09:39:46 +01:00
2023-09-19 15:16:23 +01:00
2023-08-31 12:43:10 -07:00
2023-09-05 10:11:01 -05:00
2023-10-05 09:50:14 +02:00
2023-10-10 10:47:35 -07:00
2023-10-11 15:26:16 +02:00
2023-10-05 11:03:20 -07:00
2023-10-16 20:58:50 +02:00
2023-09-27 12:17:04 +02:00
2023-10-20 13:12:34 -07:00
2023-08-28 13:36:24 -05:00
2023-10-25 17:48:31 -07:00
2023-08-30 18:32:24 -07:00
2023-08-22 12:38:19 -04:00
2023-08-30 20:52:08 -07:00
2023-10-18 14:08:39 -07:00
2023-10-16 21:00:08 +02:00
2023-10-02 11:34:23 -05:00
2023-08-18 10:55:49 +05:30
2023-08-31 21:42:42 +02:00
2023-09-01 09:38:00 -07:00
2023-10-06 09:11:13 -07:00
2023-10-13 09:17:48 -07:00
2023-10-22 07:11:10 -10:00
2023-10-19 10:12:48 +02:00
2023-10-27 16:42:12 +02:00
2023-10-05 00:28:52 +02:00
2023-08-17 19:38:35 +02:00
2023-11-08 11:56:20 +01:00
2023-09-06 22:21:22 +02:00
2023-10-02 07:19:22 +01:00
2023-09-07 18:05:58 -07:00
2023-09-26 17:26:08 +02:00
2023-09-04 15:12:26 -07:00
2023-08-30 19:53:39 -07:00
2023-09-04 15:08:52 -07:00
2023-09-07 16:07:35 -07:00
2023-10-21 10:11:11 -07:00
2023-08-28 13:36:24 -05:00
2023-10-27 13:38:59 -10:00
2023-10-26 17:06:42 +02:00
2023-09-21 11:31:33 +02:00
2023-10-02 15:03:19 +01:00
2023-10-02 10:02:53 +02:00
2023-09-27 10:55:29 -04:00
2023-10-12 11:52:23 -07:00
2023-09-18 13:13:05 +02:00
2023-10-17 19:25:42 +02:00
2023-10-07 11:23:47 +02:00
2023-10-09 21:33:30 -04:00
2023-08-22 13:41:55 +02:00
2023-10-20 07:52:44 +02:00
2023-10-18 11:29:41 -04:00
2023-09-22 12:48:04 -06:00
2023-10-18 11:29:56 -04:00
2023-10-17 17:14:22 -07:00
2023-08-24 16:20:18 -07:00
2023-10-18 11:30:12 -04:00
2023-09-13 10:48:42 +02:00
2023-09-06 09:19:12 -07:00
2023-10-09 09:21:16 +02:00
2023-08-21 13:27:44 +02:00
2023-09-08 11:24:34 -07:00
2023-09-13 11:09:21 +02:00