Rafael J. Wysocki
fcecef9a84
thermal: core: Fix thermal zone suspend-resume synchronization
...
[ Upstream commit 4e814173a8 ]
There are 3 synchronization issues with thermal zone suspend-resume
during system-wide transitions:
1. The resume code runs in a PM notifier which is invoked after user
space has been thawed, so it can run concurrently with user space
which can trigger a thermal zone device removal. If that happens,
the thermal zone resume code may use a stale pointer to the next
list element and crash, because it does not hold thermal_list_lock
while walking thermal_tz_list.
2. The thermal zone resume code calls thermal_zone_device_init()
outside the zone lock, so user space or an update triggered by
the platform firmware may see an inconsistent state of a
thermal zone leading to unexpected behavior.
3. Clearing the in_suspend global variable in thermal_pm_notify()
allows __thermal_zone_device_update() to continue for all thermal
zones and it may as well run before the thermal_tz_list walk (or
at any point during the list walk for that matter) and attempt to
operate on a thermal zone that has not been resumed yet. It may
also race destructively with thermal_zone_device_init().
To address these issues, add thermal_list_lock locking to
thermal_pm_notify(), especially arount the thermal_tz_list,
make it call thermal_zone_device_init() back-to-back with
__thermal_zone_device_update() under the zone lock and replace
in_suspend with per-zone bool "suspend" indicators set and unset
under the given zone's lock.
Link: https://lore.kernel.org/linux-pm/20231218162348.69101-1-bo.ye@mediatek.com/
Reported-by: Bo Ye <bo.ye@mediatek.com >
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2024-02-05 20:14:15 +00:00
..
2023-09-20 09:39:03 +02:00
2023-08-16 09:14:14 -07:00
2023-07-28 09:45:25 +02:00
2023-09-18 12:04:50 +02:00
2023-08-22 14:13:11 -07:00
2023-08-07 20:55:27 +02:00
2023-09-01 09:53:54 -07:00
2024-01-25 15:35:39 -08:00
2023-08-22 16:32:35 +02:00
2024-01-25 15:35:52 -08:00
2023-08-29 17:45:22 -04:00
2023-11-20 11:59:23 +01:00
2023-08-23 08:25:28 +01:00
2024-01-31 16:19:02 -08:00
2023-11-28 17:20:01 +00:00
2024-01-31 16:18:50 -08:00
2023-10-04 14:12:01 +02:00
2023-08-25 07:42:58 +01:00
2023-08-16 10:54:46 -06:00
2023-09-01 08:09:48 -07:00
2023-09-07 16:07:35 -07:00
2023-08-23 08:21:37 +01:00
2023-09-06 22:53:55 +08:00
2023-08-18 13:58:05 +01:00
2023-12-03 07:33:06 +01:00
2023-08-30 19:53:39 -07:00
2024-01-31 16:18:47 -08:00
2023-11-28 17:19:55 +00:00
2023-11-28 17:19:49 +00:00
2023-12-20 17:01:42 +01:00
2023-08-15 12:50:53 +01:00
2023-10-04 16:31:27 +01:00
2023-09-11 15:24:16 -07:00
2023-08-07 14:55:33 +02:00
2023-12-08 08:52:24 +01:00
2023-08-18 10:18:56 -07:00
2023-08-04 17:35:33 +01:00
2023-09-12 13:07:37 +01:00
2024-01-31 16:18:49 -08:00
2023-08-31 01:29:28 +02:00
2023-08-21 13:38:01 -07:00
2024-01-25 15:35:46 -08:00
2024-01-20 11:51:38 +01:00
2023-08-30 17:35:54 +08:00
2024-01-05 15:19:42 +01:00
2024-01-25 15:35:28 -08:00
2023-07-31 14:44:02 -07:00
2024-01-31 16:18:59 -08:00
2024-01-31 16:19:04 -08:00
2024-01-25 15:35:22 -08:00
2023-09-15 12:08:27 -07:00
2023-09-02 11:10:50 -07:00
2023-09-17 10:33:53 -07:00
2023-08-24 16:20:25 -07:00
2023-08-02 16:27:07 +02:00
2023-10-12 07:22:56 -10:00
2024-01-25 15:35:38 -08:00
2023-08-04 18:18:19 -07:00
2023-08-17 16:46:35 -07:00
2023-08-15 14:57:24 -07:00
2023-07-23 11:34:22 +01:00
2023-07-20 13:06:22 +02:00
2023-07-26 16:46:25 +01:00
2023-08-16 09:41:29 -04:00
2023-07-28 09:53:37 +02:00
2023-10-11 14:27:37 +02:00
2023-08-29 20:51:40 +02:00
2023-12-13 18:44:56 +01:00
2023-08-24 16:25:13 -07:00
2023-12-20 17:01:51 +01:00
2024-01-01 12:42:23 +00:00
2024-01-10 17:16:53 +01:00
2023-08-05 08:31:41 +02:00
2024-01-20 11:51:44 +01:00
2023-07-20 17:25:04 -05:00
2023-08-25 16:07:30 -07:00
2023-12-08 08:52:19 +01:00
2023-07-31 17:54:28 +02:00
2023-08-01 18:02:20 +02:00
2023-08-09 17:46:19 +02:00
2023-08-04 15:28:41 +02:00
2023-08-30 13:34:34 -07:00
2023-08-23 14:17:42 -07:00
2023-11-28 17:20:11 +00:00
2024-01-05 15:19:41 +01:00
2023-07-25 00:59:32 +09:00
2023-07-24 04:39:16 +09:00
2023-11-28 17:19:45 +00:00
2023-09-01 00:29:34 +02:00
2024-01-31 16:19:04 -08:00
2023-10-12 18:53:36 +03:00
2023-07-24 10:30:07 +02:00
2024-01-05 15:19:40 +01:00
2023-08-01 23:46:17 +02:00
2023-08-22 05:20:34 -04:00
2023-11-28 17:19:35 +00:00
2023-08-18 10:18:57 -07:00
2023-08-18 10:18:57 -07:00
2023-08-14 11:23:35 +02:00
2023-12-03 07:33:04 +01:00
2023-12-13 18:45:21 +01:00
2024-01-25 15:35:17 -08:00
2023-12-13 18:44:56 +01:00
2023-08-21 14:28:43 -07:00
2023-12-13 18:45:24 +01:00
2023-08-16 23:54:50 +10:00
2023-11-20 11:59:18 +01:00
2023-09-04 11:26:29 -07:00
2023-09-13 10:48:48 +02:00
2023-11-20 11:59:35 +01:00
2024-01-20 11:51:37 +01:00
2023-08-25 08:08:27 +01:00
2023-09-19 16:28:37 +02:00
2023-08-04 11:02:46 +01:00
2023-09-12 17:50:53 +02:00
2023-08-01 13:45:08 +02:00
2023-08-22 01:11:32 +03:00
2023-09-27 16:54:03 +02:00
2023-12-08 08:52:20 +01:00
2023-08-09 10:46:15 -06:00
2023-08-29 20:21:42 -07:00
2023-12-08 08:52:19 +01:00
2023-07-28 13:31:24 -03:00
2023-08-18 10:12:35 -07:00
2023-09-01 08:11:51 +01:00
2023-11-28 17:19:56 +00:00
2024-01-20 11:51:42 +01:00
2023-10-18 12:12:41 -07:00
2023-08-21 13:46:24 -07:00
2023-08-05 08:31:42 +02:00
2023-08-24 16:25:14 -07:00
2024-01-01 12:42:33 +00:00
2023-08-18 10:12:39 -07:00
2023-08-05 08:31:41 +02:00
2023-12-13 18:45:31 +01:00
2023-08-18 10:12:10 -07:00
2023-08-18 10:18:59 -07:00
2023-08-31 13:48:50 -04:00
2023-08-17 09:00:34 +01:00
2023-09-28 21:23:03 +09:00
2023-08-18 10:19:00 -07:00
2023-08-15 14:57:25 -07:00
2023-08-07 13:05:53 -07:00
2024-01-31 16:18:54 -08:00
2023-09-29 17:20:46 -07:00
2023-08-18 10:18:59 -07:00
2024-01-31 16:18:56 -08:00
2023-10-05 09:50:14 +02:00
2023-08-21 13:37:47 -07:00
2023-09-19 13:21:34 -07:00
2023-08-21 13:37:48 -07:00
2023-08-18 10:12:11 -07:00
2023-08-21 13:37:49 -07:00
2024-01-25 15:35:53 -08:00
2023-08-04 12:09:56 +05:30
2023-09-06 20:49:04 -07:00
2023-08-30 13:45:05 -07:00
2023-12-20 17:02:02 +01:00
2023-08-18 10:12:36 -07:00
2023-08-24 16:20:28 -07:00
2023-08-31 12:20:12 -07:00
2023-08-18 10:12:46 -07:00
2023-08-18 10:12:41 -07:00
2024-01-31 16:18:56 -08:00
2023-07-24 12:09:47 -07:00
2023-08-03 13:42:02 -07:00
2023-11-28 17:19:56 +00:00
2023-08-02 19:11:06 -07:00
2023-08-09 15:32:43 -07:00
2023-12-03 07:33:04 +01:00
2024-01-25 15:35:59 -08:00
2023-07-28 16:52:08 -07:00
2023-07-23 11:34:22 +01:00
2023-09-13 11:51:11 -04:00
2023-09-13 11:51:11 -04:00
2023-07-25 00:30:02 -05:00
2023-08-18 10:19:00 -07:00
2023-08-16 14:27:01 -07:00
2023-08-21 11:29:12 -07:00
2023-11-20 11:58:53 +01:00
2023-09-05 05:34:14 -04:00
2023-08-23 16:34:02 +02:00
2023-12-20 17:02:06 +01:00
2023-08-04 11:36:33 -06:00
2023-09-05 13:02:13 -05:00
2023-09-09 08:18:16 -05:00
2023-08-21 13:37:31 -07:00
2023-08-18 10:12:25 -07:00
2023-08-24 16:20:18 -07:00
2023-08-21 14:28:45 -07:00
2023-12-03 07:33:03 +01:00
2023-08-21 13:07:20 -07:00
2023-11-28 17:19:37 +00:00
2024-01-25 15:35:50 -08:00
2023-08-04 16:21:30 +02:00
2023-08-25 08:06:53 -07:00
2023-11-28 17:19:54 +00:00
2023-09-29 17:20:46 -07:00
2023-08-14 08:12:53 +01:00
2023-08-02 19:11:06 -07:00
2023-09-06 07:46:49 +01:00
2023-08-21 13:37:59 -07:00
2024-01-31 16:19:09 -08:00
2023-07-24 13:27:12 +05:30
2023-08-22 21:31:57 +02:00
2023-07-24 09:51:51 +02:00
2023-08-22 22:03:43 +02:00
2023-11-20 11:58:57 +01:00
2023-11-08 11:56:20 +01:00
2023-11-28 17:19:48 +00:00
2023-08-12 09:18:47 -07:00
2023-08-02 15:01:51 -07:00
2023-08-09 15:59:21 -07:00
2023-11-28 17:19:48 +00:00
2023-10-06 11:01:23 +02:00
2023-10-06 11:01:23 +02:00
2023-08-24 21:34:28 -04:00
2023-08-18 10:19:00 -07:00
2023-08-16 14:27:41 -07:00
2024-01-25 15:35:49 -08:00
2023-09-19 13:21:34 -07:00
2023-12-13 18:45:19 +01:00
2024-01-31 16:18:56 -08:00
2023-08-27 23:50:22 +02:00
2023-08-30 10:08:38 +02:00
2023-12-13 18:45:15 +01:00
2023-08-24 16:20:31 -07:00
2024-01-31 16:18:54 -08:00
2023-08-22 11:10:26 -06:00
2023-07-27 08:48:12 -07:00
2023-09-21 08:37:44 +02:00
2024-01-31 16:19:14 -08:00
2023-08-09 09:15:51 +02:00
2024-01-25 15:35:59 -08:00
2024-01-31 16:19:01 -08:00
2023-07-26 21:24:40 -07:00
2023-11-28 17:19:38 +00:00
2023-08-21 13:46:24 -07:00
2024-01-25 15:35:49 -08:00
2023-08-16 14:27:01 -07:00
2024-01-31 16:18:47 -08:00
2023-07-28 17:05:47 +02:00
2023-08-04 18:21:50 -07:00
2023-11-28 17:19:40 +00:00
2023-08-24 16:20:28 -07:00
2023-08-21 13:37:26 -07:00
2023-08-18 10:12:16 -07:00
2023-09-27 11:19:15 +02:00
2023-08-09 14:16:44 -05:00
2024-01-31 16:19:14 -08:00
2023-11-28 17:19:57 +00:00
2023-07-25 19:21:03 +02:00
2023-07-28 18:04:14 -07:00
2023-08-06 08:24:55 +01:00
2024-02-05 20:14:15 +00:00
2023-08-11 21:12:45 +02:00
2023-11-20 11:58:51 +01:00
2023-11-28 17:20:08 +00:00
2023-08-07 17:55:54 +00:00
2023-11-08 11:56:21 +01:00
2023-07-30 18:13:34 -04:00
2023-08-22 14:58:15 +02:00
2023-08-11 21:12:46 +02:00
2023-08-22 14:58:15 +02:00
2023-08-11 21:12:47 +02:00
2023-08-11 21:12:44 +02:00
2023-08-27 11:47:44 +02:00
2023-11-20 11:58:56 +01:00
2023-07-24 18:03:58 -04:00
2023-08-09 14:17:06 +02:00
2023-08-18 10:12:16 -07:00
2023-09-03 18:10:22 -04:00
2023-11-20 11:59:18 +01:00
2023-12-08 08:52:25 +01:00
2023-08-24 13:27:47 -05:00
2024-01-25 15:35:57 -08:00
2024-01-25 15:35:26 -08:00
2023-09-04 13:44:11 -07:00
2023-11-28 17:19:36 +00:00
2023-08-21 14:52:16 +02:00
2023-09-05 19:01:38 -04:00
2023-08-10 12:06:04 +02:00
2023-08-21 13:37:27 -07:00