Re: [PATCH v3 1/1] swiotlb: Reduce swiotlb pool lookups

2024-07-10 Thread Petr Tesařík
On Wed, 10 Jul 2024 07:55:20 +0200 Christoph Hellwig wrote: > On Tue, Jul 09, 2024 at 09:08:18PM +0200, Petr Tesařík wrote: > > I'm confused. If you're not a big fan, why are we effectively adding > > them to more places now than before the patch? > > Because I

Re: [PATCH v3 1/1] swiotlb: Reduce swiotlb pool lookups

2024-07-09 Thread Petr Tesařík
On Tue, 9 Jul 2024 13:18:12 +0200 Christoph Hellwig wrote: > On Tue, Jul 09, 2024 at 11:10:13AM +0200, Petr Tesařík wrote: > > Reviewed-by: Petr Tesarik > > Thanks. > > > > > OK, so __swiotlb_find_pool() is now always declared (so the code > > compiles),

Re: [PATCH v3 1/1] swiotlb: Reduce swiotlb pool lookups

2024-07-09 Thread Petr Tesařík
Rework swiotlb_find_pool() to use IS_ENABLED() instead of #ifdef's. > To make this work, move dma_uses_io_tlb field in struct device out from > under #ifdef CONFIG_SWIOTLB_DYNAMIC. [Christoph Hellwig] > * Fix line lengths > 80 chars [Christoph Hellwig] > * Update commit messag

Re: [PATCH v2 1/1] swiotlb: Reduce swiotlb pool lookups

2024-07-07 Thread Petr Tesařík
uot; doesn't work because the dma_uses_io_tlb > field in struct dev is under CONFIG_SWIOTLB_DYNAMIC. I guess > it could be moved out, but that's going further afield. So I'm back > to using #ifdef. > > > smp_rmb(); > > if (!READ_ONCE(dev-&g

Re: [RFC 1/1] swiotlb: Reduce calls to swiotlb_find_pool()

2024-06-30 Thread Petr Tesařík
On Mon, 1 Jul 2024 06:36:15 +0200 "h...@lst.de" wrote: > On Sun, Jun 30, 2024 at 02:02:52PM +, Michael Kelley wrote: > > 1) Rename is_swiotlb_buffer() to swiotlb_find_pool(), since it > > now returns a pool. A NULL return value indicates that the > > paddr is not an swiotlb buffer. > > > >

Re: [RFC 1/1] swiotlb: Reduce calls to swiotlb_find_pool()

2024-06-28 Thread Petr Tesařík
V Fri, 28 Jun 2024 08:01:29 +0200 "h...@lst.de" napsáno: > On Thu, Jun 27, 2024 at 04:02:59PM +, 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 accuratel

Re: [RFC 1/1] swiotlb: Reduce calls to swiotlb_find_pool()

2024-06-27 Thread Petr Tesařík
On Thu, 6 Jun 2024 20:14:21 -0700 mhkelle...@gmail.com wrote: > From: Michael Kelley > > With CONFIG_SWIOTLB_DYNAMIC enabled, each round-trip map/unmap pair > in the swiotlb results in 6 calls to swiotlb_find_pool(). In multiple > places, the pool is found and used in one function, and then mus

Re: [RFC 1/1] swiotlb: Reduce calls to swiotlb_find_pool()

2024-06-26 Thread Petr Tesařík
On Thu, 27 Jun 2024 08:02:51 +0200 "h...@lst.de" wrote: > On Wed, Jun 26, 2024 at 11:58:13PM +, Michael Kelley wrote: > > > This patch trades off making many of the core swiotlb APIs take > > > an additional argument in order to avoid duplicating calls to > > > swiotlb_find_pool(). The curren

Re: [PATCH 2/2] iommu/dma: Fix zero'ing of bounce buffer padding used by untrusted devices

2024-05-06 Thread Petr Tesařík
V Sun, 7 Apr 2024 21:11:42 -0700 mhkelle...@gmail.com napsáno: > From: Michael Kelley > > iommu_dma_map_page() allocates swiotlb memory as a bounce buffer when > an untrusted device wants to map only part of the memory in an > granule. The goal is to disallow the untrusted device having > DMA a

Re: [PATCH 1/2] swiotlb: Remove alloc_size argument to swiotlb_tbl_map_single()

2024-05-06 Thread Petr Tesařík
On Mon, 6 May 2024 15:14:05 + Michael Kelley wrote: > From: mhkelle...@gmail.com > > > > Gentle ping ... > > Anyone interested in reviewing this series of two patches? It fixes > an edge case bug in the size of the swiotlb request coming from > dma-iommu, and plugs a hole that allows u

Re: [PATCH 1/2] swiotlb: Remove alloc_size argument to swiotlb_tbl_map_single()

