All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/quirk: disable shared EPT for Sandybridge and earlier processors.
@ 2015-11-24 17:17 Anshul
  2015-11-24 17:41 ` Jan Beulich
  0 siblings, 1 reply; 35+ messages in thread
From: Anshul @ 2015-11-24 17:17 UTC (permalink / raw)
  To: xen-devel
  Cc: yang.z.zhang, andrew.cooper3, kevin.tian, Anshul Makkar, jbeulich

From: Anshul Makkar <anshul.makkar@citrix.com>

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.

Signed-off-by: Anshul Makkar <anshul.makkar@citrix.com>
---
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(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index a2e427c..6b69ba2 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -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.
 
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index d5137733..9367987 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -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;
 
diff --git a/xen/drivers/passthrough/vtd/quirks.c b/xen/drivers/passthrough/vtd/quirks.c
index 1888843..7d63c8d 100644
--- a/xen/drivers/passthrough/vtd/quirks.c
+++ b/xen/drivers/passthrough/vtd/quirks.c
@@ -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;
 }
 
 /*
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 8f3a20e..d52d06f 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -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;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread
[parent not found: <1440776507-30218-1-git-send-email-anshul.makkar@citrix.com>]

end of thread, other threads:[~2015-12-04  2:35 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-24 17:17 [PATCH] iommu/quirk: disable shared EPT for Sandybridge and earlier processors Anshul
2015-11-24 17:41 ` Jan Beulich
2015-11-25 10:28   ` Andrew Cooper
2015-11-25 10:49     ` Jan Beulich
2015-11-25 15:13       ` Andrew Cooper
2015-11-25 15:38         ` Jan Beulich
2015-11-25 15:58           ` Malcolm Crossley
2015-11-26  7:17             ` Tian, Kevin
2015-12-01 16:45               ` Anshul Makkar
2015-12-01 17:20                 ` Jan Beulich
2015-11-26  8:45             ` Jan Beulich
2015-11-26 10:27               ` Andrew Cooper
2015-11-26 10:39                 ` Jan Beulich
2015-11-26 11:42                   ` Andrew Cooper
2015-11-26 11:53                     ` Jan Beulich
2015-11-26 13:46     ` Jan Beulich
2015-11-26 13:48       ` Malcolm Crossley
2015-11-26 13:55         ` Andrew Cooper
2015-11-30 21:22           ` Konrad Rzeszutek Wilk
2015-12-01 10:34             ` Andrew Cooper
2015-12-01 10:44               ` Anshul Makkar
2015-12-01 15:24               ` Konrad Rzeszutek Wilk
2015-12-01 16:19                 ` Andrew Cooper
2015-12-03  1:19           ` Tian, Kevin
2015-12-03 11:24             ` Andrew Cooper
2015-12-04  1:55               ` Tian, Kevin
2015-12-03  2:40           ` Tian, Kevin
2015-12-03  8:18             ` Jan Beulich
2015-12-03  8:50               ` Tian, Kevin
2015-12-03 11:19                 ` Andrew Cooper
2015-12-04  2:35                   ` Tian, Kevin
     [not found] <1440776507-30218-1-git-send-email-anshul.makkar@citrix.com>
2015-08-28 16:24 ` Andrew Cooper
2015-08-31  8:09 ` Jan Beulich
2015-09-01 14:18   ` Andrew Cooper
2015-09-01 14:55     ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.