From: Jason Gunthorpe <jgg@ziepe.ca>
To: Pranjal Shrivastava <praan@google.com>
Cc: Daniel Mentz <danielmentz@google.com>,
iommu@lists.linux.dev, Will Deacon <will@kernel.org>,
Joerg Roedel <joro@8bytes.org>,
Robin Murphy <robin.murphy@arm.com>,
Mostafa Saleh <smostafa@google.com>,
Nicolin Chen <nicolinc@nvidia.com>,
Ashish Mhetre <amhetre@nvidia.com>
Subject: Re: [PATCH v6 07/10] iommu/arm-smmu-v3: Implement pm_runtime & system sleep ops
Date: Fri, 24 Apr 2026 12:13:25 -0300 [thread overview]
Message-ID: <20260424151325.GD3611611@ziepe.ca> (raw)
In-Reply-To: <aejP5Yk72_FtZnIo@google.com>
On Wed, Apr 22, 2026 at 01:40:53PM +0000, Pranjal Shrivastava wrote:
> > > +/*
> > > + * This should always return true if devlinks are setup correctly
> > > + * and the client using the SMMU is active.
> > > + */
> > > +__maybe_unused bool arm_smmu_rpm_get_if_active(struct arm_smmu_device *smmu)
> > > +{
> > > + if (!arm_smmu_is_active(smmu))
> > > + return false;
> >
> > I'm wondering if this check is redundant. What would happen if we removed it?
> >
>
> You're right that pm_runtime_get_if_active() shall suffice. However, I
> added the arm_smmu_is_active() check as a lockless fast path for unmaps
>
> Consider a scneario where there're high-frequency unmaps (unmap-storm)
> while the SMMU is suspended. Without this check, every thread would
> contend for the dev->power.lock spinlock inside the RPM core
> (pm_runtime_get_if_active) just to discover the device is not active.
>
> This check allows CPUs to elide the command immediately without
> contending for the dev->power.lock spinlock inside the RPM core
> (get_if_active call) and avoids unnecessary cacheline bouncing when the
> SMMU is suspended.
But these sorts of pre checks are almost always racy, I think you need a
comment or lockdep statement explaining how the locking works.
Jason
next prev parent reply other threads:[~2026-04-24 15:13 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 19:46 [PATCH v6 00/10] iommu/arm-smmu-v3: Implement Runtime/System Sleep ops Pranjal Shrivastava
2026-04-14 19:46 ` [PATCH v6 01/10] iommu/arm-smmu-v3: Refactor arm_smmu_setup_irqs Pranjal Shrivastava
2026-04-14 19:46 ` [PATCH v6 02/10] iommu/arm-smmu-v3: Add a helper to drain cmd queues Pranjal Shrivastava
2026-04-14 19:46 ` [PATCH v6 03/10] iommu/tegra241-cmdqv: Add a helper to drain VCMDQs Pranjal Shrivastava
2026-04-14 19:46 ` [PATCH v6 04/10] iommu/tegra241-cmdqv: Restore PROD and CONS after resume Pranjal Shrivastava
2026-04-14 19:46 ` [PATCH v6 05/10] iommu/arm-smmu-v3: Cache and restore MSI config Pranjal Shrivastava
2026-04-14 19:46 ` [PATCH v6 06/10] iommu/arm-smmu-v3: Add CMDQ_PROD_STOP_FLAG to gate CMDQ submissions Pranjal Shrivastava
2026-04-22 4:31 ` Daniel Mentz
2026-04-22 12:18 ` Pranjal Shrivastava
2026-04-14 19:46 ` [PATCH v6 07/10] iommu/arm-smmu-v3: Implement pm_runtime & system sleep ops Pranjal Shrivastava
2026-04-21 4:47 ` Daniel Mentz
2026-04-22 12:20 ` Pranjal Shrivastava
2026-04-21 15:46 ` Daniel Mentz
2026-04-22 12:23 ` Pranjal Shrivastava
2026-04-22 4:25 ` Daniel Mentz
2026-04-22 13:40 ` Pranjal Shrivastava
2026-04-24 5:24 ` Daniel Mentz
2026-04-24 15:16 ` Jason Gunthorpe
2026-05-04 9:01 ` Pranjal Shrivastava
2026-04-24 15:13 ` Jason Gunthorpe [this message]
2026-05-04 11:15 ` Pranjal Shrivastava
2026-05-19 20:50 ` Daniel Mentz
2026-04-14 19:47 ` [PATCH v6 08/10] iommu/arm-smmu-v3: Handle gerror during suspend Pranjal Shrivastava
2026-04-14 19:47 ` [PATCH v6 09/10] iommu/arm-smmu-v3: Enable pm_runtime and setup devlinks Pranjal Shrivastava
2026-04-14 19:47 ` [PATCH v6 10/10] iommu/arm-smmu-v3: Invoke pm_runtime before hw access Pranjal Shrivastava
2026-05-19 18:31 ` Daniel Mentz
2026-05-25 19:53 ` Pranjal Shrivastava
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=20260424151325.GD3611611@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=amhetre@nvidia.com \
--cc=danielmentz@google.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=nicolinc@nvidia.com \
--cc=praan@google.com \
--cc=robin.murphy@arm.com \
--cc=smostafa@google.com \
--cc=will@kernel.org \
/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