2024-04-15 Thread Petr Tesařík
On Mon, 15 Apr 2024 13:03:30 + Michael Kelley wrote: > From: Petr Tesařík Sent: Monday, April 15, 2024 5:50 AM > > > > On Mon, 15 Apr 2024 12:23:22 + > > Michael Kelley wrote: > > > > > From: Petr Tesařík Sent: Monday, April 15, 2024 4:46 &

Re: [PATCH 1/2] swiotlb: Remove alloc_size argument to swiotlb_tbl_map_single()

2024-04-15 Thread Petr Tesařík
On Mon, 15 Apr 2024 12:23:22 + Michael Kelley wrote: > From: Petr Tesařík Sent: Monday, April 15, 2024 4:46 AM > > > > Hi Michael, > > > > sorry for taking so long to answer. Yes, there was no agreement on the > > removal of the "dir"

Re: [PATCH 1/2] swiotlb: Remove alloc_size argument to swiotlb_tbl_map_single()

2024-04-15 Thread Petr Tesařík
On Sun, 7 Apr 2024 21:11:41 -0700 mhkelle...@gmail.com wrote: > From: Michael Kelley > > Currently swiotlb_tbl_map_single() takes alloc_align_mask and > alloc_size arguments to specify an swiotlb allocation that is > larger than mapping_size. This larger allocation is used solely > by iommu_dma

Re: [PATCH v7 9/9] swiotlb: search the software IO TLB only if the device makes use of it

2023-09-07 Thread Petr Tesařík
Hi all, sorry for my late reply; I've been away from my work setup for a month... On Wed, 30 Aug 2023 08:55:51 -0600 Jonathan Corbet wrote: > So it seems this code got merged without this question ever being > answered. Sorry if it's a dumb one, but I don't think this > functionality works as

Re: [PATCH v6 0/9] Allow dynamic allocation of software IO TLB bounce buffers

2023-07-31 Thread Petr Tesařík
V Mon, 31 Jul 2023 18:04:09 +0200 Christoph Hellwig napsáno: > I was just going to apply this, but patch 1 seems to have a non-trivial > conflict with the is_swiotlb_active removal in pci-dma.c. Can you resend > against the current dma-mapping for-next tree? Sure thing, will re-send tomorrow mo

Re: [PATCH v4 2/8] swiotlb: add documentation and rename swiotlb_do_find_slots()

2023-07-20 Thread Petr Tesařík
On Thu, 20 Jul 2023 10:01:10 +0200 Christoph Hellwig wrote: > On Thu, Jul 20, 2023 at 09:56:09AM +0200, Petr Tesařík wrote: > > On Thu, 20 Jul 2023 08:38:19 +0200 > > Christoph Hellwig wrote: > > > > > On Thu, Jul 13, 2023 at 05:23:13PM +0200, Petr Tesarik wrote

Re: [PATCH v4 0/8] Allow dynamic allocation of software IO TLB bounce buffers

2023-07-20 Thread Petr Tesařík
On Thu, 20 Jul 2023 08:52:16 +0200 Christoph Hellwig wrote: > Just to add a highlevel comment here after I feel like I need a little > more time to review the guts. > > I'm still pretty concerned about the extra list that needs to be > consulted in is_swiotlb_buffer, but I can't really think of

Re: [PATCH v4 8/8] swiotlb: search the software IO TLB only if a device makes use of it

2023-07-20 Thread Petr Tesařík
On Thu, 20 Jul 2023 08:47:44 +0200 Christoph Hellwig wrote: > Any reason this can't just do a list_empty_careful on the list > instead of adding yet another field that grows struct device? On which list? The dma_io_tlb_pools list only contains transient pools, but a device may use bounce buffer

Re: [PATCH v4 2/8] swiotlb: add documentation and rename swiotlb_do_find_slots()

2023-07-20 Thread Petr Tesařík
On Thu, 20 Jul 2023 08:38:19 +0200 Christoph Hellwig wrote: > On Thu, Jul 13, 2023 at 05:23:13PM +0200, Petr Tesarik wrote: > > From: Petr Tesarik > > > > Add some kernel-doc comments and move the existing documentation of struct > > io_tlb_slot to its correct location. The latter was forgotten

Re: [PATCH v4 1/8] swiotlb: make io_tlb_default_mem local to swiotlb.c

2023-07-20 Thread Petr Tesařík
On Thu, 20 Jul 2023 08:37:44 +0200 Christoph Hellwig wrote: > On Thu, Jul 13, 2023 at 05:23:12PM +0200, Petr Tesarik wrote: > > From: Petr Tesarik > > > > SWIOTLB implementation details should not be exposed to the rest of the > > kernel. This will allow to make changes to the implementation wi

Re: [PATCH v4 1/8] swiotlb: make io_tlb_default_mem local to swiotlb.c

