Re: [PATCH] MAINTAINERS: refurbish SWIOTLB SUBSYSTEM sections after refactoring

2022-06-01 Thread Juergen Gross via iommu
On 01.06.22 09:56, Lukas Bulwahn wrote: Commit 78013eaadf69 ("x86: remove the IOMMU table infrastructure") refactored the generic swiotlb/swiotlb-xen setup into pci-dma.c, but misses to adjust MAINTAINERS. Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about broken

Re: [PATCH 01/12] iommu/vt-d: Use iommu_get_domain_for_dev() in debugfs

2022-06-01 Thread Baolu Lu
On 2022/6/1 02:51, Jason Gunthorpe wrote: Oh, I've spent the last couple of weeks hacking up horrible things manipulating entries in init_mm, and never realised that that was actually the special case. Oh well, live and learn. The init_mm is sort of different, it doesn't have zap in quite the

RE: [PATCH 05/12] iommu/vt-d: Unncessary spinlock for root table alloc and free

2022-06-01 Thread Tian, Kevin
> From: Lu Baolu > Sent: Friday, May 27, 2022 2:30 PM > > The IOMMU root table is allocated and freed in the IOMMU initialization > code in static boot or hot-plug paths. There's no need for a spinlock. s/hot-plug/hot-remove/ > > Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian > --- >

RE: [PATCH 04/12] iommu/vt-d: Use pci_get_domain_bus_and_slot() in pgtable_walk()

2022-06-01 Thread Tian, Kevin
> From: Lu Baolu > Sent: Friday, May 27, 2022 2:30 PM > > Use pci_get_domain_bus_and_slot() instead of searching the global list > to retrieve the pci device pointer. This removes device_domain_list > global list as there are no consumers anymore. > > Signed-off-by: Lu Baolu Reviewed-by:

[PATCH] MAINTAINERS: refurbish SWIOTLB SUBSYSTEM sections after refactoring

2022-06-01 Thread Lukas Bulwahn
Commit 78013eaadf69 ("x86: remove the IOMMU table infrastructure") refactored the generic swiotlb/swiotlb-xen setup into pci-dma.c, but misses to adjust MAINTAINERS. Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about broken references. Update the SWIOTLB SUBSYSTEM to include

RE: [PATCH 02/12] iommu/vt-d: Remove for_each_device_domain()

2022-06-01 Thread Tian, Kevin
> From: Lu Baolu > Sent: Friday, May 27, 2022 2:30 PM > > The per-device device_domain_info data could be retrieved from the > device itself. There's no need to search a global list. > > Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian > --- > drivers/iommu/intel/iommu.h | 2 -- >

RE: [PATCH 01/12] iommu/vt-d: Use iommu_get_domain_for_dev() in debugfs

2022-06-01 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Wednesday, June 1, 2022 7:11 AM > > On Tue, May 31, 2022 at 10:22:32PM +0100, Robin Murphy wrote: > > > There are only 3 instances where we'll free a table while the domain is > > live. The first is the one legitimate race condition, where two map requests > >

RE: [PATCH 06/12] iommu/vt-d: Acquiring lock in domain ID allocation helpers

2022-06-01 Thread Tian, Kevin
> From: Lu Baolu > Sent: Friday, May 27, 2022 2:30 PM > > The iommu->lock is used to protect the per-IOMMU domain ID resource. > Move the spinlock acquisition/release into the helpers where domain > IDs are allocated and freed. The device_domain_lock is irrelevant to > domain ID resources,

[PATCH v2 4/9] driver core: Add wait_for_init_devices_probe helper function

2022-06-01 Thread Saravana Kannan via iommu
Some devices might need to be probed and bound successfully before the kernel boot sequence can finish and move on to init/userspace. For example, a network interface might need to be bound to be able to mount a NFS rootfs. With fw_devlink=on by default, some of these devices might be blocked

[PATCH v2 5/9] net: ipconfig: Relax fw_devlink if we need to mount a network rootfs

2022-06-01 Thread Saravana Kannan via iommu
If there are network devices that could probe without some of their suppliers probing and those network devices are needed to mount a network rootfs, then fw_devlink=on might break that usecase by blocking the network devices from probing by the time IP auto config starts. So, if no network

[PATCH v2 6/9] Revert "driver core: Set default deferred_probe_timeout back to 0."

2022-06-01 Thread Saravana Kannan via iommu
This reverts commit 11f7e7ef553b6b93ac1aa74a3c2011b9cc8aeb61. Let's take another shot at getting deferred_probe_timeout=10 to work. Signed-off-by: Saravana Kannan --- drivers/base/dd.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index

