Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp376844lqt; Thu, 6 Jun 2024 06:27:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVE1sxHOfGrcZ1bj4Nyp9/aAhToOBOZi5l/7Tlti1wR0OUs1kyfEfGG0eiFvaA28TP+o10JwBm8EvjPe34EECAplHACp9pn4ZQI93tFfw== X-Google-Smtp-Source: AGHT+IEmjUIKat3pNSY8ZzAKbj4NjQrWxtHSDG6NTDXNfUs8vrUZrZaNWn7gevI3oSx8hPesWv/q X-Received: by 2002:a05:6e02:152d:b0:373:7f70:bb8f with SMTP id e9e14a558f8ab-374b1f3ed0bmr63386655ab.22.1717680462272; Thu, 06 Jun 2024 06:27:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717680462; cv=pass; d=google.com; s=arc-20160816; b=GrD1gwcAvVAtXUcE5+AIW4bXc1oHHPcUJmk0eRd0jeMr8W6dkY3O883GRZ5agx6aAS lYbfEa57ixDZ5X74j4rRfuPqkefPdrf+vwUQX8WKddFGfI72ddSscpYLEiuUOYARgY3g KENq+zpdTO/M1ZME/kSus07N+YH8WQx5fFmz1ayKgQW1Zc1FpOBLazg4kNFpIQ+rHohU pGsc08zUtr8M/1jVVcjAehz2WnOzIFzwudp3FSAGpLG4d5sdn4/bD35purk0Ot60QxyU h3NbGhSIUbfH7JVKpqMomkqoqHNuiK3JuJHoJRkDLHCHwrnCf+yjKD4M5tW7JdzAtlIv eKwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=iuF5KD5rCo57TyG5EigT3fDurZ74w1tefad8AjM+COM=; fh=PPnJPDD97fZvcKz82JMOgZuqCsbpCXQYX4FG4iJLFhg=; b=E83dBrti4NMF94QJRJMoB92waf+8axayhKzB1+wWDSwCF/F/xQjwLguQMikSLWyR6g fgbXEe3N5DJys6PUyawpK7WYjLDqDLQfalDdzxSQf0fmotMsAIcRqiyRscRsCAXE+uIw 1aYNm7cp68kidnLPSPdEtfbXq/h9UzEPNNAScM4uccaN6neZ+fROmkelEP4OLteJPRGv puZdCqP2D1Lagw3DXTKo6LwnfCruDWrj+dXyaVUoI3ewFba+BqID3K3fhV3RXr7JQSW4 Ezs7wl9bPBxwTFOjs7WGDS4VPht0t/EylP1ifIUnJWTTZvHHtxnB8rMJzQiRNU13/Yhc sXXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-204360-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204360-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6dfb350892csi532752a12.192.2024.06.06.06.27.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:27:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204360-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-204360-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204360-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C945128581C for ; Thu, 6 Jun 2024 13:27:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9BE2195FE0; Thu, 6 Jun 2024 13:27:33 +0000 (UTC) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B56DC193080; Thu, 6 Jun 2024 13:27:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717680453; cv=none; b=mymNBhuHR8v7g19P537tIJVI+h+36S+ZHb37ITya7C0KsnVloNCIVJ8zUkj+YO/JY0i3koi/+s6pGcu2I8G5vG59hzD19LI3vhHZDyw1TMD4cgrvQnsTqM4Y49hzSS4uc1JXZBdUSpZcyZz7RQHffOBuWchUx7E7nERFm4s8UT4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717680453; c=relaxed/simple; bh=l00UI0JD6AC6Q+cJo4FKqgL09aX1TgDCu9xOfXS9uoM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ouWzw/29qlqrNXIVI0izSUYT0ofkphUiBC7ANjZBWqBzddoSo7lfRAi/mW7I88NJgfn2leEQE5py8YYa4jgFfkbtdgKAcTuliSV5O39W6rpaWgkOXt6VVxEUWU2/2PjCmNkFoSXgbu3zllJIXO/zW0zEcyCqujZi/gbO7KPBbZY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-57864327f6eso355401a12.1; Thu, 06 Jun 2024 06:27:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717680449; x=1718285249; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iuF5KD5rCo57TyG5EigT3fDurZ74w1tefad8AjM+COM=; b=j8ikiYHAggBd94p9/sl8QgN9K/8bcidP+7iCCwstYypOJv6K2V5LLu7R8cPCHmbrd6 cJ8y0fp/qaqTX9MmKaJEvPqddtF9Km9CqHht98TQYQZ4n9gN5N/619SNf5ScA2ssv1FV +SkSQuZwbp1fYkv9JQi+ALfhD0fsfZ0g10aXrJk7ktgvS7cGXzvp0/2MufC5HBwhjz8l nTTLtLJLWMmrgC3RT5Akjm+5D+jKXJZVOFf8ojuEJgaLvj8R6AG8a4Em0aNqLqjUXfRL oi65iiSLaV6BYqCuxIH4iJWoEfFyZezM7Z/daWgDJvMYFWN39VqxiGIbpoj8wUBgn5te hIcQ== X-Forwarded-Encrypted: i=1; AJvYcCW3ws6I0ZEuxJKPUCUkt8NSTqxdLUcu+5Le4IR/z+3/dWjPfgmOQwUjtUqs5QKO85jNHIh8GSXV+VIlGnA2nQPfoSHw9M6+hUK+frCHMopbyDkXBZS98neqXAO35UvLU7ERR7ef3rRFzlnkqfw7VJYkt/4dfTTXpnUc2r0HZmJxZooNbGo= X-Gm-Message-State: AOJu0YxioFA+1P+SM47ZKabRc1EQ9XyRxmrPciTnv6JjDS/6suG5ZPn8 0ehsixZKixgAYsPCOU4gOHuA+FRYQRU4LmUFhEPR1DdZYhpHXm5s X-Received: by 2002:a50:ab02:0:b0:574:ebf4:f786 with SMTP id 4fb4d7f45d1cf-57aa558746amr2338378a12.16.1717680448842; Thu, 06 Jun 2024 06:27:28 -0700 (PDT) Received: from localhost (fwdproxy-lla-120.fbsv.net. [2a03:2880:30ff:78::face:b00c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aae0caa84sm1103288a12.29.2024.06.06.06.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:27:28 -0700 (PDT) From: Breno Leitao To: Laxman Dewangan , Dmitry Osipenko , Andi Shyti , Thierry Reding , Jonathan Hunter Cc: paulmck@kernel.org, apopple@nvidia.com, Michael van der Westhuizen , 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] [i2c-tegra] Do not mark ACPI devices as irq safe Date: Thu, 6 Jun 2024 06:27:07 -0700 Message-ID: <20240606132708.1610308-1-leitao@debian.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Michael van der Westhuizen Signed-off-by: Breno Leitao --- 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.0