From: Jason Gunthorpe <jgg@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Albert Ou <aou@eecs.berkeley.edu>,
asahi@lists.linux.dev,
Baolin Wang <baolin.wang@linux.alibaba.com>,
iommu@lists.linux.dev, Janne Grunau <j@jannau.net>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Joerg Roedel <joro@8bytes.org>,
Jean-Philippe Brucker <jpb@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev,
Matthias Brugger <matthias.bgg@gmail.com>,
Neal Gompa <neal@gompa.dev>, Orson Zhai <orsonzhai@gmail.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <pjw@kernel.org>,
Samuel Holland <samuel@sholland.org>,
Sven Peter <sven@kernel.org>,
virtualization@lists.linux.dev, Chen-Yu Tsai <wens@kernel.org>,
Will Deacon <will@kernel.org>, Yong Wu <yong.wu@mediatek.com>,
Chunyan Zhang <zhang.lyra@gmail.com>,
Lu Baolu <baolu.lu@linux.intel.com>,
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
Joerg Roedel <joerg.roedel@amd.com>,
Jon Hunter <jonathanh@nvidia.com>,
patches@lists.linux.dev, Pranjal Shrivastava <praan@google.com>,
Samiullah Khawaja <skhawaja@google.com>,
stable@vger.kernel.org, Vasant Hegde <vasant.hegde@amd.com>
Subject: Re: [PATCH v2] iommu: Always fill in gather when unmapping
Date: Thu, 2 Apr 2026 13:51:23 -0300 [thread overview]
Message-ID: <20260402165123.GG310919@nvidia.com> (raw)
In-Reply-To: <70a128f9-d6f0-41b6-8fef-e249c0507149@arm.com>
On Thu, Apr 02, 2026 at 04:59:29PM +0100, Robin Murphy wrote:
> > @@ -666,9 +666,22 @@ static size_t __arm_lpae_unmap(struct arm_lpae_io_pgtable *data,
> > /* Clear the remaining entries */
> > __arm_lpae_clear_pte(ptep, &iop->cfg, i);
> > - if (gather && !iommu_iotlb_gather_queued(gather))
> > - for (int j = 0; j < i; j++)
> > - io_pgtable_tlb_add_page(iop, gather, iova + j * size, size);
> > + if (gather && !iommu_iotlb_gather_queued(gather)) {
> > + if (iop->cfg.tlb && iop->cfg.tlb->tlb_add_range) {
> > + iop->cfg.tlb->tlb_add_range(gather, iova,
> > + i * size, size,
> > + iop->cookie);
> > +
> > + } else {
> > + iommu_iotlb_gather_add_range(gather, iova,
> > + i * size);
> > +
> > + for (int j = 0; j < i; j++)
> > + io_pgtable_tlb_add_page(iop, gather,
> > + iova + j * size,
> > + size);
> > + }
> > + }
>
> NAK, this is insane.
This quite an optimization for SMMUv3 so it doesn't have to fit into
the ill fitting add_page api. What is "insane" here?
> If you'd rather make gathers mandatory for all drivers than fix it in the
> core code, then for goodness' sake just add the trivial one-liner to the
> handful of .unamp_pages implementations which need it,
Do I understand this right, you want to not touch io-pgtable and
instead the unmap trampolines will fix the gather like mkt is doing?
Jason
WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Albert Ou <aou@eecs.berkeley.edu>,
asahi@lists.linux.dev,
Baolin Wang <baolin.wang@linux.alibaba.com>,
iommu@lists.linux.dev, Janne Grunau <j@jannau.net>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Joerg Roedel <joro@8bytes.org>,
Jean-Philippe Brucker <jpb@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev,
Matthias Brugger <matthias.bgg@gmail.com>,
Neal Gompa <neal@gompa.dev>, Orson Zhai <orsonzhai@gmail.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <pjw@kernel.org>,
Samuel Holland <samuel@sholland.org>,
Sven Peter <sven@kernel.org>,
virtualization@lists.linux.dev, Chen-Yu Tsai <wens@kernel.org>,
Will Deacon <will@kernel.org>, Yong Wu <yong.wu@mediatek.com>,
Chunyan Zhang <zhang.lyra@gmail.com>,
Lu Baolu <baolu.lu@linux.intel.com>,
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
Joerg Roedel <joerg.roedel@amd.com>,
Jon Hunter <jonathanh@nvidia.com>,
patches@lists.linux.dev, Pranjal Shrivastava <praan@google.com>,
Samiullah Khawaja <skhawaja@google.com>,
stable@vger.kernel.org, Vasant Hegde <vasant.hegde@amd.com>
Subject: Re: [PATCH v2] iommu: Always fill in gather when unmapping
Date: Thu, 2 Apr 2026 13:51:23 -0300 [thread overview]
Message-ID: <20260402165123.GG310919@nvidia.com> (raw)
In-Reply-To: <70a128f9-d6f0-41b6-8fef-e249c0507149@arm.com>
On Thu, Apr 02, 2026 at 04:59:29PM +0100, Robin Murphy wrote:
> > @@ -666,9 +666,22 @@ static size_t __arm_lpae_unmap(struct arm_lpae_io_pgtable *data,
> > /* Clear the remaining entries */
> > __arm_lpae_clear_pte(ptep, &iop->cfg, i);
> > - if (gather && !iommu_iotlb_gather_queued(gather))
> > - for (int j = 0; j < i; j++)
> > - io_pgtable_tlb_add_page(iop, gather, iova + j * size, size);
> > + if (gather && !iommu_iotlb_gather_queued(gather)) {
> > + if (iop->cfg.tlb && iop->cfg.tlb->tlb_add_range) {
> > + iop->cfg.tlb->tlb_add_range(gather, iova,
> > + i * size, size,
> > + iop->cookie);
> > +
> > + } else {
> > + iommu_iotlb_gather_add_range(gather, iova,
> > + i * size);
> > +
> > + for (int j = 0; j < i; j++)
> > + io_pgtable_tlb_add_page(iop, gather,
> > + iova + j * size,
> > + size);
> > + }
> > + }
>
> NAK, this is insane.
This quite an optimization for SMMUv3 so it doesn't have to fit into
the ill fitting add_page api. What is "insane" here?
> If you'd rather make gathers mandatory for all drivers than fix it in the
> core code, then for goodness' sake just add the trivial one-liner to the
> handful of .unamp_pages implementations which need it,
Do I understand this right, you want to not touch io-pgtable and
instead the unmap trampolines will fix the gather like mkt is doing?
Jason
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-04-02 16:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 14:25 [PATCH v2] iommu: Always fill in gather when unmapping Jason Gunthorpe
2026-04-02 14:25 ` Jason Gunthorpe
2026-04-02 15:49 ` Greg KH
2026-04-02 15:49 ` Greg KH
2026-04-02 15:59 ` Robin Murphy
2026-04-02 15:59 ` Robin Murphy
2026-04-02 16:51 ` Jason Gunthorpe [this message]
2026-04-02 16:51 ` Jason Gunthorpe
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=20260402165123.GG310919@nvidia.com \
--to=jgg@nvidia.com \
--cc=alex@ghiti.fr \
--cc=angelogioacchino.delregno@collabora.com \
--cc=aou@eecs.berkeley.edu \
--cc=asahi@lists.linux.dev \
--cc=baolin.wang@linux.alibaba.com \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=j@jannau.net \
--cc=janusz.krzysztofik@linux.intel.com \
--cc=jernej.skrabec@gmail.com \
--cc=joerg.roedel@amd.com \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=jpb@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=matthias.bgg@gmail.com \
--cc=neal@gompa.dev \
--cc=orsonzhai@gmail.com \
--cc=palmer@dabbelt.com \
--cc=patches@lists.linux.dev \
--cc=pjw@kernel.org \
--cc=praan@google.com \
--cc=robin.murphy@arm.com \
--cc=samuel@sholland.org \
--cc=skhawaja@google.com \
--cc=stable@vger.kernel.org \
--cc=sven@kernel.org \
--cc=vasant.hegde@amd.com \
--cc=virtualization@lists.linux.dev \
--cc=wens@kernel.org \
--cc=will@kernel.org \
--cc=yong.wu@mediatek.com \
--cc=zhang.lyra@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.