[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250429115354.GA2260709@nvidia.com>
Date: Tue, 29 Apr 2025 08:53:54 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>
Cc: Leon Romanovsky <leon@...nel.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Jens Axboe <axboe@...nel.dk>, Christoph Hellwig <hch@....de>,
Keith Busch <kbusch@...nel.org>, Jake Edge <jake@....net>,
Jonathan Corbet <corbet@....net>, Zhu Yanjun <zyjzyj2000@...il.com>,
Robin Murphy <robin.murphy@....com>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, Sagi Grimberg <sagi@...mberg.me>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Logan Gunthorpe <logang@...tatee.com>,
Yishai Hadas <yishaih@...dia.com>,
Shameer Kolothum <shameerali.kolothum.thodi@...wei.com>,
Kevin Tian <kevin.tian@...el.com>,
Alex Williamson <alex.williamson@...hat.com>,
Jérôme Glisse <jglisse@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-block@...r.kernel.org, linux-rdma@...r.kernel.org,
iommu@...ts.linux.dev, linux-nvme@...ts.infradead.org,
linux-pci@...r.kernel.org, kvm@...r.kernel.org, linux-mm@...ck.org,
Niklas Schnelle <schnelle@...ux.ibm.com>,
Chuck Lever <chuck.lever@...cle.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Matthew Wilcox <willy@...radead.org>,
Dan Williams <dan.j.williams@...el.com>,
Kanchan Joshi <joshi.k@...sung.com>,
Chaitanya Kulkarni <kch@...dia.com>,
Leon Romanovsky <leonro@...dia.com>
Subject: Re: [PATCH v10 03/24] iommu: generalize the batched sync after map
interface
On Tue, Apr 29, 2025 at 10:19:46AM +0800, Baolu Lu wrote:
> > -int iommu_map(struct iommu_domain *domain, unsigned long iova,
> > - phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
> > +int iommu_sync_map(struct iommu_domain *domain, unsigned long iova, size_t size)
> > {
> > const struct iommu_domain_ops *ops = domain->ops;
> > - int ret;
> > -
> > - might_sleep_if(gfpflags_allow_blocking(gfp));
> > - /* Discourage passing strange GFP flags */
> > - if (WARN_ON_ONCE(gfp & (__GFP_COMP | __GFP_DMA | __GFP_DMA32 |
> > - __GFP_HIGHMEM)))
> > - return -EINVAL;
> > + if (!ops->iotlb_sync_map)
> > + return 0;
> > + return ops->iotlb_sync_map(domain, iova, size);
> > +}
>
> I am wondering whether iommu_sync_map() needs a return value. The
> purpose of this callback is just to sync the TLB cache after new
> mappings are created, which should effectively be a no-fail operation.
Yeah, it is pretty much nonsense, the other flushes don't fail:
void (*flush_iotlb_all)(struct iommu_domain *domain);
int (*iotlb_sync_map)(struct iommu_domain *domain, unsigned long iova,
size_t size);
void (*iotlb_sync)(struct iommu_domain *domain,
struct iommu_iotlb_gather *iotlb_gather);
> Furthermore, currently no iommu driver implements this callback in a way
> that returns a failure.
Given s390 does weirdly fail sync_map but not sync this needs a bigger
touch than just that.
But what I really want to do is get rid of iotlb_sync_map and replace it
with iotlb_sync, and feed the gather through the iommu_map path.
It doesn't really make sense to have a special interface for this.
So I think this patch is fine as is..
Jason
Powered by blists - more mailing lists