Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nicolin Chen" <nicolinc@nvidia.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 09/18] iommu/arm-smmu-v3: Introduce per-cmdq cmdq_err_handler callback
Date: Fri, 03 Jul 2026 04:32:28 +0000	[thread overview]
Message-ID: <20260703043228.7F9011F000E9@smtp.kernel.org> (raw)
In-Reply-To: <df41122bd28b74dbe2de09d6cbe6c636e647c93b.1783044582.git.nicolinc@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] `arm_smmu_device_disable()` sleeps while called from hardirq context in `arm_smmu_gerror_handler()`.
--

commit d1df4f7525ea4b8d14160727c6a78de7c62b7cbb
Author: Nicolin Chen <nicolinc@nvidia.com>

iommu/arm-smmu-v3: Introduce per-cmdq cmdq_err_handler callback

This patch adds a cmdq_err_handler and a paired cmdq_err_lock to struct
arm_smmu_cmdq. It updates arm_smmu_gerror_handler() to take the per-cmdq
cmdq_err_lock when acking CMDQ_ERR.

> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 8a4edefeec770..c6e3d1be23403 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
[ ... ]
> @@ -2317,6 +2322,8 @@ static irqreturn_t arm_smmu_gerror_handler(int irq, void *dev)
>  	if (active & GERROR_SFM_ERR) {
>  		/* SMMU is being disabled, so other errors don't matter */
>  		writel(gerror, smmu->base + ARM_SMMU_GERRORN);
> +		/* Release before arm_smmu_device_disable() that sleeps */
> +		raw_spin_unlock_irqrestore(&smmu->cmdq.cmdq_err_lock, flags);
>  		dev_err(smmu->dev, "device has entered Service Failure Mode!\n");
>  		arm_smmu_device_disable(smmu);

[Severity: High]
This is a pre-existing issue, but since the added comment explicitly mentions
that arm_smmu_device_disable() sleeps, can this cause a scheduling while
atomic bug?

Looking at the call chain, arm_smmu_gerror_handler() is registered as a
hardirq handler, and arm_smmu_device_disable() eventually calls:

arm_smmu_device_disable()
  arm_smmu_write_reg_sync()
    readl_relaxed_poll_timeout(..., 1, ARM_SMMU_POLL_TIMEOUT_US)

Because the polling timeout is called with a non-zero delay of 1 microsecond,
it expands to might_sleep_if() and usleep_range(), forcing the kernel to sleep.

While releasing the spinlock avoids a deadlock, does sleeping directly inside
the hardirq context still risk a panic when handling a Service Failure Mode
error?

>  		return IRQ_HANDLED;
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783044582.git.nicolinc@nvidia.com?part=9

  reply	other threads:[~2026-07-03  4:32 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03  4:06 [PATCH v5 00/18] iommu/arm-smmu-v3: Quarantine device upon ATC invalidation timeout Nicolin Chen
2026-07-03  4:06 ` [PATCH v5 01/18] PCI: Don't suspend IOMMU when probing reset capability Nicolin Chen
2026-07-03  4:27   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 02/18] PCI/CXL: Probe the underlying bus reset in cxl_reset_bus_function() Nicolin Chen
2026-07-03  4:29   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 03/18] PCI: Propagate FLR return values to callers Nicolin Chen
2026-07-03  4:25   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 04/18] iommu: Convert gdev->blocked from bool to enum gdev_blocked Nicolin Chen
2026-07-03  4:24   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 05/18] iommu: Pass in reset result to pci_dev_reset_iommu_done() Nicolin Chen
2026-07-03  4:27   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 06/18] iommu/arm-smmu-v3: Don't rb_erase() a never-inserted stream node Nicolin Chen
2026-07-03  4:25   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 07/18] iommu/arm-smmu-v3: Mark ATC invalidate timeouts via lockless bitmap Nicolin Chen
2026-07-03  4:26   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 08/18] iommu/arm-smmu-v3: Skip remaining GERROR causes on SFM Nicolin Chen
2026-07-03  4:29   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 09/18] iommu/arm-smmu-v3: Introduce per-cmdq cmdq_err_handler callback Nicolin Chen
2026-07-03  4:32   ` sashiko-bot [this message]
2026-07-03  4:06 ` [PATCH v5 10/18] iommu/arm-smmu-v3: Recheck CMDQ_ERR in tegra241_vintf0_handle_error() Nicolin Chen
2026-07-03  4:40   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 11/18] iommu/arm-smmu-v3: Co-clear pending CMDQ_ERR when CMD_SYNC times out Nicolin Chen
2026-07-03  4:39   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 12/18] iommu/arm-smmu-v3: Introduce arm_smmu_cmdq_batch_issue() wrapper Nicolin Chen
2026-07-03  4:22   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 13/18] iommu/arm-smmu-v3: Add streams_lock for atomic-context SID->master lookup Nicolin Chen
2026-07-03  4:26   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 14/18] iommu/arm-smmu-v3: Add has_ats to struct arm_smmu_cmdq_batch Nicolin Chen
2026-07-03  4:29   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 15/18] iommu/arm-smmu-v3: Add INV_TYPE_ATS_BROKEN to skip quarantined ATS masters Nicolin Chen
2026-07-03  4:34   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 16/18] iommu/arm-smmu-v3: Factor out CMDQ batch force-sync conditions Nicolin Chen
2026-07-03  4:29   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 17/18] iommu/arm-smmu-v3: Thread arm_smmu_master_domain on a per-master list Nicolin Chen
2026-07-03  4:32   ` sashiko-bot
2026-07-03  4:06 ` [PATCH v5 18/18] iommu/arm-smmu-v3: Block ATS for a master upon an ATC invalidation timeout Nicolin Chen
2026-07-03  4:36   ` sashiko-bot

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=20260703043228.7F9011F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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