2023-07-17 Thread Petr Tesařík
On Mon, 17 Jul 2023 08:06:07 +0200 Philippe Mathieu-Daudé wrote: > Hi Petr, > > On 13/7/23 17:23, Petr Tesarik wrote: > > From: Petr Tesarik > > > > SWIOTLB implementation details should not be exposed to the rest of the > > kernel. This will allow to make changes to the implementation without

Re: [PATCH v4 3/8] swiotlb: separate memory pool data from other allocator data

2023-07-13 Thread Petr Tesařík
On Thu, 13 Jul 2023 17:23:14 +0200 Petr Tesarik wrote: > From: Petr Tesarik > > Carve out memory pool specific fields from struct io_tlb_mem. The original > struct now contains shared data for the whole allocator, while the new > struct io_tlb_pool contains data that is specific to one memory p

Re: [PATCH v3 4/7] swiotlb: if swiotlb is full, fall back to a transient memory pool

2023-07-10 Thread Petr Tesařík
On Sat, 8 Jul 2023 15:18:32 + "Michael Kelley (LINUX)" wrote: > From: Petr Tesařík Sent: Friday, July 7, 2023 3:22 AM > > > > On Fri, 7 Jul 2023 10:29:00 +0100 > > Greg Kroah-Hartman wrote: > > > > > On Thu, Jul 06, 2023 at 02:22:50PM +

Re: [PATCH v3 4/7] swiotlb: if swiotlb is full, fall back to a transient memory pool

2023-07-07 Thread Petr Tesařík
On Fri, 7 Jul 2023 10:29:00 +0100 Greg Kroah-Hartman wrote: > On Thu, Jul 06, 2023 at 02:22:50PM +, Michael Kelley (LINUX) wrote: > > From: Greg Kroah-Hartman Sent: Thursday, July > > 6, 2023 1:07 AM > > > > > > On Thu, Jul 06, 2023 at 03:50:55AM +, Michael Kelley (LINUX) wrote: >

Re: [PATCH v3 1/7] swiotlb: make io_tlb_default_mem local to swiotlb.c

2023-06-27 Thread Petr Tesařík
On Tue, 27 Jun 2023 17:48:02 +0200 Christoph Hellwig wrote: > On Tue, Jun 27, 2023 at 01:30:06PM +0200, Petr Tesařík wrote: > > Xen is the only user of an "is SWIOTLB present" interface. IIUC Xen > > needs bounce buffers for the PCI frontend driver, but if there is no &

Re: unexport swiotlb_active v2

2023-06-27 Thread Petr Tesařík
On Mon, 19 Jun 2023 11:19:41 +0200 Christoph Hellwig wrote: > Any comments? I'd really like to finish this off this merge window.. Let me second this request. My dynamic SWIOTLB patch series also has a dependence on this. Petr T

Re: [PATCH v3 1/7] swiotlb: make io_tlb_default_mem local to swiotlb.c

2023-06-27 Thread Petr Tesařík
Oops, originally sent only to Robin. Restoring the recipient list here... On Tue, 27 Jun 2023 11:55:00 +0100 Robin Murphy wrote: > On 27/06/2023 11:24 am, Greg Kroah-Hartman wrote: > > On Tue, Jun 27, 2023 at 11:54:23AM +0200, Petr Tesarik wrote: > >> +/** > >> + * is_swiotlb_active() - ch

Re: [PATCH v3 1/7] swiotlb: make io_tlb_default_mem local to swiotlb.c

2023-06-27 Thread Petr Tesařík
On Tue, 27 Jun 2023 11:55:00 +0100 Robin Murphy wrote: > On 27/06/2023 11:24 am, Greg Kroah-Hartman wrote: > > On Tue, Jun 27, 2023 at 11:54:23AM +0200, Petr Tesarik wrote: > >> +/** > >> + * is_swiotlb_active() - check if the software IO TLB is initialized > >> + * @dev: Device to check, or %

Re: [PATCH 2/4] x86: always initialize xen-swiotlb when xen-pcifront is enabling

2023-05-22 Thread Petr Tesařík
On Fri, 19 May 2023 12:10:26 +0200 Marek Marczykowski-Górecki wrote: > On Fri, May 19, 2023 at 06:04:05AM +0200, Christoph Hellwig wrote: > > On Thu, May 18, 2023 at 08:18:39PM +0200, Marek Marczykowski-Górecki wrote: > > > > > On Thu, May 18, 2023 at 03:42:51PM +0200, Christoph Hellwig wrote:

Re: [PATCH 2/4] x86: always initialize xen-swiotlb when xen-pcifront is enabling

2023-05-22 Thread Petr Tesařík
Hi Christoph, On Sat, 20 May 2023 08:21:03 +0200 Christoph Hellwig wrote: > On Fri, May 19, 2023 at 02:58:57PM +0200, Christoph Hellwig wrote: > > On Fri, May 19, 2023 at 01:49:46PM +0100, Andrew Cooper wrote: > > > > The alternative would be to finally merge swiotlb-xen into swiotlb, in > > >