xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/EPT: defer enabling of A/D maintenance until PML get enabled
@ 2015-09-28 14:42 Jan Beulich
  2015-09-28 15:00 ` George Dunlap
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Jan Beulich @ 2015-09-28 14:42 UTC (permalink / raw)
  To: xen-devel; +Cc: Kai Huang, Andrew Cooper, Kevin Tian, Jun Nakajima

[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]

There's no point in enabling the extra feature for every domain when
we're not meaning to use it (yet). Just setting the flag should be
sufficient - the domain is required to be paused for PML enabling
anyway, i.e. hardware will pick up the new setting the next time
each vCPU of the guest gets scheduled.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Kai Huang <kai.huang@linux.intel.com>
---
VT-x maintainers, Kai: Me lacking the hardware to test this, may I ask
for your help here?

--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -1127,6 +1127,7 @@ void ept_sync_domain(struct p2m_domain *
 
 static void ept_enable_pml(struct p2m_domain *p2m)
 {
+    p2m->ept.ept_ad = 1;
     /*
      * No need to check if vmx_domain_enable_pml has succeeded or not, as
      * ept_p2m_type_to_flags will do the check, and write protection will be
@@ -1137,6 +1138,7 @@ static void ept_enable_pml(struct p2m_do
 
 static void ept_disable_pml(struct p2m_domain *p2m)
 {
+    p2m->ept.ept_ad = 0;
     vmx_domain_disable_pml(p2m->domain);
 }
 
@@ -1164,8 +1166,6 @@ int ept_p2m_init(struct p2m_domain *p2m)
 
     if ( cpu_has_vmx_pml )
     {
-        /* Enable EPT A/D bits if we are going to use PML. */
-        ept->ept_ad = cpu_has_vmx_pml ? 1 : 0;
         p2m->enable_hardware_log_dirty = ept_enable_pml;
         p2m->disable_hardware_log_dirty = ept_disable_pml;
         p2m->flush_hardware_cached_dirty = ept_flush_pml_buffers;




[-- Attachment #2: x86-PML-defer-AD-enable.patch --]
[-- Type: text/plain, Size: 1560 bytes --]

x86/EPT: defer enabling of A/D maintenance until PML get enabled

There's no point in enabling the extra feature for every domain when
we're not meaning to use it (yet). Just setting the flag should be
sufficient - the domain is required to be paused for PML enabling
anyway, i.e. hardware will pick up the new setting the next time
each vCPU of the guest gets scheduled.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Kai Huang <kai.huang@linux.intel.com>
---
VT-x maintainers, Kai: Me lacking the hardware to test this, may I ask
for your help here?

--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -1127,6 +1127,7 @@ void ept_sync_domain(struct p2m_domain *
 
 static void ept_enable_pml(struct p2m_domain *p2m)
 {
+    p2m->ept.ept_ad = 1;
     /*
      * No need to check if vmx_domain_enable_pml has succeeded or not, as
      * ept_p2m_type_to_flags will do the check, and write protection will be
@@ -1137,6 +1138,7 @@ static void ept_enable_pml(struct p2m_do
 
 static void ept_disable_pml(struct p2m_domain *p2m)
 {
+    p2m->ept.ept_ad = 0;
     vmx_domain_disable_pml(p2m->domain);
 }
 
@@ -1164,8 +1166,6 @@ int ept_p2m_init(struct p2m_domain *p2m)
 
     if ( cpu_has_vmx_pml )
     {
-        /* Enable EPT A/D bits if we are going to use PML. */
-        ept->ept_ad = cpu_has_vmx_pml ? 1 : 0;
         p2m->enable_hardware_log_dirty = ept_enable_pml;
         p2m->disable_hardware_log_dirty = ept_disable_pml;
         p2m->flush_hardware_cached_dirty = ept_flush_pml_buffers;

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-10-15  8:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-28 14:42 [PATCH] x86/EPT: defer enabling of A/D maintenance until PML get enabled Jan Beulich
2015-09-28 15:00 ` George Dunlap
2015-09-29 12:51 ` Andrew Cooper
2015-09-30  8:58 ` Kai Huang
2015-09-30  9:54   ` Jan Beulich
2015-09-30 12:45     ` Kai Huang
2015-10-14  1:19       ` Kai Huang
2015-10-14  9:08         ` Kai Huang
2015-10-14  9:26           ` Jan Beulich
2015-10-15  6:42             ` Kai Huang
2015-10-15  7:11               ` Jan Beulich
2015-10-15  7:35                 ` Kai Huang
2015-10-15  7:41                   ` Kai Huang
2015-10-15  8:26                   ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).