diff mbox series

VT-d: suppress individual flushes during hwdom setup

Message ID 5CCAE256020000780022B35B@prv1-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show
Series VT-d: suppress individual flushes during hwdom setup | expand

Commit Message

Jan Beulich May 2, 2019, 12:28 p.m. UTC
There's an invocation of iommu_flush_all() immediately afterwards.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Roger Pau Monné May 2, 2019, 1:08 p.m. UTC | #1
On Thu, May 02, 2019 at 06:28:06AM -0600, Jan Beulich wrote:
> There's an invocation of iommu_flush_all() immediately afterwards.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1310,8 +1310,11 @@ static void __hwdom_init intel_iommu_hwd
>  
>      setup_hwdom_pci_devices(d, setup_hwdom_device);
>      setup_hwdom_rmrr(d);
> +
>      /* Make sure workarounds are applied before enabling the IOMMU(s). */
> +    this_cpu(iommu_dont_flush_iotlb) = true;
>      arch_iommu_hwdom_init(d);
> +    this_cpu(iommu_dont_flush_iotlb) = false;

Don't you want to also avoid flushes in setup_hwdom_rmrr and
setup_hwdom_pci_devices?

Thanks, Roger.
Paul Durrant May 2, 2019, 1:12 p.m. UTC | #2
> -----Original Message-----
> From: Xen-devel [mailto:xen-devel-bounces@lists.xenproject.org] On Behalf Of Jan Beulich
> Sent: 02 May 2019 13:28
> To: xen-devel <xen-devel@lists.xenproject.org>
> Cc: Kevin Tian <kevin.tian@intel.com>
> Subject: [Xen-devel] [PATCH] VT-d: suppress individual flushes during hwdom setup
> 
> There's an invocation of iommu_flush_all() immediately afterwards.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1310,8 +1310,11 @@ static void __hwdom_init intel_iommu_hwd
> 
>      setup_hwdom_pci_devices(d, setup_hwdom_device);
>      setup_hwdom_rmrr(d);
> +
>      /* Make sure workarounds are applied before enabling the IOMMU(s). */
> +    this_cpu(iommu_dont_flush_iotlb) = true;
>      arch_iommu_hwdom_init(d);
> +    this_cpu(iommu_dont_flush_iotlb) = false;

There should be no need for this. arch_iommu_hwdom_init() is using iommu_map(), which no longer does implicit flushing.

  Paul

> 
>      if ( iommu_flush_all() )
>          printk(XENLOG_WARNING VTDPREFIX
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel
Jan Beulich May 2, 2019, 1:35 p.m. UTC | #3
>>> On 02.05.19 at 15:08, <roger.pau@citrix.com> wrote:
> On Thu, May 02, 2019 at 06:28:06AM -0600, Jan Beulich wrote:
>> There's an invocation of iommu_flush_all() immediately afterwards.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> 
>> --- a/xen/drivers/passthrough/vtd/iommu.c
>> +++ b/xen/drivers/passthrough/vtd/iommu.c
>> @@ -1310,8 +1310,11 @@ static void __hwdom_init intel_iommu_hwd
>>  
>>      setup_hwdom_pci_devices(d, setup_hwdom_device);
>>      setup_hwdom_rmrr(d);
>> +
>>      /* Make sure workarounds are applied before enabling the IOMMU(s). */
>> +    this_cpu(iommu_dont_flush_iotlb) = true;
>>      arch_iommu_hwdom_init(d);
>> +    this_cpu(iommu_dont_flush_iotlb) = false;
> 
> Don't you want to also avoid flushes in setup_hwdom_rmrr and
> setup_hwdom_pci_devices?

We probably could, but the gain would be much lower because
there are far fewer pages involved there.

Jan
Jan Beulich May 2, 2019, 1:41 p.m. UTC | #4
>>> On 02.05.19 at 15:12, <Paul.Durrant@citrix.com> wrote:
>> From: Xen-devel [mailto:xen-devel-bounces@lists.xenproject.org] On Behalf Of 
> Jan Beulich
>> Sent: 02 May 2019 13:28
>> 
>> --- a/xen/drivers/passthrough/vtd/iommu.c
>> +++ b/xen/drivers/passthrough/vtd/iommu.c
>> @@ -1310,8 +1310,11 @@ static void __hwdom_init intel_iommu_hwd
>> 
>>      setup_hwdom_pci_devices(d, setup_hwdom_device);
>>      setup_hwdom_rmrr(d);
>> +
>>      /* Make sure workarounds are applied before enabling the IOMMU(s). */
>> +    this_cpu(iommu_dont_flush_iotlb) = true;
>>      arch_iommu_hwdom_init(d);
>> +    this_cpu(iommu_dont_flush_iotlb) = false;
> 
> There should be no need for this. arch_iommu_hwdom_init() is using 
> iommu_map(), which no longer does implicit flushing.

Oh, good point. I should have dropped this patch (dating back
to October last year) when your respective change had landed.

Jan
diff mbox series

Patch

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1310,8 +1310,11 @@  static void __hwdom_init intel_iommu_hwd
 
     setup_hwdom_pci_devices(d, setup_hwdom_device);
     setup_hwdom_rmrr(d);
+
     /* Make sure workarounds are applied before enabling the IOMMU(s). */
+    this_cpu(iommu_dont_flush_iotlb) = true;
     arch_iommu_hwdom_init(d);
+    this_cpu(iommu_dont_flush_iotlb) = false;
 
     if ( iommu_flush_all() )
         printk(XENLOG_WARNING VTDPREFIX