[PATCH v2 1/9] PM: domains: Delete usage of driver_deferred_probe_check_state()

2022-06-01 Thread Saravana Kannan via iommu
Now that fw_devlink=on by default and fw_devlink supports "power-domains" property, the execution will never get to the point where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired. So, delete the call and

[PATCH v2 2/9] pinctrl: devicetree: Delete usage of driver_deferred_probe_check_state()

2022-06-01 Thread Saravana Kannan via iommu
Now that fw_devlink=on by default and fw_devlink supports "pinctrl-[0-8]" property, the execution will never get to the point where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired. So, delete the call and

[PATCH v2 0/9] deferred_probe_timeout logic clean up

2022-06-01 Thread Saravana Kannan via iommu
This series is based on linux-next + these 2 small patches applies on top: https://lore.kernel.org/lkml/20220526034609.480766-1-sarava...@google.com/ A lot of the deferred_probe_timeout logic is redundant with fw_devlink=on. Also, enabling deferred_probe_timeout by default breaks a few cases.

[PATCH v2 9/9] driver core: Delete driver_deferred_probe_check_state()

2022-06-01 Thread Saravana Kannan via iommu
The function is no longer used. So delete it. Signed-off-by: Saravana Kannan --- drivers/base/dd.c | 30 -- include/linux/device/driver.h | 1 - 2 files changed, 31 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index

[PATCH v2 7/9] driver core: Set fw_devlink.strict=1 by default

2022-06-01 Thread Saravana Kannan via iommu
Now that deferred_probe_timeout is non-zero by default, fw_devlink will never permanently block the probing of devices. It'll try its best to probe the devices in the right order and then finally let devices probe even if their suppliers don't have any drivers. Signed-off-by: Saravana Kannan ---

[PATCH v2 8/9] iommu/of: Delete usage of driver_deferred_probe_check_state()

2022-06-01 Thread Saravana Kannan via iommu
Now that fw_devlink=on and fw_devlink.strict=1 by default and fw_devlink supports iommu DT properties, the execution will never get to the point where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired. So, delete

[PATCH v2 3/9] net: mdio: Delete usage of driver_deferred_probe_check_state()

2022-06-01 Thread Saravana Kannan via iommu
Now that fw_devlink=on by default and fw_devlink supports interrupt properties, the execution will never get to the point where driver_deferred_probe_check_state() is called before the supplier has probed successfully or before deferred probe timeout has expired. So, delete the call and replace

Re: [PATCH 06/12] iommu/vt-d: Acquiring lock in domain ID allocation helpers

2022-06-01 Thread Baolu Lu
Hi Kevin, Thank you for the comments. On 2022/6/1 17:09, Tian, Kevin wrote: From: Lu Baolu Sent: Friday, May 27, 2022 2:30 PM The iommu->lock is used to protect the per-IOMMU domain ID resource. Move the spinlock acquisition/release into the helpers where domain IDs are allocated and freed.

Re: [PATCH 10/10] dmapool: improve scalability of dma_pool_free

2022-06-01 Thread Robin Murphy
On 2022-05-31 23:10, Tony Battersby wrote: On 5/31/22 17:54, Keith Busch wrote: On Tue, May 31, 2022 at 02:23:44PM -0400, Tony Battersby wrote: dma_pool_free() scales poorly when the pool contains many pages because pool_find_page() does a linear scan of all allocated pages. Improve its

Re: [PATCH 01/12] iommu/vt-d: Use iommu_get_domain_for_dev() in debugfs

2022-06-01 Thread Jason Gunthorpe via iommu
On Wed, Jun 01, 2022 at 01:18:52PM +0100, Joao Martins wrote: > > So having safe racy reading in the kernel is probably best, and so RCU > > would be good here too. > > Reading dirties ought to be similar to map/unmap but slightly simpler as > I supposedly don't need to care about the pte

Re: [PATCH V3 5/8] dt-bindings: Add xen,grant-dma IOMMU description for xen-grant DMA ops

2022-06-01 Thread Oleksandr
On 01.06.22 03:34, Stefano Stabellini wrote: Hello Stefano On Tue, 31 May 2022, Oleksandr Tyshchenko wrote: From: Oleksandr Tyshchenko The main purpose of this binding is to communicate Xen specific information using generic IOMMU device tree bindings (which is a good fit here) rather

Re: [PATCH v4 1/6] iommu: Add a per domain PASID for DMA API

2022-06-01 Thread Baolu Lu
On 2022/6/1 09:43, Tian, Kevin wrote: From: Jacob Pan Sent: Wednesday, June 1, 2022 1:30 AM In both cases the pasid is stored in the attach data instead of the domain. So during IOTLB flush for the domain, do we loop through the attach data? Yes and it's required. What does the attach data

