mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] thermal: intel: int340x: processor_thermal: Fix additional deadlock
@ 2023-03-29 15:22 Srinivas Pandruvada
  2023-03-29 18:37 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Pandruvada @ 2023-03-29 15:22 UTC (permalink / raw)
  To: rafael, rui.zhang, daniel.lezcano
  Cc: linux-pm, linux-kernel, Srinivas Pandruvada, stable

Commit 52f04f10b900 ("thermal: intel: int340x: processor_thermal: Fix
deadlock") addressed deadlock issue during user space trip update. But it
missed a case when thermal zone device is disabled when user writes 0.

Call to thermal_zone_device_disable() also causes deadlock as it also
tries to lock tz->lock, which is already claimed by trip_point_temp_store()
in the thermal core code.

Remove call to thermal_zone_device_disable() in the function
sys_set_trip_temp(), which is called from trip_point_temp_store().

Fixes: 52f04f10b900 ("thermal: intel: int340x: processor_thermal: Fix deadlock")
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: stable@vger.kernel.org # 6.2+
---
 .../thermal/intel/int340x_thermal/processor_thermal_device_pci.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
index 90526f46c9b1..d71ee50e7878 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
@@ -153,7 +153,6 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp
 		cancel_delayed_work_sync(&pci_info->work);
 		proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 0);
 		proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_THRES_0, 0);
-		thermal_zone_device_disable(tzd);
 		pci_info->stored_thres = 0;
 		return 0;
 	}
-- 
2.39.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] thermal: intel: int340x: processor_thermal: Fix additional deadlock
  2023-03-29 15:22 [PATCH] thermal: intel: int340x: processor_thermal: Fix additional deadlock Srinivas Pandruvada
@ 2023-03-29 18:37 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-03-29 18:37 UTC (permalink / raw)
  To: Srinivas Pandruvada
  Cc: rafael, rui.zhang, daniel.lezcano, linux-pm, linux-kernel, stable

On Wed, Mar 29, 2023 at 5:23 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> Commit 52f04f10b900 ("thermal: intel: int340x: processor_thermal: Fix
> deadlock") addressed deadlock issue during user space trip update. But it
> missed a case when thermal zone device is disabled when user writes 0.
>
> Call to thermal_zone_device_disable() also causes deadlock as it also
> tries to lock tz->lock, which is already claimed by trip_point_temp_store()
> in the thermal core code.
>
> Remove call to thermal_zone_device_disable() in the function
> sys_set_trip_temp(), which is called from trip_point_temp_store().
>
> Fixes: 52f04f10b900 ("thermal: intel: int340x: processor_thermal: Fix deadlock")
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: stable@vger.kernel.org # 6.2+
> ---
>  .../thermal/intel/int340x_thermal/processor_thermal_device_pci.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
> index 90526f46c9b1..d71ee50e7878 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
> @@ -153,7 +153,6 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp
>                 cancel_delayed_work_sync(&pci_info->work);
>                 proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 0);
>                 proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_THRES_0, 0);
> -               thermal_zone_device_disable(tzd);
>                 pci_info->stored_thres = 0;
>                 return 0;
>         }
> --

Applied as 6.3-rc material, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-29 18:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 15:22 [PATCH] thermal: intel: int340x: processor_thermal: Fix additional deadlock Srinivas Pandruvada
2023-03-29 18:37 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®