From: Breno Leitao <leitao@debian.org>
To: Laxman Dewangan <ldewangan@nvidia.com>,
Dmitry Osipenko <digetx@gmail.com>,
Andi Shyti <andi.shyti@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>
Cc: leit@meta.com, Michael van der Westhuizen <rmikey@meta.com>,
linux-i2c@vger.kernel.org (open list:I2C SUBSYSTEM HOST DRIVERS),
linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE
SUPPORT), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH RESEND] Do not mark ACPI devices as irq safe
Date: Thu, 8 Aug 2024 05:14:46 -0700 [thread overview]
Message-ID: <20240808121447.239278-1-leitao@debian.org> (raw)
On ACPI machines, the tegra i2c module encounters an issue due to a
mutex being called inside a spinlock. This leads to the following bug:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585
in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1282, name: kssif0010
preempt_count: 0, expected: 0
RCU nest depth: 0, expected: 0
irq event stamp: 0
Call trace:
dump_backtrace+0xf0/0x140
show_stack (./arch/x86/include/asm/current.h:49
arch/x86/kernel/dumpstack.c:312)
dump_stack_lvl (lib/dump_stack.c:89 lib/dump_stack.c:115)
dump_stack (lib/earlycpio.c:61)
__might_resched (./arch/x86/include/asm/current.h:49
kernel/sched/core.c:10297)
__might_sleep (./include/linux/lockdep.h:231
kernel/sched/core.c:10236)
__mutex_lock_common+0x5c/0x2190
mutex_lock_nested (kernel/locking/mutex.c:751)
acpi_subsys_runtime_resume+0xb8/0x160
__rpm_callback+0x1cc/0x4b0
rpm_resume+0xa60/0x1078
__pm_runtime_resume+0xbc/0x130
tegra_i2c_xfer+0x74/0x398
__i2c_transfer (./include/trace/events/i2c.h:122 drivers/i2c/i2c-core-base.c:2258)
The problem arises because during __pm_runtime_resume(), the spinlock
&dev->power.lock is acquired before rpm_resume() is called. Later,
rpm_resume() invokes acpi_subsys_runtime_resume(), which relies on
mutexes, triggering the error.
To address this issue, devices on ACPI are now marked as not IRQ-safe,
considering the dependency of acpi_subsys_runtime_resume() on mutexes.
Co-developed-by: Michael van der Westhuizen <rmikey@meta.com>
Signed-off-by: Michael van der Westhuizen <rmikey@meta.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
drivers/i2c/busses/i2c-tegra.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 85b31edc558d..6d783ecc3431 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1804,7 +1804,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
* VI I2C device shouldn't be marked as IRQ-safe because VI I2C won't
* be used for atomic transfers.
*/
- if (!IS_VI(i2c_dev))
+ if (!IS_VI(i2c_dev) && !ACPI_HANDLE(i2c_dev->dev))
pm_runtime_irq_safe(i2c_dev->dev);
pm_runtime_enable(i2c_dev->dev);
--
2.43.5
next reply other threads:[~2024-08-08 12:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 12:14 Breno Leitao [this message]
2024-08-08 23:57 ` [PATCH RESEND] Do not mark ACPI devices as irq safe Andi Shyti
2024-08-09 11:03 ` Andy Shevchenko
2024-08-13 13:32 ` Breno Leitao
2024-08-13 15:28 ` Dmitry Osipenko
2024-08-13 15:52 ` Andy Shevchenko
2024-08-15 2:48 ` Dmitry Osipenko
2024-08-19 9:20 ` Andy Shevchenko
2024-08-20 3:57 ` Tony Lindgren
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=20240808121447.239278-1-leitao@debian.org \
--to=leitao@debian.org \
--cc=andi.shyti@kernel.org \
--cc=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=leit@meta.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=rmikey@meta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox