From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>, rafael@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
rui.zhang@intel.com,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Amit Kucheria <amitk@kernel.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
"open list:SAMSUNG THERMAL DRIVER"
<linux-samsung-soc@vger.kernel.org>,
"moderated list:ARM/SAMSUNG S3C,
S5P AND EXYNOS ARM ARCHITECTURES"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v4 10/30] thermal/drivers/exynos: Replace of_thermal_is_trip_valid() by thermal_zone_get_trip()
Date: Fri, 23 Sep 2022 16:09:02 +0200 [thread overview]
Message-ID: <bc3a5137-b2be-0bfe-003a-db201a7a50e8@samsung.com> (raw)
In-Reply-To: <20220921094244.606948-11-daniel.lezcano@linaro.org>
Hi Daniel,
On 21.09.2022 11:42, Daniel Lezcano wrote:
> The thermal_zone_get_trip() does the same check as
> of_thermal_is_trip_valid(). Replace the call to
> of_thermal_is_trip_valid() by thermal_zone_get_trip().
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
This patch landed in linux next-20220923 as commit 4a71bb8005ba
("thermal/drivers/exynos: Replace of_thermal_is_trip_valid() by
thermal_zone_get_trip()"). Unfortunately it causes deadlock on all
Exynos based board:
============================================
WARNING: possible recursive locking detected
6.0.0-rc1-00062-g4a71bb8005ba #12855 Not tainted
--------------------------------------------
swapper/0/1 is trying to acquire lock:
c263c394 (&tz->lock){+.+.}-{3:3}, at:
thermal_zone_device_update.part.0+0x114/0x538
but task is already holding lock:
c263c394 (&tz->lock){+.+.}-{3:3}, at:
thermal_zone_device_update.part.0+0x3c/0x538
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&tz->lock);
lock(&tz->lock);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by swapper/0/1:
#0: c1d5248c (&dev->mutex){....}-{3:3}, at: __driver_attach+0xe4/0x1f0
#1: c263c394 (&tz->lock){+.+.}-{3:3}, at:
thermal_zone_device_update.part.0+0x3c/0x538
stack backtrace:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.0.0-rc1-00062-g4a71bb8005ba
#12855
Hardware name: Samsung Exynos (Flattened Device Tree)
unwind_backtrace from show_stack+0x10/0x14
show_stack from dump_stack_lvl+0x58/0x70
dump_stack_lvl from __lock_acquire+0x146c/0x2a7c
__lock_acquire from lock_acquire+0x124/0x3e4
lock_acquire from __mutex_lock+0x90/0x948
__mutex_lock from mutex_lock_nested+0x1c/0x24
mutex_lock_nested from thermal_zone_device_update.part.0+0x114/0x538
thermal_zone_device_update.part.0 from
thermal_zone_device_set_mode+0x70/0x98
thermal_zone_device_set_mode from thermal_of_zone_register+0x424/0x69c
thermal_of_zone_register from devm_thermal_of_zone_register+0x58/0x94
devm_thermal_of_zone_register from exynos_tmu_probe+0x29c/0x728
exynos_tmu_probe from platform_probe+0x5c/0xb8
platform_probe from really_probe+0xe0/0x414
really_probe from __driver_probe_device+0xa0/0x208
__driver_probe_device from driver_probe_device+0x30/0xc0
driver_probe_device from __driver_attach+0xf0/0x1f0
__driver_attach from bus_for_each_dev+0x70/0xb0
bus_for_each_dev from bus_add_driver+0x174/0x218
bus_add_driver from driver_register+0x88/0x11c
driver_register from do_one_initcall+0x64/0x380
do_one_initcall from kernel_init_freeable+0x1c0/0x224
kernel_init_freeable from kernel_init+0x18/0x12c
kernel_init from ret_from_fork+0x14/0x2c
Exception stack(0xf082dfb0 to 0xf082dff8)
[deadlock]
Something is wrong in locking in the functions from the above stacktrace.
> drivers/thermal/samsung/exynos_tmu.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 91e6860b5ec4..34b460092308 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -554,13 +554,14 @@ static void exynos4210_tmu_control(struct platform_device *pdev, bool on)
> {
> struct exynos_tmu_data *data = platform_get_drvdata(pdev);
> struct thermal_zone_device *tz = data->tzd;
> + struct thermal_trip trip;
> unsigned int con, interrupt_en = 0, i;
>
> con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
>
> if (on) {
> for (i = 0; i < data->ntrip; i++) {
> - if (!of_thermal_is_trip_valid(tz, i))
> + if (thermal_zone_get_trip(tz, i, &trip))
> continue;
>
> interrupt_en |=
> @@ -584,13 +585,14 @@ static void exynos5433_tmu_control(struct platform_device *pdev, bool on)
> {
> struct exynos_tmu_data *data = platform_get_drvdata(pdev);
> struct thermal_zone_device *tz = data->tzd;
> + struct thermal_trip trip;
> unsigned int con, interrupt_en = 0, pd_det_en, i;
>
> con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
>
> if (on) {
> for (i = 0; i < data->ntrip; i++) {
> - if (!of_thermal_is_trip_valid(tz, i))
> + if (thermal_zone_get_trip(tz, i, &trip))
> continue;
>
> interrupt_en |=
> @@ -615,13 +617,14 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
> {
> struct exynos_tmu_data *data = platform_get_drvdata(pdev);
> struct thermal_zone_device *tz = data->tzd;
> + struct thermal_trip trip;
> unsigned int con, interrupt_en = 0, i;
>
> con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
>
> if (on) {
> for (i = 0; i < data->ntrip; i++) {
> - if (!of_thermal_is_trip_valid(tz, i))
> + if (thermal_zone_get_trip(tz, i, &trip))
> continue;
>
> interrupt_en |=
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2022-09-23 14:09 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 9:42 [PATCH v4 00/30] Rework the trip points creation Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 01/30] thermal/core: Add a generic thermal_zone_get_trip() function Daniel Lezcano
2022-09-23 13:54 ` Zhang Rui
[not found] ` <CGME20220923221936eucas1p1e01148605c9aaf27d8d71969feb99144@eucas1p1.samsung.com>
2022-09-23 22:19 ` Marek Szyprowski
2022-09-24 17:46 ` Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 02/30] thermal/sysfs: Do not make get_trip_hyst optional Daniel Lezcano
2022-09-23 14:19 ` Zhang Rui
2022-09-26 12:55 ` Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 03/30] thermal/core: Add a generic thermal_zone_set_trip() function Daniel Lezcano
2022-09-23 14:21 ` Zhang Rui
2022-09-21 9:42 ` [PATCH v4 04/30] thermal/core: Add a generic thermal_zone_get_crit_temp() function Daniel Lezcano
2022-09-23 14:22 ` Zhang Rui
2022-09-21 9:42 ` [PATCH v4 05/30] thermal/core/governors: Use thermal_zone_get_trip() instead of ops functions Daniel Lezcano
2022-09-23 14:25 ` Zhang Rui
2022-09-23 14:49 ` Lukasz Luba
2022-09-21 9:42 ` [PATCH v4 06/30] thermal/of: Use generic thermal_zone_get_trip() function Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 07/30] thermal/of: Remove unused functions Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 08/30] thermal/drivers/exynos: Use generic thermal_zone_get_trip() function Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 09/30] thermal/drivers/exynos: of_thermal_get_ntrips() Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 10/30] thermal/drivers/exynos: Replace of_thermal_is_trip_valid() by thermal_zone_get_trip() Daniel Lezcano
2022-09-21 15:24 ` Krzysztof Kozlowski
[not found] ` <CGME20220923140903eucas1p180002df0deb308d5148cc6004aef7efe@eucas1p1.samsung.com>
2022-09-23 14:09 ` Marek Szyprowski [this message]
2022-09-23 17:40 ` Daniel Lezcano
2022-09-23 22:02 ` Marek Szyprowski
2022-09-21 9:42 ` [PATCH v4 11/30] thermal/drivers/tegra: Use generic thermal_zone_get_trip() function Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 12/30] thermal/drivers/uniphier: " Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 13/30] thermal/drivers/hisi: " Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 14/30] thermal/drivers/qcom: " Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 15/30] thermal/drivers/armada: " Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 16/30] thermal/drivers/rcar_gen3: Use the generic function to get the number of trips Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 17/30] thermal/of: Remove of_thermal_get_ntrips() Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 18/30] thermal/of: Remove of_thermal_is_trip_valid() Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 19/30] thermal/of: Remove of_thermal_set_trip_hyst() Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 20/30] thermal/of: Remove of_thermal_get_crit_temp() Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 21/30] thermal/drivers/st: Use generic trip points Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 22/30] thermal/drivers/imx: Use generic thermal_zone_get_trip() function Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 23/30] thermal/drivers/rcar: " Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 24/30] thermal/drivers/broadcom: " Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 25/30] thermal/drivers/da9062: " Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 26/30] thermal/drivers/ti: Remove unused macros ti_thermal_get_trip_value() / ti_thermal_trip_is_valid() Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 27/30] thermal/drivers/acerhdf: Use generic thermal_zone_get_trip() function Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 28/30] thermal/drivers/cxgb4: " Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 29/30] thermal/intel/int340x: Replace parameter to simplify Daniel Lezcano
2022-09-21 9:42 ` [PATCH v4 30/30] thermal/drivers/intel: Use generic thermal_zone_get_trip() function 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=bc3a5137-b2be-0bfe-003a-db201a7a50e8@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=alim.akhtar@samsung.com \
--cc=amitk@kernel.org \
--cc=bzolnier@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).