[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [RFC 1/1] swiotlb: Reduce calls to swiotlb_find_pool()
- To: Petr Tesařík <petr@xxxxxxxxxxx>, "hch@xxxxxx" <hch@xxxxxx>
- From: Michael Kelley <mhklinux@xxxxxxxxxxx>
- Date: Sat, 29 Jun 2024 15:55:58 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+ih/lzqmLSKQKwRjuRJf3js26Se1yyTSpbLLJfNn+ZM=; b=FtYUf8K/xAN8vLAHWJFv/OxskzkxthtlqzysUNMXH0Gf727NLS4xzJrFXPOtBpflV5iHwSBSp3CU3QBkQK5Re8pBExPn8SctyntYfhR0JTpmQckBJ13bdIT0JhW321GCH3DSQo2L2olNqRKWl51YfkwupFakYekW/v7qI2q8YgXCQvD93DGaUGuMbY2J6y/yeLhHn4s6pKFrznYa6DfsnUgFQToAmLw0AW8G/1SPIvg22KkVSamEHK+5ZJE6QpQ5vOY6mYLOKqZpm3O5CgkGarn+t/w1GAAvZa3WbEt2b18yQhGnLvZRMg2a6jykyn6Fpfu8uQOA1MJEULaEVl5Qgw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IQgjIYPNoZIrshjQtAzD+aUWSprqs50we9lJ6bObQAoU9kx+HTQcdPp77r0lYnScLFjKm2OnlS9EXTH8NlLLKlr6NOt6jIuJfTAXQp1xEOl1BEBHQrwoWzMH16wG/2A6bYHr+lK7ef+m97PKMHk7zZ5mqocwGqlAQG+3V8A/mfF9UdAhlzOknipp5rtVJYyZ9hy2zDEFpELJk8RWsba+N0d/tYQdaBGb3KC+NYsLb/n4F95DrVYiZ2J5tiyYqpiRnUwlAKKSEYHIhX6oA3tL6vQZATX2gu1cOULq36wm+J008DWGhDBaH+QyPpBQkYcZZJfrA2rd+0IIjBaq8bKRvA==
- Cc: "robin.murphy@xxxxxxx" <robin.murphy@xxxxxxx>, "joro@xxxxxxxxxx" <joro@xxxxxxxxxx>, "will@xxxxxxxxxx" <will@xxxxxxxxxx>, "jgross@xxxxxxxx" <jgross@xxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "oleksandr_tyshchenko@xxxxxxxx" <oleksandr_tyshchenko@xxxxxxxx>, "m.szyprowski@xxxxxxxxxxx" <m.szyprowski@xxxxxxxxxxx>, "iommu@xxxxxxxxxxxxxxx" <iommu@xxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Sat, 29 Jun 2024 15:56:18 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHauIjoJBWSrCyO6UWzcncSceBiMLHa1Z9wgABomICAAA3OAIAAhiSggAAJLYCAAAn5IIAA6tuAgAAdhQCAAhqHMA==
- Thread-topic: [RFC 1/1] swiotlb: Reduce calls to swiotlb_find_pool()
From: Petr Tesařík <petr@xxxxxxxxxxx> Sent: Friday, June 28, 2024 12:47 AM
>
> V Fri, 28 Jun 2024 08:01:29 +0200
> "hch@xxxxxx" <hch@xxxxxx> 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.
>
Unless there is further discussion on this point, I'll just keep the original
"is_swiotlb_buffer()" in v2.
Michael
|