RE: [PATCH 07/12] iommu/vt-d: Acquiring lock in pasid manipulation helpers

2022-06-01 Thread Tian, Kevin
> From: Lu Baolu > Sent: Friday, May 27, 2022 2:30 PM > > The iommu->lock is used to protect the per-IOMMU pasid directory table > and pasid table. Move the spinlock acquisition/release into the helpers > to make the code self-contained. > > Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian ,

Re: [PATCH 01/12] iommu/vt-d: Use iommu_get_domain_for_dev() in debugfs

2022-06-01 Thread Joao Martins
On 6/1/22 13:33, Jason Gunthorpe wrote: > On Wed, Jun 01, 2022 at 01:18:52PM +0100, Joao Martins wrote: > >>> So having safe racy reading in the kernel is probably best, and so RCU >>> would be good here too. >> >> Reading dirties ought to be similar to map/unmap but slightly simpler as >> I

Re: [PATCH 09/12] iommu/vt-d: Check device list of domain in domain free path

2022-06-01 Thread Baolu Lu
On 2022/6/1 17:28, Tian, Kevin wrote: From: Lu Baolu Sent: Friday, May 27, 2022 2:30 PM When the IOMMU domain is about to be freed, it should not be set on any device. Instead of silently dealing with some bug cases, it's better to trigger a warning to report and fix any potential bugs at the

Re: [PATCH 01/12] iommu/vt-d: Use iommu_get_domain_for_dev() in debugfs

2022-06-01 Thread Joao Martins
On 6/1/22 00:10, Jason Gunthorpe wrote: > On Tue, May 31, 2022 at 10:22:32PM +0100, Robin Murphy wrote: >> There are only 3 instances where we'll free a table while the domain is >> live. The first is the one legitimate race condition, where two map requests >> targeting relatively nearby PTEs

RE: [PATCH v4 1/6] iommu: Add a per domain PASID for DMA API

2022-06-01 Thread Tian, Kevin
> From: Baolu Lu > Sent: Wednesday, June 1, 2022 5:37 PM > > On 2022/6/1 09:43, Tian, Kevin wrote: > >> From: Jacob Pan > >> Sent: Wednesday, June 1, 2022 1:30 AM > In both cases the pasid is stored in the attach data instead of the > domain. > > >> So during IOTLB flush for the

Re: [PATCH 07/12] iommu/vt-d: Acquiring lock in pasid manipulation helpers

2022-06-01 Thread Baolu Lu
On 2022/6/1 17:18, Tian, Kevin wrote: From: Lu Baolu Sent: Friday, May 27, 2022 2:30 PM The iommu->lock is used to protect the per-IOMMU pasid directory table and pasid table. Move the spinlock acquisition/release into the helpers to make the code self-contained. Signed-off-by: Lu Baolu

Re: [PATCH 01/12] iommu/vt-d: Use iommu_get_domain_for_dev() in debugfs

2022-06-01 Thread Jason Gunthorpe via iommu
On Wed, Jun 01, 2022 at 02:52:05PM +0100, Joao Martins wrote: > On 6/1/22 13:33, Jason Gunthorpe wrote: > > On Wed, Jun 01, 2022 at 01:18:52PM +0100, Joao Martins wrote: > > > >>> So having safe racy reading in the kernel is probably best, and so RCU > >>> would be good here too. > >> > >>

RE: [PATCH 09/12] iommu/vt-d: Check device list of domain in domain free path

2022-06-01 Thread Tian, Kevin
> From: Lu Baolu > Sent: Friday, May 27, 2022 2:30 PM > > When the IOMMU domain is about to be freed, it should not be set on any > device. Instead of silently dealing with some bug cases, it's better to > trigger a warning to report and fix any potential bugs at the first time. > > static

Re: [PATCH] MAINTAINERS: refurbish SWIOTLB SUBSYSTEM sections after refactoring

2022-06-01 Thread Christoph Hellwig
On Wed, Jun 01, 2022 at 09:56:13AM +0200, Lukas Bulwahn wrote: > +F: arch/x86/kernel/pci-dma.c I think this file is better left for the x86 maintainers. ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH 09/15] swiotlb: make the swiotlb_init interface more useful

2022-06-01 Thread Christoph Hellwig
On Wed, Jun 01, 2022 at 11:11:57AM -0700, Nathan Chancellor wrote: > On Wed, Jun 01, 2022 at 07:57:43PM +0200, Christoph Hellwig wrote: > > On Wed, Jun 01, 2022 at 10:46:54AM -0700, Nathan Chancellor wrote: > > > On Wed, Jun 01, 2022 at 07:34:41PM +0200, Christoph Hellwig wrote: > > > > Can you

