Re: [PATCH] iommu/amd: Fix event counter availability check

2020-06-01 Thread Suravee Suthikulpanit
Hi Alexander, On 5/30/20 3:07 AM, Alexander Monakov wrote: The driver performs an extra check if the IOMMU's capabilities advertise presence of performance counters: it verifies that counters are writable by writing a hard-coded value to a counter and testing that reading that counter gives

Re: [PATCH] iommu/amd: Fix event counter availability check

2020-06-01 Thread Alexander Monakov
On Mon, 1 Jun 2020, Suravee Suthikulpanit wrote: > > Moving init_iommu_perf_ctr just after iommu_flush_all_caches resolves > > the issue. This is the earliest point in amd_iommu_init_pci where the > > call succeeds on my laptop. > > According to your description, it should just need to be

Re: [PATCH] iommu: Improve exception handling in iommu_group_alloc()

2020-06-01 Thread Baolin Wang
On Mon, Jun 01, 2020 at 02:38:05PM +0200, Markus Elfring wrote: > > Optimize the error handling to free the resources correctly when > > failed to allocate an iommu group. > > * I would not categorise the desired completion of exception handling > as a software optimisation. > > * Would you

[PATCH v2] iommu: Improve exception handling in iommu_group_alloc()

2020-06-01 Thread Baolin Wang
Improve the exception handling to free the resources correctly when failed to allocate an iommu group. Fixes: bc7d12b91bd3 ("iommu: Implement reserved_regions iommu-group sysfs file") Signed-off-by: Baolin Wang --- Changes from v1: - Improve the commmit message. - Add Fixes tag. ---

[PATCH] driver core: platform: expose numa_node to users in sysfs

2020-06-01 Thread Barry Song
For some platform devices like iommu, particually ARM smmu, users may care about the numa locality. for example, if threads and drivers run near iommu, they may get much better performance on dma_unmap_sg. For other platform devices, users may still want to know the hardware topology. Cc: Prime

Re: [PATCH] driver core: platform: expose numa_node to users in sysfs

2020-06-01 Thread Greg KH
On Tue, Jun 02, 2020 at 03:01:39PM +1200, Barry Song wrote: > For some platform devices like iommu, particually ARM smmu, users may > care about the numa locality. for example, if threads and drivers run > near iommu, they may get much better performance on dma_unmap_sg. > For other platform

Re: [PATCH] driver core: platform: expose numa_node to users in sysfs

2020-06-01 Thread Greg KH
On Tue, Jun 02, 2020 at 03:01:39PM +1200, Barry Song wrote: > For some platform devices like iommu, particually ARM smmu, users may > care about the numa locality. for example, if threads and drivers run > near iommu, they may get much better performance on dma_unmap_sg. > For other platform

RE: [PATCH] iommu/arm-smmu-v3: expose numa_node attribute to users in sysfs

2020-06-01 Thread Song Bao Hua (Barry Song)
> -Original Message- > From: Robin Murphy [mailto:robin.mur...@arm.com] > Sent: Tuesday, June 2, 2020 1:14 AM > To: Song Bao Hua (Barry Song) ; w...@kernel.org; > h...@lst.de; m.szyprow...@samsung.com; iommu@lists.linux-foundation.org > Cc: Linuxarm ;

Re: [PATCH 0/2] Introduce PCI_FIXUP_IOMMU

2020-06-01 Thread Bjorn Helgaas
On Thu, May 28, 2020 at 09:33:44AM +0200, Joerg Roedel wrote: > On Wed, May 27, 2020 at 01:18:42PM -0500, Bjorn Helgaas wrote: > > Is this slowdown significant? We already iterate over every device > > when applying PCI_FIXUP_FINAL quirks, so if we used the existing > > PCI_FIXUP_FINAL, we

Re: [PATCH] iommu/amd: Fix event counter availability check

2020-06-01 Thread Alexander Monakov
> Instead of blindly moving the code around to a spot that would just work, > I am trying to understand what might be required here. In this case, > the init_device_table_dma()should not be needed. I suspect it's the IOMMU > invalidate all command that's also needed here. > > I'm also checking

Re: [PATCH] iommu/amd: Fix event counter availability check

2020-06-01 Thread Suravee Suthikulpanit
Alexander On 6/1/20 4:01 PM, Alexander Monakov wrote: On Mon, 1 Jun 2020, Suravee Suthikulpanit wrote: Moving init_iommu_perf_ctr just after iommu_flush_all_caches resolves the issue. This is the earliest point in amd_iommu_init_pci where the call succeeds on my laptop. According to your

[PATCH] iommu/arm-smmu-v3: allocate the memory of queues in local numa node

2020-06-01 Thread Barry Song
dmam_alloc_coherent() will usually allocate memory from the default CMA. For a common arm64 defconfig without reserved memory in device tree, there is only one CMA close to address 0. dma_alloc_contiguous() will allocate memory without any idea of NUMA and smmu has no customized per-numa

