[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240628094708.3a454619@meshulam.tesarici.cz>
Date: Fri, 28 Jun 2024 09:47:08 +0200
From: Petr Tesařík <petr@...arici.cz>
To: "hch@....de" <hch@....de>
Cc: Michael Kelley <mhklinux@...look.com>, "robin.murphy@....com"
<robin.murphy@....com>, "joro@...tes.org" <joro@...tes.org>,
"will@...nel.org" <will@...nel.org>, "jgross@...e.com" <jgross@...e.com>,
"sstabellini@...nel.org" <sstabellini@...nel.org>,
"oleksandr_tyshchenko@...m.com" <oleksandr_tyshchenko@...m.com>,
"m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>
Subject: Re: [RFC 1/1] swiotlb: Reduce calls to swiotlb_find_pool()
V Fri, 28 Jun 2024 08:01:29 +0200
"hch@....de" <hch@....de> napsáno:
> On Thu, Jun 27, 2024 at 04:02:59PM +0000, Michael Kelley wrote:
> > > > Conceptually, it's still being used as a boolean function based on
> > > > whether the return value is NULL. Renaming it to swiotlb_get_pool()
> > > > more accurately describes the return value, but obscures the
> > > > intent of determining if it is a swiotlb buffer. I'll think about it.
> > > > Suggestions are welcome.
> > >
> > > Just keep is_swiotlb_buffer as a trivial inline helper that returns
> > > bool.
> >
> > I don't understand what you are suggesting. Could you elaborate a bit?
> > is_swiotlb_buffer() can't be trivial when CONFIG_SWIOTLB_DYNAMIC
> > is set.
>
> Call the main function that finds and retuns the pool swiotlb_find_pool,
> and then have a is_swiotlb_buffer wrapper that just returns bool.
>
I see. That's not my point. After applying Michael's patch, the return
value is always used, except here:
bool dma_direct_need_sync(struct device *dev, dma_addr_t dma_addr)
{
return !dev_is_dma_coherent(dev) ||
is_swiotlb_buffer(dev, dma_to_phys(dev, dma_addr));
}
I don't think this one occurrence in the entire source tree is worth a
separate inline function.
If nobody has a better idea, I'm not really offended by keeping the
original name, is_swiotlb_buffer(). It would just become the only
function which starts with "is_" and provides more information in the
return value than a simple yes/no, and I thought there must be an
unwritten convention about that.
Petr T
Powered by blists - more mailing lists