[PATCH v2] dma-debug: Make things less spammy under memory pressure

2022-06-01 Thread Rob Clark
From: Rob Clark Limit the error msg to avoid flooding the console. If you have a lot of threads hitting this at once, they could have already gotten passed the dma_debug_disabled() check before they get to the point of allocation failure, resulting in quite a lot of this error message spamming

Re: [PATCH 09/15] swiotlb: make the swiotlb_init interface more useful

2022-06-01 Thread Christoph Hellwig
On Wed, Jun 01, 2022 at 10:46:54AM -0700, Nathan Chancellor wrote: > On Wed, Jun 01, 2022 at 07:34:41PM +0200, Christoph Hellwig wrote: > > Can you send me the full dmesg and the content of > > /sys/kernel/debug/swiotlb/io_tlb_nslabs for a good and a bad boot? > > Sure thing, they are attached!

Re: [PATCH 09/15] swiotlb: make the swiotlb_init interface more useful

2022-06-01 Thread Nathan Chancellor
On Wed, Jun 01, 2022 at 07:57:43PM +0200, Christoph Hellwig wrote: > On Wed, Jun 01, 2022 at 10:46:54AM -0700, Nathan Chancellor wrote: > > On Wed, Jun 01, 2022 at 07:34:41PM +0200, Christoph Hellwig wrote: > > > Can you send me the full dmesg and the content of > > >

Re: [PATCH 09/15] swiotlb: make the swiotlb_init interface more useful

2022-06-01 Thread Nathan Chancellor
On Wed, Jun 01, 2022 at 07:34:41PM +0200, Christoph Hellwig wrote: > Can you send me the full dmesg and the content of > /sys/kernel/debug/swiotlb/io_tlb_nslabs for a good and a bad boot? Sure thing, they are attached! If there is anything else I can provide or test, I am more than happy to do

Re: [PATCH 09/15] swiotlb: make the swiotlb_init interface more useful

2022-06-01 Thread Christoph Hellwig
Can you send me the full dmesg and the content of /sys/kernel/debug/swiotlb/io_tlb_nslabs for a good and a bad boot? Thanks! ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH 09/15] swiotlb: make the swiotlb_init interface more useful

2022-06-01 Thread Nathan Chancellor
On Wed, Jun 01, 2022 at 08:21:41PM +0200, Christoph Hellwig wrote: > On Wed, Jun 01, 2022 at 11:11:57AM -0700, Nathan Chancellor wrote: > > On Wed, Jun 01, 2022 at 07:57:43PM +0200, Christoph Hellwig wrote: > > > On Wed, Jun 01, 2022 at 10:46:54AM -0700, Nathan Chancellor wrote: > > > > On Wed,

Re: [PATCH 09/15] swiotlb: make the swiotlb_init interface more useful

2022-06-01 Thread Nathan Chancellor
Hi Christoph, On Mon, Apr 04, 2022 at 07:05:53AM +0200, Christoph Hellwig wrote: > Pass a bool to pass if swiotlb needs to be enabled based on the > addressing needs and replace the verbose argument with a set of > flags, including one to force enable bounce buffering. > > Note that this patch

Re: [PATCH v2 1/7] dt-bindings: iommu: mediatek: Add phandles for mediatek infra/pericfg

2022-06-01 Thread Rob Herring
On Wed, May 18, 2022 at 01:42:20PM +0200, AngeloGioacchino Del Regno wrote: > Il 18/05/22 13:29, Matthias Brugger ha scritto: > > > > > > On 18/05/2022 12:04, AngeloGioacchino Del Regno wrote: > > > Add properties "mediatek,infracfg" and "mediatek,pericfg" to let the > > > mtk_iommu driver

Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-06-01 Thread Jason Gunthorpe
On Fri, May 27, 2022 at 04:41:08PM -0600, Logan Gunthorpe wrote: > > > > IIRC this is the last part: > > > > https://lore.kernel.org/linux-mm/20220524190632.3304-1-alex.sie...@amd.com/ > > > > And the earlier bit with Christoph's pieces looks like it might get > > merged to v5.19.. > > > > The

[PATCH] swiotlb: fix setting ->force_bounce

2022-06-01 Thread Christoph Hellwig
The swiotlb_init refactor messed up assigning ->force_bounce by doing it in different places based on what caused the setting of the flag. Fix this by passing the SWIOTLB_* flags to swiotlb_init_io_tlb_mem and just setting it there. Fixes: c6af2aa9ffc9 ("swiotlb: make the swiotlb_init interface