Re: [PATCH] iommu: Improve exception handling in iommu_group_alloc()

2020-06-01 Thread Markus Elfring
> Optimize the error handling to free the resources correctly when > failed to allocate an iommu group. * I would not categorise the desired completion of exception handling as a software optimisation. * Would you like to add the tag “Fixes” to the commit message? * I suggest to avoid the

[PATCH] iommu/arm-smmu-v3: allocate the memory of queues in local numa node

2020-06-01 Thread Song Bao Hua (Barry Song)
BEGIN:VCALENDAR METHOD:REQUEST PRODID:Microsoft Exchange Server 2010 VERSION:2.0 BEGIN:VTIMEZONE TZID:New Zealand Standard Time BEGIN:STANDARD DTSTART:16010101T03 TZOFFSETFROM:+1300 TZOFFSETTO:+1200 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=4 END:STANDARD BEGIN:DAYLIGHT

[PATCH RFC 2/2] iommu/arm-smmu-v3: Remove cmpxchg() in arm_smmu_cmdq_issue_cmdlist()

2020-06-01 Thread John Garry
It has been shown that the cmpxchg() for finding space in the cmdq can be a bottleneck: - For more CPUs contenting the cmdq, cmpxchg() will fail more often. - Since the software-maintained cons pointer is updated on the same 64b memory region, the chance of cmpxchg() failure increases again.

[PATCH RFC 0/2] iommu/arm-smmu-v3: Improve cmdq lock efficiency

2020-06-01 Thread John Garry
As mentioned in [0], the CPU may consume many cycles processing arm_smmu_cmdq_issue_cmdlist(). One issue we find is the cmpxchg() loop to get space on the queue takes approx 25% of the cycles for this function. The cmpxchg() is removed as follows: - We assume that the cmdq can never fill with

[PATCH RFC 1/2] iommu/arm-smmu-v3: Calculate bits for prod and owner

2020-06-01 Thread John Garry
Since the arm_smmu_ll_queue.prod will be for counting the "owner" value and also HW prod pointer, calculate how many bits are available for and used by each. This is based on the number of possible CPUs in the system. And we require that each CPU can issue a minimum of 2 commands per batch - 1 x

RE: [PATCH v7 21/24] iommu/arm-smmu-v3: Add stall support for platform devices

2020-06-01 Thread Shameerali Kolothum Thodi
Hi Jean, > -Original Message- > From: iommu [mailto:iommu-boun...@lists.linux-foundation.org] On Behalf Of > Jean-Philippe Brucker > Sent: 19 May 2020 18:55 > To: iommu@lists.linux-foundation.org; devicet...@vger.kernel.org; > linux-arm-ker...@lists.infradead.org;

Re: [PATCH] iommu/arm-smmu-v3: expose numa_node attribute to users in sysfs

2020-06-01 Thread Robin Murphy
On 2020-05-30 10:15, Barry Song wrote: As tests show the latency of dma_unmap can increase dramatically while calling them cross NUMA nodes, especially cross CPU packages, eg. 300ns vs 800ns while waiting for the completion of CMD_SYNC in an empty command queue. The large latency causing by

Re: [PATCH v2 00/33] iommu: Move iommu_group setup to IOMMU core code

2020-06-01 Thread Jerry Snitselaar
On Fri May 29 20, Jerry Snitselaar wrote: On Tue Apr 14 20, Joerg Roedel wrote: Hi, here is the second version of this patch-set. The first version with some more introductory text can be found here: https://lore.kernel.org/lkml/20200407183742.4344-1-j...@8bytes.org/ Changes v1->v2:

[Try 2] DMAR errors on Wildcat Point-LP xHCI (Lenovo T450s)

2020-06-01 Thread Vincent Pelletier
Well, try 1 was a word salad, thanks gmail I guess. Now I will try to redeem myself... Hello, Trying to use a built-in USB device I rarely use (Sierra EM7345 LTE modem), I ran into issues from the modem flapping (getting removed from USB bus before LTE network registration is visible) up to all

Re: [PATCH v2 00/33] iommu: Move iommu_group setup to IOMMU core code

2020-06-01 Thread Jerry Snitselaar
On Mon Jun 01 20, Jerry Snitselaar wrote: On Fri May 29 20, Jerry Snitselaar wrote: On Tue Apr 14 20, Joerg Roedel wrote: Hi, here is the second version of this patch-set. The first version with some more introductory text can be found here:

[PATCH] iommu: Optimize the error handling when allocating an iommu group

2020-06-01 Thread Baolin Wang
Optimize the error handling to free the resources correctly when failed to allocate an iommu group. Signed-off-by: Baolin Wang --- drivers/iommu/iommu.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index

Re: [PATCH] PCI: Relax ACS requirement for Intel RCiEP devices.

2020-06-01 Thread Bjorn Helgaas
On Thu, May 28, 2020 at 01:57:42PM -0700, Ashok Raj wrote: > All Intel platforms guarantee that all root complex implementations > must send transactions up to IOMMU for address translations. Hence for > RCiEP devices that are Vendor ID Intel, can claim exception for lack of > ACS support. > > >

