From: Dmitry Osipenko <digetx@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 2/2] soc/tegra: pmc: Make readx_poll_timeout atomic
Date: Thu, 30 Aug 2018 21:36:35 +0300 [thread overview]
Message-ID: <20180830183635.4474-2-digetx@gmail.com> (raw)
In-Reply-To: <20180830183635.4474-1-digetx@gmail.com>
This fixes splat like the one below if CONFIG_DEBUG_ATOMIC_SLEEP=y on
Tegra30.
BUG: sleeping function called from invalid context at drivers/soc/tegra/pmc.c:301
in_atomic(): 1, irqs_disabled(): 0, pid: 1, name: swapper/0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.18.0-next-20180821-00176-g7a0f73ae4245 #824
Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[<c01134f4>] (unwind_backtrace) from [<c010db2c>] (show_stack+0x20/0x24)
[<c010db2c>] (show_stack) from [<c0bd0f3c>] (dump_stack+0x94/0xa8)
[<c0bd0f3c>] (dump_stack) from [<c0151df8>] (___might_sleep+0x13c/0x174)
[<c0151df8>] (___might_sleep) from [<c0151ea0>] (__might_sleep+0x70/0xa8)
[<c0151ea0>] (__might_sleep) from [<c0588264>] (tegra_powergate_set+0xb0/0x1e8)
[<c0588264>] (tegra_powergate_set) from [<c05899f4>] (tegra_pmc_cpu_power_on+0x44/0x50)
[<c05899f4>] (tegra_pmc_cpu_power_on) from [<c0122554>] (tegra_boot_secondary+0x20c/0x288)
[<c0122554>] (tegra_boot_secondary) from [<c011051c>] (__cpu_up+0xb8/0x14c)
[<c011051c>] (__cpu_up) from [<c01282a0>] (bringup_cpu+0x30/0xfc)
[<c01282a0>] (bringup_cpu) from [<c01276bc>] (cpuhp_invoke_callback+0xd0/0x98c)
[<c01276bc>] (cpuhp_invoke_callback) from [<c0128b3c>] (_cpu_up+0xe0/0x1c0)
[<c0128b3c>] (_cpu_up) from [<c0128e04>] (do_cpu_up+0x70/0xa4)
[<c0128e04>] (do_cpu_up) from [<c0128e54>] (cpu_up+0x1c/0x20)
[<c0128e54>] (cpu_up) from [<c12112e0>] (smp_init+0xb0/0x100)
[<c12112e0>] (smp_init) from [<c12010d0>] (kernel_init_freeable+0x16c/0x398)
[<c12010d0>] (kernel_init_freeable) from [<c0be76e4>] (kernel_init+0x18/0x124)
[<c0be76e4>] (kernel_init) from [<c01010f0>] (ret_from_fork+0x14/0x24)
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
drivers/soc/tegra/pmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index d6bc9f66f1cd..2d5d4b0c211a 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -297,8 +297,8 @@ static int tegra_powergate_set(unsigned int id, bool new_state)
tegra_pmc_writel(PWRGATE_TOGGLE_START | id, PWRGATE_TOGGLE);
- err = readx_poll_timeout(tegra_powergate_state, id, status,
- status == new_state, 10, 100000);
+ err = readx_poll_timeout_atomic(tegra_powergate_state, id, status,
+ status == new_state, 10, 100000);
spin_unlock(&pmc->powergates_lock);
--
2.18.0
next prev parent reply other threads:[~2018-08-30 18:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 18:36 [PATCH v1 1/2] soc/tegra: pmc: Turn powergates_lock into spinlock Dmitry Osipenko
2018-08-30 18:36 ` Dmitry Osipenko [this message]
2018-10-15 12:35 ` Dmitry Osipenko
2018-10-15 12:52 ` Jon Hunter
2018-10-15 12:52 ` Jon Hunter
2018-10-15 13:52 ` Dmitry Osipenko
2018-10-19 12:17 ` Jon Hunter
2018-10-19 12:17 ` Jon Hunter
2018-10-19 13:35 ` Dmitry Osipenko
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=20180830183635.4474-2-digetx@gmail.com \
--to=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--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.