From: Will Deacon <will@kernel.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Rob Clark <robdclark@gmail.com>,
dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
linux-arm-msm@vger.kernel.org,
Connor Abbott <cwabbott0@gmail.com>,
Rob Clark <robdclark@chromium.org>,
Joerg Roedel <joro@8bytes.org>, Jason Gunthorpe <jgg@ziepe.ca>,
Nicolin Chen <nicolinc@nvidia.com>,
Kevin Tian <kevin.tian@intel.com>,
Joao Martins <joao.m.martins@oracle.com>,
"moderated list:ARM SMMU DRIVERS"
<linux-arm-kernel@lists.infradead.org>,
"open list:IOMMU SUBSYSTEM" <iommu@lists.linux.dev>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 05/40] iommu/io-pgtable-arm: Add quirk to quiet WARN_ON()
Date: Tue, 20 May 2025 15:06:10 +0100 [thread overview]
Message-ID: <20250520140609.GB18711@willie-the-truck> (raw)
In-Reply-To: <def13dd2-3a23-4091-a732-e4c079df7f41@arm.com>
On Tue, May 20, 2025 at 02:06:09PM +0100, Robin Murphy wrote:
> On 2025-05-20 12:31 pm, Will Deacon wrote:
> > On Thu, May 15, 2025 at 07:48:39AM -0700, Rob Clark wrote:
> > > On Thu, May 15, 2025 at 7:33 AM Will Deacon <will@kernel.org> wrote:
> > > > On Wed, May 14, 2025 at 10:53:19AM -0700, Rob Clark wrote:
> > > > > diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h
> > > > > index bba2a51c87d2..639b8f4fb87d 100644
> > > > > --- a/include/linux/io-pgtable.h
> > > > > +++ b/include/linux/io-pgtable.h
> > > > > @@ -88,6 +88,13 @@ struct io_pgtable_cfg {
> > > > > *
> > > > > * IO_PGTABLE_QUIRK_ARM_HD: Enables dirty tracking in stage 1 pagetable.
> > > > > * IO_PGTABLE_QUIRK_ARM_S2FWB: Use the FWB format for the MemAttrs bits
> > > > > + *
> > > > > + * IO_PGTABLE_QUIRK_NO_WARN_ON: Do not WARN_ON() on conflicting
> > > > > + * mappings, but silently return -EEXISTS. Normally an attempt
> > > > > + * to map over an existing mapping would indicate some sort of
> > > > > + * kernel bug, which would justify the WARN_ON(). But for GPU
> > > > > + * drivers, this could be under control of userspace. Which
> > > > > + * deserves an error return, but not to spam dmesg.
> > > > > */
> > > > > #define IO_PGTABLE_QUIRK_ARM_NS BIT(0)
> > > > > #define IO_PGTABLE_QUIRK_NO_PERMS BIT(1)
> > > > > @@ -97,6 +104,7 @@ struct io_pgtable_cfg {
> > > > > #define IO_PGTABLE_QUIRK_ARM_OUTER_WBWA BIT(6)
> > > > > #define IO_PGTABLE_QUIRK_ARM_HD BIT(7)
> > > > > #define IO_PGTABLE_QUIRK_ARM_S2FWB BIT(8)
> > > > > + #define IO_PGTABLE_QUIRK_NO_WARN_ON BIT(9)
> > > >
> > > > This feels a bit fragile to me:
> > > > * IOMMU-API users of io-pgtable shouldn't be passing this quirk
> > > > but might end up doing so to paper over driver bugs.
> > > >
> > > > * Low-level users of io-pgtable who expose page-table operations to
> > > > userspace need to pass the quirk, but might well not bother because
> > > > well-behaved userspace doesn't trigger the warning.
> > > >
> > > > So overall, it's all a bit unsatisfactory. Is there a way we could have
> > > > the warnings only when invoked via the IOMMU API?
> > >
> > > iommu drivers _not_ setting this flag seems like a good way to achieve that ;-)
> > >
> > > The alternative is to move the warns to the iommu driver... but they
> > > could just as easily remove the WARN_ON()s as they could set the
> > > NO_WARN_ON quirk, so :shrug:?
> >
> > Bah, I also don't have a good idea to improve this, so I guess I'll take
> > what you have for now.
>
> Hmm, just a nit on reflection, how about fixing up the name to just
> IO_PGTABLE_QUIRK_NO_WARN? Given that it's already quite long, and we have a
> well-established DMA_ATTR_NO_WARN with equivalent semantics over in the DMA
> API.
Sure, I'll do that now...
Will
next prev parent reply other threads:[~2025-05-20 14:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-14 17:53 [PATCH v4 00/40] drm/msm: sparse / "VM_BIND" support Rob Clark
2025-05-14 17:53 ` [PATCH v4 05/40] iommu/io-pgtable-arm: Add quirk to quiet WARN_ON() Rob Clark
2025-05-15 14:33 ` Will Deacon
2025-05-15 14:48 ` Rob Clark
2025-05-20 11:31 ` Will Deacon
2025-05-20 13:06 ` Robin Murphy
2025-05-20 14:06 ` Will Deacon [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-05-14 16:58 [PATCH v4 00/40] drm/msm: sparse / "VM_BIND" support Rob Clark
2025-05-14 16:59 ` [PATCH v4 05/40] iommu/io-pgtable-arm: Add quirk to quiet WARN_ON() Rob Clark
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=20250520140609.GB18711@willie-the-truck \
--to=will@kernel.org \
--cc=cwabbott0@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joao.m.martins@oracle.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=robin.murphy@arm.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