Re: [PATCH] PCI: Relax ACS requirement for Intel RCiEP devices.

2020-06-01 Thread Raj, Ashok
On Mon, Jun 01, 2020 at 04:25:19PM -0500, Bjorn Helgaas wrote: > On Thu, May 28, 2020 at 01:57:42PM -0700, Ashok Raj wrote: > > All Intel platforms guarantee that all root complex implementations > > must send transactions up to IOMMU for address translations. Hence for > > RCiEP devices that are

Re: [PATCH] PCI: Relax ACS requirement for Intel RCiEP devices.

2020-06-01 Thread Alex Williamson
On Mon, 1 Jun 2020 14:40:23 -0700 "Raj, Ashok" wrote: > On Mon, Jun 01, 2020 at 04:25:19PM -0500, Bjorn Helgaas wrote: > > On Thu, May 28, 2020 at 01:57:42PM -0700, Ashok Raj wrote: > > > All Intel platforms guarantee that all root complex implementations > > > must send transactions up to

Re: [PATCH] PCI: Relax ACS requirement for Intel RCiEP devices.

2020-06-01 Thread Bjorn Helgaas
On Mon, Jun 01, 2020 at 03:56:55PM -0600, Alex Williamson wrote: > On Mon, 1 Jun 2020 14:40:23 -0700 > "Raj, Ashok" wrote: > > > On Mon, Jun 01, 2020 at 04:25:19PM -0500, Bjorn Helgaas wrote: > > > On Thu, May 28, 2020 at 01:57:42PM -0700, Ashok Raj wrote: > > > > All Intel platforms guarantee

Re: [PATCH v2 00/33] iommu: Move iommu_group setup to IOMMU core code

2020-06-01 Thread Lu Baolu
Hi Jerry, On 6/1/20 9:17 PM, Jerry Snitselaar wrote: On Mon Jun 01 20, Jerry Snitselaar wrote: On Fri May 29 20, Jerry Snitselaar wrote: On Tue Apr 14 20, Joerg Roedel wrote: Hi, here is the second version of this patch-set. The first version with some more introductory text can be found

Re: [PATCH v2 00/33] iommu: Move iommu_group setup to IOMMU core code

2020-06-01 Thread Lu Baolu
Hi Jerry, On 6/1/20 6:42 PM, Jerry Snitselaar wrote: Hi Joerg, With this patchset, I have an epyc system where if I boot with iommu=nopt and force a dump I will see some io page faults for a nic on the system. The vmcore is harvested and the system reboots. I haven't reproduced it on other

Re: [PATCH v2 00/33] iommu: Move iommu_group setup to IOMMU core code

2020-06-01 Thread Jerry Snitselaar
On Tue Jun 02 20, Lu Baolu wrote: Hi Jerry, On 6/1/20 6:42 PM, Jerry Snitselaar wrote: Hi Joerg, With this patchset, I have an epyc system where if I boot with iommu=nopt and force a dump I will see some io page faults for a nic on the system. The vmcore is harvested and the system reboots.

Re: iommu: Improve exception handling in iommu_group_alloc()

2020-06-01 Thread Markus Elfring
>> * I suggest to avoid the specification of duplicate function calls. >> Will it be helpful to add a few jump targets? >> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162#n455 > > I

[PATCH v2] driver core: platform: expose numa_node to users in sysfs

2020-06-01 Thread Barry Song
For some platform devices like iommu, particually ARM smmu, users may care about the numa locality. for example, if threads and drivers run near iommu, they may get much better performance on dma_unmap_sg. For other platform devices, users may still want to know the hardware topology. Cc: Prime

Re: iommu: Improve exception handling in iommu_group_alloc()

2020-06-01 Thread Baolin Wang
On Tue, Jun 02, 2020 at 07:01:02AM +0200, Markus Elfring wrote: > >> * I suggest to avoid the specification of duplicate function calls. > >> Will it be helpful to add a few jump targets? > >> > >>

RE: [PATCH] driver core: platform: expose numa_node to users in sysfs

2020-06-01 Thread Song Bao Hua (Barry Song)
> -Original Message- > From: Greg KH [mailto:gre...@linuxfoundation.org] > Sent: Tuesday, June 2, 2020 4:24 PM > To: Song Bao Hua (Barry Song) > Cc: raf...@kernel.org; iommu@lists.linux-foundation.org; > linux-arm-ker...@lists.infradead.org; linux-ker...@vger.kernel.org; Linuxarm > ;

RE: [PATCH] driver core: platform: expose numa_node to users in sysfs

2020-06-01 Thread Song Bao Hua (Barry Song)
> > > > Platform devices are NUMA? That's crazy, and feels like a total abuse > > of platform devices and drivers that really should belong on a "real" > > bus. > > I am not sure if it is an abuse of platform device. But smmu is a platform > device, > drivers/iommu/arm-smmu-v3.c is a platform