From: Johan Hovold <johan+linaro@kernel.org>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Cc: Amit Kucheria <amitk@kernel.org>,
Thara Gopinath <thara.gopinath@gmail.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Zhang Rui <rui.zhang@intel.com>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-tegra@vger.kernel.org,
Johan Hovold <johan+linaro@kernel.org>
Subject: [PATCH 1/4] thermal/drivers/qcom: fix set_trip_temp() deadlock
Date: Wed, 14 Dec 2022 14:16:14 +0100 [thread overview]
Message-ID: <20221214131617.2447-2-johan+linaro@kernel.org> (raw)
In-Reply-To: <20221214131617.2447-1-johan+linaro@kernel.org>
The set_trip_temp() callback is used when changing the trip temperature
through sysfs. As it is called with the thermal-zone-device lock held
it must not use thermal_zone_get_trip() directly or it will deadlock.
Fixes: 78c3e2429be8 ("thermal/drivers/qcom: Use generic thermal_zone_get_trip() function")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 2 +-
drivers/thermal/thermal_core.c | 1 +
include/linux/thermal.h | 2 ++
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
index 58055a7abaf6..bfaec74f13b2 100644
--- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
+++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
@@ -270,7 +270,7 @@ static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_id, in
struct thermal_trip trip;
int ret;
- ret = thermal_zone_get_trip(chip->tz_dev, trip_id, &trip);
+ ret = __thermal_zone_get_trip(chip->tz_dev, trip_id, &trip);
if (ret)
return ret;
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index c24c9efcd175..d9a3d9566d73 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1214,6 +1214,7 @@ int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
return tz->ops->get_trip_type(tz, trip_id, &trip->type);
}
+EXPORT_SYMBOL_GPL(__thermal_zone_get_trip);
int thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
struct thermal_trip *trip)
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index e2797f314d99..30353e4b1424 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -334,6 +334,8 @@ static inline void devm_thermal_of_zone_unregister(struct device *dev,
}
#endif
+int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
+ struct thermal_trip *trip);
int thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
struct thermal_trip *trip);
--
2.37.4
WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan+linaro@kernel.org>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Cc: Amit Kucheria <amitk@kernel.org>,
Thara Gopinath <thara.gopinath@gmail.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Zhang Rui <rui.zhang@intel.com>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-tegra@vger.kernel.org,
Johan Hovold <johan+linaro@kernel.org>
Subject: [PATCH 1/4] thermal/drivers/qcom: fix set_trip_temp() deadlock
Date: Wed, 14 Dec 2022 14:16:14 +0100 [thread overview]
Message-ID: <20221214131617.2447-2-johan+linaro@kernel.org> (raw)
In-Reply-To: <20221214131617.2447-1-johan+linaro@kernel.org>
The set_trip_temp() callback is used when changing the trip temperature
through sysfs. As it is called with the thermal-zone-device lock held
it must not use thermal_zone_get_trip() directly or it will deadlock.
Fixes: 78c3e2429be8 ("thermal/drivers/qcom: Use generic thermal_zone_get_trip() function")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 2 +-
drivers/thermal/thermal_core.c | 1 +
include/linux/thermal.h | 2 ++
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
index 58055a7abaf6..bfaec74f13b2 100644
--- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
+++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
@@ -270,7 +270,7 @@ static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_id, in
struct thermal_trip trip;
int ret;
- ret = thermal_zone_get_trip(chip->tz_dev, trip_id, &trip);
+ ret = __thermal_zone_get_trip(chip->tz_dev, trip_id, &trip);
if (ret)
return ret;
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index c24c9efcd175..d9a3d9566d73 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1214,6 +1214,7 @@ int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
return tz->ops->get_trip_type(tz, trip_id, &trip->type);
}
+EXPORT_SYMBOL_GPL(__thermal_zone_get_trip);
int thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
struct thermal_trip *trip)
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index e2797f314d99..30353e4b1424 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -334,6 +334,8 @@ static inline void devm_thermal_of_zone_unregister(struct device *dev,
}
#endif
+int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
+ struct thermal_trip *trip);
int thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
struct thermal_trip *trip);
--
2.37.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-12-14 13:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 13:16 [PATCH 0/4] thermal: fix locking regressions in linux-next Johan Hovold
2022-12-14 13:16 ` Johan Hovold
2022-12-14 13:16 ` Johan Hovold [this message]
2022-12-14 13:16 ` [PATCH 1/4] thermal/drivers/qcom: fix set_trip_temp() deadlock Johan Hovold
2022-12-14 13:16 ` [PATCH 2/4] thermal/drivers/exynos: " Johan Hovold
2022-12-14 13:16 ` Johan Hovold
2022-12-14 14:45 ` Johan Hovold
2022-12-14 14:45 ` Johan Hovold
2022-12-14 13:16 ` [PATCH 3/4] thermal/drivers/tegra: " Johan Hovold
2022-12-14 13:16 ` Johan Hovold
2022-12-14 13:16 ` [PATCH 4/4] thermal/drivers/qcom: fix lock inversion Johan Hovold
2022-12-14 13:16 ` Johan Hovold
2022-12-14 14:02 ` [PATCH 0/4] thermal: fix locking regressions in linux-next Rafael J. Wysocki
2022-12-14 14:02 ` Rafael J. Wysocki
2022-12-14 14:37 ` Daniel Lezcano
2022-12-14 14:37 ` Daniel Lezcano
2022-12-14 14:43 ` Johan Hovold
2022-12-14 14:43 ` Johan Hovold
2022-12-14 14:46 ` Rafael J. Wysocki
2022-12-14 14:46 ` Rafael J. Wysocki
2022-12-14 14:51 ` Daniel Lezcano
2022-12-14 14:51 ` Daniel Lezcano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221214131617.2447-2-johan+linaro@kernel.org \
--to=johan+linaro@kernel.org \
--cc=agross@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=amitk@kernel.org \
--cc=andersson@kernel.org \
--cc=bzolnier@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=jonathanh@nvidia.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=thara.gopinath@gmail.com \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.