iommu/quirk: disable shared EPT for Sandybridge and earlier processors.
Anshul Makkar [email protected]
PATCH 1/1 iommu/quirk: disable shared EPT for Sandybridge and earlier processors.
From: Anshul Makkar <[email protected]>
Sandybridge or earlier processors don't have huge page support for IOTLB which leads to fallback on 4k pages and causes performance issues.
Shared EPT will be disabled only if the user has not provided explicit choice on the command line.
---
v2:
* Removed the use of extra variable to control the shared EPT and made the existent variable as tristate.
* Narrowed down the check for processors to Sandybridge and older including Atom processors.
docs/misc/xen-command-line.markdown | 2 +- xen/drivers/passthrough/iommu.c | 2 +- xen/drivers/passthrough/vtd/quirks.c | 14 ++++++++++++++ xen/include/xen/iommu.h | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-)
docs/misc/xen-command-line.markdown +1 -1
@@ -896,7 +896,7 @@ debug hypervisor only). > `sharept` -> Default: `true` +> Default: `true` if newer than SandyBridge or `false` if Sandybridge or earlier. >> Control whether CPU and IOMMU page tables should be shared.
xen/drivers/passthrough/iommu.c +1 -1
@@ -51,7 +51,7 @@ bool_t __read_mostly iommu_passthrough;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_intremap =1 ; -bool_t __read_mostly iommu_hap_pt_share =1 ; +s8 __read_mostly iommu_hap_pt_share =-1 ;bool_t __read_mostly iommu_debug;bool_t __read_mostly amd_iommu_perdev_intremap =1 ;
xen/drivers/passthrough/vtd/quirks.c +14 -0
@@ -320,6 +320,20 @@ void __init platform_quirks_init(void)/* Tylersburg interrupt remap quirk */ if ( iommu_intremap )tylersburg_intremap_quirk (); + +/* +* Disable shared EPT ("sharept") on Sandybridge and older processors +* by default. +* SandyBridge has no huge page support for IOTLB which leads to fallback +* on 4k pages and leads to performance degradation. +* +* Shared EPT ("sharept") will be disabled only if user has not +* provided explicit choice on the command line thus iommu_hap_pt_share is +* at its initialized value of -1. +*/ +if ( (boot_cpu_data.x86 ==0x06 && (boot_cpu_data.x86_model <=0x2F || + boot_cpu_data.x86_model ==0x36 )) && (iommu_hap_pt_share ==-1 ) ) + iommu_hap_pt_share =0 ; }/*
xen/include/xen/iommu.h +1 -1
@@ -31,7 +31,7 @@ extern bool_t iommu_enable, iommu_enabled;extern bool_t force_iommu, iommu_verbose;extern bool_t iommu_workaround_bios_bug, iommu_igfx, iommu_passthrough;extern bool_t iommu_snoop, iommu_qinval, iommu_intremap; -extern bool_t iommu_hap_pt_share; +extern s8 iommu_hap_pt_share;extern bool_t iommu_debug;extern bool_t amd_iommu_perdev_intremap;
Signature · 1 line
1.9.1
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 24.11.15 at 18:17, <Anshul Makkar [email protected]> wrote:
xen/drivers/passthrough/vtd/quirks.c +4
-0@@ -320,6 +320,20 @@ void __init platform_quirks_init(void)/* Tylersburg interrupt remap quirk */ if ( iommu_intremap )tylersburg_intremap_quirk (); + +/* +* Disable shared EPT ("sharept") on Sandybridge and older processors +* by default.
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 336
Quoted 10 lines
xen/drivers/passthrough/vtd/quirks.c +10
-0+* SandyBridge has no huge page support for IOTLB which leads to fallback +* on 4k pages and leads to performance degradation. +* +* Shared EPT ("sharept") will be disabled only if user has not +* provided explicit choice on the command line thus iommu_hap_pt_share is +* at its initialized value of -1. +*/ +if ( (boot_cpu_data.x86 ==0x06 && (boot_cpu_data.x86_model <=0x2F || + boot_cpu_data.x86_model ==0x36 )) && (iommu_hap_pt_share ==-1 ) ) + iommu_hap_pt_share =0 ;
If we really want to do this, then I think we should key this on EPT but not VT-d having 2M support, instead of on CPU models.
Also - with the above only marginally relevant - the line split and/or indentation is wrong.
Jan
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 24.11.15 at 18:17, <Anshul Makkar [email protected]> wrote:
xen/drivers/passthrough/vtd/quirks.c +8
-0@@ -320,6 +320,20 @@ void __init platform_quirks_init(void)/* Tylersburg interrupt remap quirk */ if ( iommu_intremap )tylersburg_intremap_quirk (); + +/* +* Disable shared EPT ("sharept") on Sandybridge and older processors +* by default. +* SandyBridge has no huge page support for IOTLB which leads to fallback +* on 4k pages and leads to performance degradation. +* +* Shared EPT ("sharept") will be disabled only if user has not
Quoted 8 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 336
Quoted 6 lines
xen/drivers/passthrough/vtd/quirks.c +6
-0+* provided explicit choice on the command line thus iommu_hap_pt_share is +* at its initialized value of -1. +*/ +if ( (boot_cpu_data.x86 ==0x06 && (boot_cpu_data.x86_model <=0x2F || + boot_cpu_data.x86_model ==0x36 )) && (iommu_hap_pt_share ==-1 ) ) + iommu_hap_pt_share =0 ;If we really want to do this, then I think we should key this on EPT but not VT-d having 2M support, instead of on CPU models.
This check is already performed by vtd_ept_page_compatible()
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
~Andrew
Quoted 26 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 24.11.15 at 18:17, <Anshul Makkar [email protected]> wrote:
xen/drivers/passthrough/vtd/quirks.c +8
-0@@ -320,6 +320,20 @@ void __init platform_quirks_init(void)/* Tylersburg interrupt remap quirk */ if ( iommu_intremap )tylersburg_intremap_quirk (); + +/* +* Disable shared EPT ("sharept") on Sandybridge and older processors +* by default. +* SandyBridge has no huge page support for IOTLB which leads to fallback +* on 4k pages and leads to performance degradation. +* +* Shared EPT ("sharept") will be disabled only if user has not Quoted 8 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 336
Quoted 6 lines
xen/drivers/passthrough/vtd/quirks.c +6
-0+* provided explicit choice on the command line thus iommu_hap_pt_share is +* at its initialized value of -1. +*/ +if ( (boot_cpu_data.x86 ==0x06 && (boot_cpu_data.x86_model <=0x2F || + boot_cpu_data.x86_model ==0x36 )) && (iommu_hap_pt_share ==-1 ) ) + iommu_hap_pt_share =0 ;If we really want to do this, then I think we should key this on EPT but not VT-d having 2M support, instead of on CPU models.
Quoted 1 line
This check is already performed by
vtd_ept_page_compatible()
Yeah, I realized there would be such a check on the way home.
Quoted 5 lines
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
So commit message and comment should make this more explicit, to avoid the impression "IOTLB" isn't just the relatively common mis-naming of "IOMMU".
Plus I guess the sharing won't need suppressing if !opt_hap_2mb?
Further the model based check is relatively broad, and includes Atoms (0x36 actually is one), which can't be considered "Sandybridge or older" imo.
And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
Jan
Quoted 39 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 24.11.15 at 18:17, <Anshul Makkar [email protected]> wrote:
xen/drivers/passthrough/vtd/quirks.c +8
-0@@ -320,6 +320,20 @@ void __init platform_quirks_init(void)/* Tylersburg interrupt remap quirk */ if ( iommu_intremap )tylersburg_intremap_quirk (); + +/* +* Disable shared EPT ("sharept") on Sandybridge and older processors +* by default. +* SandyBridge has no huge page support for IOTLB which leads to fallback +* on 4k pages and leads to performance degradation. +* +* Shared EPT ("sharept") will be disabled only if user has not Quoted 8 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 336
Quoted 6 lines
xen/drivers/passthrough/vtd/quirks.c +6
-0+* provided explicit choice on the command line thus iommu_hap_pt_share is +* at its initialized value of -1. +*/ +if ( (boot_cpu_data.x86 ==0x06 && (boot_cpu_data.x86_model <=0x2F || + boot_cpu_data.x86_model ==0x36 )) && (iommu_hap_pt_share ==-1 ) ) + iommu_hap_pt_share =0 ;If we really want to do this, then I think we should key this on EPT but not VT-d having 2M support, instead of on CPU models.
Quoted 1 line
This check is already performed by
vtd_ept_page_compatible()Yeah, I realized there would be such a check on the way home.
Quoted 5 lines
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
So commit message and comment should make this more explicit, to avoid the impression "IOTLB" isn't just the relatively common mis-naming of "IOMMU".
Plus I guess the sharing won't need suppressing if !opt_hap_2mb?
Quoted 7 lines
Further the model based check is relatively broad, and includes Atoms (
0x36actually is one), which can't be considered "Sandybridge or older" imo.And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
What else would you suggest? I can't think of any better identifying information.
~Andrew
Quoted 47 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:13, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
Quoted 12 lines · Jan Beulich
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 327
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 24.11.15 at 18:17, <Anshul Makkar [email protected]> wrote:
xen/drivers/passthrough/vtd/quirks.c +5
-0@@ -320,6 +320,20 @@ void __init platform_quirks_init(void)/* Tylersburg interrupt remap quirk */ if ( iommu_intremap )tylersburg_intremap_quirk (); + +/* +* Disable shared EPT ("sharept") on Sandybridge and older processors +* by default. +* SandyBridge has no huge page support for IOTLB which leads to fallback
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void)
Quoted 4 lines
xen/drivers/passthrough/vtd/quirks.c +4
-0+* on 4k pages and leads to performance degradation. +* +* Shared EPT ("sharept") will be disabled only if user has not +* provided explicit choice on the command line thus iommu_hap_pt_share is
Quoted 25 lines
Quoted 8 lines
Quoted 7 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 336
Quoted 5 lines
xen/drivers/passthrough/vtd/quirks.c +5
-0+* at its initialized value of -1. +*/ +if ( (boot_cpu_data.x86 ==0x06 && (boot_cpu_data.x86_model <=0x2F || + boot_cpu_data.x86_model ==0x36 )) && (iommu_hap_pt_share ==-1 ) ) + iommu_hap_pt_share =0 ;If we really want to do this, then I think we should key this on EPT but not VT-d having 2M support, instead of on CPU models.
This check is already performed by
vtd_ept_page_compatible()Yeah, I realized there would be such a check on the way home.
Quoted 5 lines
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
So commit message and comment should make this more explicit, to avoid the impression "IOTLB" isn't just the relatively common mis-naming of "IOMMU".
Plus I guess the sharing won't need suppressing if !opt_hap_2mb?
Further the model based check is relatively broad, and includes Atoms (
0x36actually is one), which can't be considered "Sandybridge or older" imo.
Quoted 6 lines
Quoted 3 lines
And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
What else would you suggest? I can't think of any better identifying information.
Chipset IDs / revisions?
Jan
Quoted 47 lines · Jan Beulich
Quoted 47 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:13, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
Quoted 12 lines · Jan Beulich
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 327
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 24.11.15 at 18:17, <Anshul Makkar [email protected]> wrote:
xen/drivers/passthrough/vtd/quirks.c +5
-0@@ -320,6 +320,20 @@ void __init platform_quirks_init(void)/* Tylersburg interrupt remap quirk */ if ( iommu_intremap )tylersburg_intremap_quirk (); + +/* +* Disable shared EPT ("sharept") on Sandybridge and older processors +* by default. +* SandyBridge has no huge page support for IOTLB which leads to fallback
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void)
Quoted 4 lines
xen/drivers/passthrough/vtd/quirks.c +4
-0+* on 4k pages and leads to performance degradation. +* +* Shared EPT ("sharept") will be disabled only if user has not +* provided explicit choice on the command line thus iommu_hap_pt_share is
Quoted 25 lines
Quoted 8 lines
Quoted 7 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 336
Quoted 5 lines
xen/drivers/passthrough/vtd/quirks.c +5
-0+* at its initialized value of -1. +*/ +if ( (boot_cpu_data.x86 ==0x06 && (boot_cpu_data.x86_model <=0x2F || + boot_cpu_data.x86_model ==0x36 )) && (iommu_hap_pt_share ==-1 ) ) + iommu_hap_pt_share =0 ;If we really want to do this, then I think we should key this on EPT but not VT-d having 2M support, instead of on CPU models.
This check is already performed by
vtd_ept_page_compatible()Yeah, I realized there would be such a check on the way home.
Quoted 5 lines
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
So commit message and comment should make this more explicit, to avoid the impression "IOTLB" isn't just the relatively common mis-naming of "IOMMU".
Plus I guess the sharing won't need suppressing if !opt_hap_2mb?
Further the model based check is relatively broad, and includes Atoms (
0x36actually is one), which can't be considered "Sandybridge or older" imo.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
What else would you suggest? I can't think of any better identifying information.
Chipset IDs / revisions?
In this case the IOMMU is integrated into the Sandybridge-EP processor itself. Unfortunately there's no register to query the IOTLB configuration of the IOMMU and so we're stuck identifying the via the processor model number itself.
Malcolm
Quoted 9 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 60 lines
From: Malcolm Crossley [mailto:[email protected]]
Sent: Wednesday, November 25, 2015 11:59 PMQuoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:13, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
Quoted 12 lines · Jan Beulich
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 327
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 24.11.15 at 18:17, <Anshul Makkar [email protected]> wrote:
xen/drivers/passthrough/vtd/quirks.c +5
-0@@ -320,6 +320,20 @@ void __init platform_quirks_init(void)/* Tylersburg interrupt remap quirk */ if ( iommu_intremap )tylersburg_intremap_quirk (); + +/* +* Disable shared EPT ("sharept") on Sandybridge and older processors +* by default. +* SandyBridge has no huge page support for IOTLB which leads to fallback
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 331
Quoted 4 lines
xen/drivers/passthrough/vtd/quirks.c +4
-0+* on 4k pages and leads to performance degradation. +* +* Shared EPT ("sharept") will be disabled only if user has not +* provided explicit choice on the command line thus iommu_hap_pt_share is
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
xen/drivers/passthrough/vtd/quirks.c +3
-0+* at its initialized value of -1. +*/ + if ( (boot_cpu_data.x86 == 0x06 && (boot_cpu_data.x86_model <= 0x2F|| >>>>>> + boot_cpu_data.x86_model == 0x36)) && (iommu_hap_pt_share ==-1) )
Quoted 28 lines
Quoted 27 lines
Quoted 17 lines
Quoted 4 lines
Quoted 3 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 335
Quoted 1 line
xen/drivers/passthrough/vtd/quirks.c +1
-0+ iommu_hap_pt_share =0 ;If we really want to do this, then I think we should key this on EPT but not VT-d having 2M support, instead of on CPU models.
This check is already performed by
vtd_ept_page_compatible()Yeah, I realized there would be such a check on the way home.
Quoted 5 lines
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
So commit message and comment should make this more explicit, to avoid the impression "IOTLB" isn't just the relatively common mis-naming of "IOMMU".
Plus I guess the sharing won't need suppressing if !opt_hap_2mb?
Quoted 7 lines
Further the model based check is relatively broad, and includes Atoms (
0x36actually is one), which can't be considered "Sandybridge or older" imo.And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
What else would you suggest? I can't think of any better identifying information.
Quoted 8 lines
Quoted 1 line
Chipset IDs / revisions?
In this case the IOMMU is integrated into the Sandybridge-EP processor itself. Unfortunately there's no register to query the IOTLB configuration of the IOMMU and so we're stuck identifying the via the processor model number itself.
Malcolm
I'm OK to use processor model here, though ideally Jan is right. :-)
Thanks
Kevin
Based on the discussion below, can I assume there is an agreement for using processor model for filtering or chipset ID will be the preferred candidate.
Thanks
Anshul Makkar
-----Original Message-----
From: Tian, Kevin [mailto:[email protected]]
Sent: 26 November 2015 07:17
To: Malcolm Crossley <[email protected]>; Jan Beulich <[email protected]>; Andrew Cooper <[email protected]>; Anshul Makkar <[email protected]>
Cc: Zhang, Yang Z <[email protected]>; [email protected]
Subject: RE: [Xen-devel] [PATCH] iommu/quirk: disable shared EPT for Sandybridge and earlier processors.
Quoted 64 lines
From: Malcolm Crossley [mailto:[email protected]]
Sent: Wednesday, November 25, 2015 11:59 PMQuoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:13, <[email protected]> wrote:
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 328
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 24.11.15 at 18:17, <Anshul Makkar [email protected]> wrote:
xen/drivers/passthrough/vtd/quirks.c +6
-0@@ -320,6 +320,20 @@ void __init platform_quirks_init(void)/* Tylersburg interrupt remap quirk */ if ( iommu_intremap )tylersburg_intremap_quirk (); + +/* +* Disable shared EPT ("sharept") on Sandybridge and older processors +* by default. +* SandyBridge has no huge page support for IOTLB which +leads to fallback
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
xen/drivers/passthrough/vtd/quirks.c +5
-0+* on 4k pages and leads to performance degradation. +* +* Shared EPT ("sharept") will be disabled only if user has not +* provided explicit choice on the command line thus +iommu_hap_pt_share Quoted 5 lines
Quoted 5 lines
is
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
xen/drivers/passthrough/vtd/quirks.c +4
-0+* at its initialized value of -1. +*/ + if ( (boot_cpu_data.x86 == 0x06 && + (boot_cpu_data.x86_model <= 0x2F|| >>>>>> + boot_cpu_data.x86_model == 0x36)) &&Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 338
Quoted 1 line
xen/drivers/passthrough/vtd/quirks.c +1
-0+ (iommu_hap_pt_share ==-1) )
Quoted 28 lines
Quoted 27 lines
Quoted 17 lines
Quoted 4 lines
Quoted 3 lines
xen/drivers/passthrough/vtd/quirks.c void __init platform_quirks_init(void) · line 339
Quoted 1 line
xen/drivers/passthrough/vtd/quirks.c +1
-0+ iommu_hap_pt_share =0 ;If we really want to do this, then I think we should key this on EPT but not VT-d having 2M support, instead of on CPU models.
This check is already performed by
vtd_ept_page_compatible()Yeah, I realized there would be such a check on the way home.
Quoted 5 lines
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
So commit message and comment should make this more explicit, to avoid the impression "IOTLB" isn't just the relatively common mis-naming of "IOMMU".
Plus I guess the sharing won't need suppressing if !opt_hap_2mb?
Quoted 7 lines
Further the model based check is relatively broad, and includes Atoms (
0x36actually is one), which can't be considered "Sandybridge or older" imo.And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
What else would you suggest? I can't think of any better identifying information.
Quoted 8 lines
Quoted 1 line
Chipset IDs / revisions?
In this case the IOMMU is integrated into the Sandybridge-EP processor itself. Unfortunately there's no register to query the IOTLB configuration of the IOMMU and so we're stuck identifying the via the processor model number itself.
Malcolm
I'm OK to use processor model here, though ideally Jan is right. :-)
Thanks
Kevin
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 17:45, <[email protected]> wrote:
Based on the discussion below, can I assume there is an agreement for using processor model for filtering or chipset ID will be the preferred candidate.
I think the subsequent suggestion by Andrew makes it even more desirable to remain independent of CPU model here. As said before, we should simply leverage the PCI IDs we already have quirks for.
Jan
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:58, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:13, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich
And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
What else would you suggest? I can't think of any better identifying information.
Chipset IDs / revisions?
In this case the IOMMU is integrated into the Sandybridge-EP processor itself.
Which doesn't preclude it to be identified via PCI device ID - after all there are dozens of processor integrated PCI devices. Looking at one of my systems,
00:05.0 System peripheral [0880]: Intel Corporation Sandy Bridge Address Map, VTd_Misc, System Management [8086:3c28] (rev 07) 80:05.0 System peripheral [0880]: Intel Corporation Sandy Bridge Address Map, VTd_Misc, System Management [8086:3c28] (rev 07)
could be a candidate (we already key a quirk on this device in pci_vtd_quirk()).
Jan
Quoted 16 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:58, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:13, <[email protected]> wrote:
On 25/11/15 10:49, Jan Beulich wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
What else would you suggest? I can't think of any better identifying information.
Chipset IDs / revisions?
In this case the IOMMU is integrated into the Sandybridge-EP processor itself.
Which doesn't preclude it to be identified via PCI device ID - after all there are dozens of processor integrated PCI devices. Looking at one of my systems,
Quoted 5 lines
00:05.0 System peripheral [0880]: Intel Corporation Sandy Bridge Address Map,
VTd_Misc, System Management [8086:3c28] (rev 07) 80:05.0 System peripheral [0880]: Intel Corporation Sandy Bridge Address Map,VTd_Misc, System Management [8086:3c28] (rev 07)could be a candidate (we already key a quirk on this device in
pci_vtd_quirk()).
These are fine for server variants, but not for desktop variants, both of which we have seen in use.
~Andrew
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 26.11.15 at 11:27, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:58, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:13, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich
And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
What else would you suggest? I can't think of any better identifying information.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Chipset IDs / revisions?
In this case the IOMMU is integrated into the Sandybridge-EP processor itself.
Which doesn't preclude it to be identified via PCI device ID - after all there are dozens of processor integrated PCI devices. Looking at one of my systems,
00:05.0 System peripheral [0880]: Intel Corporation Sandy Bridge Address
Map,
VTd_Misc, System Management [8086:3c28] (rev 07)
Quoted 8 lines
Quoted 1 line
80:05.0 System peripheral [0880]: Intel Corporation Sandy Bridge Address
Map,
VTd_Misc, System Management [8086:3c28] (rev 07)Quoted 3 lines
could be a candidate (we already key a quirk on this device in
pci_vtd_quirk()).These are fine for server variants, but not for desktop variants, both of which we have seen in use.
And I gave them only as an example that keying off of PCI IDs would be possible. A complete list would of course need to be compiled (but I think we could simply derive it from the list of IDs we already deal with in quirks.c).
Jan
Quoted 22 lines · Jan Beulich
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 26.11.15 at 11:27, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:58, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 16:13, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich
And finally I'm not fully convinced using CPU model info to deduce chipset behavior is entirely correct (albeit perhaps in practice it'll be fine except maybe when running Xen itself virtualized).
What else would you suggest? I can't think of any better identifying information.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Chipset IDs / revisions?
In this case the IOMMU is integrated into the Sandybridge-EP processor itself.
Which doesn't preclude it to be identified via PCI device ID - after all there are dozens of processor integrated PCI devices. Looking at one of my systems,
00:05.0 System peripheral [0880]: Intel Corporation Sandy Bridge Address
Map,
VTd_Misc, System Management [8086:3c28] (rev 07)Quoted 1 line
80:05.0 System peripheral [0880]: Intel Corporation Sandy Bridge Address
Map,
VTd_Misc, System Management [8086:3c28] (rev 07)
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
could be a candidate (we already key a quirk on this device in
pci_vtd_quirk()).These are fine for server variants, but not for desktop variants, both of which we have seen in use.
And I gave them only as an example that keying off of PCI IDs would be possible. A complete list would of course need to be compiled (but I think we could simply derive it from the list of IDs we already deal with in
quirks.c).
That is not my point. The Desktop variants do not expose their internals as PCI devices.
Keying on the host bridge might be an option.
Also, on further consideration, the better fix (however we identify the affected systems) would be to quirk the IOMMUs themselves into not claiming 2M/1G superpage support.
Otherwise, when we do eventually get superpage IOMMU mapping support in the API, the performance regression will creep back in.
~Andrew
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 26.11.15 at 12:42, <[email protected]> wrote:
Also, on further consideration, the better fix (however we identify the affected systems) would be to quirk the IOMMUs themselves into not claiming 2M/1G superpage support.
Otherwise, when we do eventually get superpage IOMMU mapping support in the API, the performance regression will creep back in.
Indeed, good point.
Jan
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Jan
Quoted 4 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
Quoted 8 lines
Quoted 2 lines
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Malcolm
Quoted 3 lines
Jan
Quoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
~Andrew
Quoted 24 lines · Andrew Cooper
Quoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
Quoted 5 lines
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
How did you observe this? I am mighty curious what kind of performance tools you used to find this as I would love to figure out if some of the issues we have seen are related to this?
Quoted 7 lines
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 24 lines · Konrad Rzeszutek Wilk
Quoted 23 lines · Andrew Cooper
Quoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
Quoted 8 lines
Quoted 5 lines
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
How did you observe this? I am mighty curious what kind of performance tools you used to find this as I would love to figure out if some of the issues we have seen are related to this?
The 40% difference is just in terms of network throughput of a VF, given a workload which can normally saturate line rate on the card.
~Andrew
Snabbswitch (virtualized switch) also encountered similar problem : https://groups.google.com/forum/#!topic/snabb-devel/xX0yFzeXylI
Thanks
Anshul Makkar
-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: 01 December 2015 10:34
To: Konrad Rzeszutek Wilk <[email protected]>
Cc: Jan Beulich <[email protected]>; Kevin Tian <[email protected]>; [email protected]; Malcolm Crossley <[email protected]>; Anshul Makkar <[email protected]>; [email protected]
Subject: Re: [Xen-devel] [PATCH] iommu/quirk: disable shared EPT for Sandybridge and earlier processors.
Quoted 25 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Andrew Cooper
Quoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a
driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
Quoted 8 lines
Quoted 5 lines
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
How did you observe this? I am mighty curious what kind of performance tools you used to find this as I would love to figure out if some of the issues we have seen are related to this?
The 40% difference is just in terms of network throughput of a VF, given a workload which can normally saturate line rate on the card.
~Andrew
Quoted 28 lines · Andrew Cooper
Quoted 27 lines · Konrad Rzeszutek Wilk
Quoted 26 lines · Andrew Cooper
Quoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
How did you observe this? I am mighty curious what kind of performance tools you used to find this as I would love to figure out if some of the issues we have seen are related to this?
The 40% difference is just in terms of network throughput of a VF, given a workload which can normally saturate line rate on the card.
I understand that.
But I am curious on how you found out the page walks by the IOMMU were so excessive? Were there any perf counters on the IOMMU that showed a crazy amount of pagetable walks?
It just that if I had looked at this I would have first looked at interrupts, then kernels, then hypervisor - and eventually (after lots of head banging) it would have occurred to me to look at the IOMMU pagetables.
Quoted 2 lines
~Andrew
Quoted 34 lines · Konrad Rzeszutek Wilk
Quoted 33 lines · Andrew Cooper
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 23 lines · Andrew Cooper
Quoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
Quoted 5 lines
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
How did you observe this? I am mighty curious what kind of performance tools you used to find this as I would love to figure out if some of the issues we have seen are related to this?
Quoted 6 lines
Quoted 2 lines
The 40% difference is just in terms of network throughput of a VF, given a workload which can normally saturate line rate on the card.
I understand that.
But I am curious on how you found out the page walks by the IOMMU were so excessive?
I didn't. It is all speculation drawn from other information.
The manual states that there is not a superpage IOTLB.
This leaves two options
1) 2M mappings are entirely uncached
2) 2M mappings are shattered to 4K mappings and cached
The fact there is a 40% performance reduction suggests 1 rather than 2.
~Andrew
Quoted 27 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Thursday, November 26, 2015 9:56 PMQuoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
Quoted 7 lines
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
~Andrew
One confusion here. The original patch just disables shared_ept, w/o changing IOMMU to not use 2MB mapping. Is there something missing or other tricks behind?
When you say using 4k mapping saves 40% overhead back, is it w/ ept shared or not?
Thanks
Kevin
Quoted 29 lines · Kevin
Quoted 29 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Thursday, November 26, 2015 9:56 PMQuoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
Quoted 7 lines
Quoted 4 lines
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
~Andrew
One confusion here. The original patch just disables
shared_ept, w/o changing IOMMU to not use 2MB mapping. Is there something missing or other tricks behind?
Disabling shared_ept works because the Xen IOMMU interface doesn't support superpages.
However, I subsequently changed my mind in this thread about the approach taken, and quirking the IOMMUs not to report superpage capabilities is the correct solution to the problem.
~Andrew
Quoted 41 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Thursday, December 03, 2015 7:24 PMQuoted 29 lines · Kevin
Quoted 29 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Thursday, November 26, 2015 9:56 PMQuoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
Quoted 7 lines
Quoted 4 lines
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
~Andrew
One confusion here. The original patch just disables
shared_ept, w/o changing IOMMU to not use 2MB mapping. Is there something missing or other tricks behind?
Quoted 7 lines
Disabling
shared_eptworks because the Xen IOMMU interface doesn't support superpages.However, I subsequently changed my mind in this thread about the approach taken, and quirking the IOMMUs not to report superpage capabilities is the correct solution to the problem.
Yes, it makes more sense.
Thanks
Kevin
Quoted 36 lines
From: Tian, Kevin
Sent: Thursday, December 03, 2015 9:20 AMQuoted 33 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Thursday, November 26, 2015 9:56 PMQuoted 12 lines · Malcolm Crossley
Quoted 11 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.11.15 at 11:28, <[email protected]> wrote:
The problem is that SandyBridge IOMMUs advertise 2M support and do function with it, but cannot cache 2MB translations in the IOTLBs.
As a result, attempting to use 2M translations causes substantially worse performance than 4K translations.
Btw - how does this get explained? At a first glance, even if 2Mb translations don't get entered into the TLB, it should still be one less page table level to walk for the IOMMU, and should hence nevertheless be a benefit. Yet you even say _substantially_ worse performance results.
Quoted 6 lines
There is a IOTLB for the 4K translation so if you only use 4K translations then you get to take advantage of the IOTLB.
If you use the 2Mb translation then a page table walk has to be performed every time there's a DMA access to that region of the BFN address space.
Also remember that a high level dma access (from the point of view of a driver) will be fragmented at the PCIe max packet size, which is typically 256 bytes.
So by not caching the 2Mb translation, a dma access of 4k may undergo 16 pagetable walks, one for each PCIe packet.
We observed that using 2Mb mappings results in a 40% overhead, compared to using 4k mappings, from the point of view of a sample network workload.
Quoted 9 lines
Quoted 1 line
~Andrew
One confusion here. The original patch just disables
shared_ept, w/o changing IOMMU to not use 2MB mapping. Is there something missing or other tricks behind?When you say using 4k mapping saves 40% overhead back, is it w/ ept shared or not?
Just confirmed internally with HW team. On SNB 4KB cache is always used regardless of 4KB/2MB/1GB mapping. There'd be another reason for this 40% drop observation...
Thanks
Kevin
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 03.12.15 at 03:40, <[email protected]> wrote:
Just confirmed internally with HW team. On SNB 4KB cache is always used regardless of 4KB/2MB/1GB mapping. There'd be another reason for this 40% drop observation...
So when they stated that the 4k TLB gets always used, did they at least provide some thoughts on what else might be causing this severe a performance impact? Without them helping we're left guessing...
Jan
Quoted 4 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, December 03, 2015 4:18 PMQuoted 1 line
Quoted 1 line
Quoted 1 line · On 03.12.15 at 03:40, <[email protected]> wrote:
Quoted 9 lines
Quoted 3 lines
Just confirmed internally with HW team. On SNB 4KB cache is always used regardless of 4KB/2MB/1GB mapping. There'd be another reason for this 40% drop observation...
So when they stated that the 4k TLB gets always used, did they at least provide some thoughts on what else might be causing this severe a performance impact? Without them helping we're left guessing...
Unfortunately no clear answer...
Thanks
Kevin
Quoted 7 lines · Kevin
Quoted 7 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, December 03, 2015 4:18 PMQuoted 4 lines
Quoted 1 line
Quoted 1 line · On 03.12.15 at 03:40, <[email protected]> wrote:
Just confirmed internally with HW team. On SNB 4KB cache is always used regardless of 4KB/2MB/1GB mapping. There'd be another reason for this 40% drop observation...
Quoted 6 lines
Quoted 5 lines
So when they stated that the 4k TLB gets always used, did they at least provide some thoughts on what else might be causing this severe a performance impact? Without them helping we're left guessing...
Unfortunately no clear answer...
http://networkbuilders.intel.com/docs/Network_Builders_RA_vBRAS_Final.pdf
Page 42: "The IOTLB on the previous generation Intel Xeon Processor E5-2690 does not natively support huge pages (it emulates them using 4K pages)."
And Figure 51 on Page 43
The "emulates them using 4K pages" probably means that the IOTLB is flushed and filled with 512 adjacent 4k mappings.
Citrix's measurements back up the findings in that paper, and also show that performance is better when using plain 4k mappings as opposed to emulated 2M mappings.
~Andrew
Quoted 24 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Thursday, December 03, 2015 7:19 PMQuoted 7 lines · Kevin
Quoted 7 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, December 03, 2015 4:18 PMQuoted 4 lines
Quoted 1 line
Quoted 1 line · On 03.12.15 at 03:40, <[email protected]> wrote:
Just confirmed internally with HW team. On SNB 4KB cache is always used regardless of 4KB/2MB/1GB mapping. There'd be another reason for this 40% drop observation...
Quoted 6 lines
Quoted 5 lines
So when they stated that the 4k TLB gets always used, did they at least provide some thoughts on what else might be causing this severe a performance impact? Without them helping we're left guessing...
Unfortunately no clear answer...
http://networkbuilders.intel.com/docs/Network_Builders_RA_vBRAS_Final.pdf
Page 42: "The IOTLB on the previous generation Intel Xeon Processor E5-2690 does not natively support huge pages (it emulates them using 4K pages)."
Quoted 9 lines
And Figure 51 on Page 43
The "emulates them using 4K pages" probably means that the IOTLB is flushed and filled with 512 adjacent 4k mappings.
Citrix's measurements back up the findings in that paper, and also show that performance is better when using plain 4k mappings as opposed to emulated 2M mappings.
Thanks for the information. I'll forward it to HW team.
If above interpretation is correct (which also matches my thought), then for two options you listed earlier:
---
Quoted 5 lines
This leaves two options
1) 2M mappings are entirely uncached
2) 2M mappings are shattered to 4K mappings and cachedThe fact there is a 40% performance reduction suggests 1 rather than 2.
---
looks 2) is suggested rather than 1). There are two further options:
2.1) 2M mappings are shattered to 512 adjacent 4k mappings which are all cached;
2.2) Only the 4k mapping out of 2M mapping is cached for the page being accessed;
for 2.1), as IOTLB entries are limited, it may cause unnecessary IOTLB entry flushes and thus incurs more page walking overhead to fill-in.
for 2.2), I can't think out a reason to cause performance drop.
Thanks
Kevin