Skip to contentSkip to conversation

: feature flags for PVH

PATCH New Mukesh Rathor 4 participants 10 messages Jan 25, 2014 – Feb 7, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : feature flags for PVH

Hi,

For pass 1, I came with these feature flags to be exposed to pvh domUs.

thanks
Mukesh

#1 lore raw

PATCH 1/1 pvh: expose feature flags from tools for domUs

Expose features for pvh domUs from tools.

---
 tools/libxc/xc_cpuid_x86.c |   26 ++++++++++++++++----------
 tools/libxc/xc_domain.c    |    1 +
 tools/libxc/xenctrl.h      |    2 +-
 3 files changed, 18 insertions(+), 11 deletions(-)
tools/libxc/xc_cpuid_x86.c +16 -10
index bbbf9b8..33f6829 100644
@@ -433,7 +433,7 @@ static void xc_cpuid_hvm_policy(
 
 static void xc_cpuid_pv_policy(
     xc_interface *xch, domid_t domid,
-    const unsigned int *input, unsigned int *regs)
+    const unsigned int *input, unsigned int *regs, int is_pvh)
 {
     DECLARE_DOMCTL;
     unsigned int guest_width;
@@ -455,13 +455,16 @@ static void xc_cpuid_pv_policy(
 
     if ( (input[0] & 0x7fffffff) == 0x00000001 )
     {
-        clear_bit(X86_FEATURE_VME, regs[3]);
-        clear_bit(X86_FEATURE_PSE, regs[3]);
-        clear_bit(X86_FEATURE_PGE, regs[3]);
-        clear_bit(X86_FEATURE_MCE, regs[3]);
-        clear_bit(X86_FEATURE_MCA, regs[3]);
+        if ( !is_pvh )
+        {
+            clear_bit(X86_FEATURE_VME, regs[3]);
+            clear_bit(X86_FEATURE_PSE, regs[3]);
+            clear_bit(X86_FEATURE_PGE, regs[3]);
+            clear_bit(X86_FEATURE_MCE, regs[3]);
+            clear_bit(X86_FEATURE_MCA, regs[3]);
+            clear_bit(X86_FEATURE_PSE36, regs[3]);
+        }
         clear_bit(X86_FEATURE_MTRR, regs[3]);
-        clear_bit(X86_FEATURE_PSE36, regs[3]);
     }
 
     switch ( input[0] )
@@ -524,8 +527,11 @@ static void xc_cpuid_pv_policy(
         {
             set_bit(X86_FEATURE_SYSCALL, regs[3]);
         }
-        clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
-        clear_bit(X86_FEATURE_RDTSCP, regs[3]);
+        if ( !is_pvh )
+        {
+            clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
+            clear_bit(X86_FEATURE_RDTSCP, regs[3]);
+        }
 
         clear_bit(X86_FEATURE_SVM, regs[2]);
         clear_bit(X86_FEATURE_OSVW, regs[2]);
@@ -561,7 +567,7 @@ static int xc_cpuid_policy(
     if ( info.hvm )
         xc_cpuid_hvm_policy(xch, domid, input, regs);
     else
-        xc_cpuid_pv_policy(xch, domid, input, regs);
+        xc_cpuid_pv_policy(xch, domid, input, regs, info.pvh);
 
     return 0;
 }
tools/libxc/xc_domain.c +1 -0
index c2fdd74..f12999a 100644
@@ -316,6 +316,7 @@ int xc_domain_getinfo(xc_interface *xch,
         info->running  = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_running);
         info->hvm      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
         info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged);
+        info->pvh      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_pvh_guest);
 
         info->shutdown_reason =
             (domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift) &
tools/libxc/xenctrl.h +1 -1
index 13f816b..77d219a 100644
@@ -404,7 +404,7 @@ typedef struct xc_dominfo {
     uint32_t      ssidref;
     unsigned int  dying:1, crashed:1, shutdown:1,
                   paused:1, blocked:1, running:1,
-                  hvm:1, debugged:1;
+                  hvm:1, debugged:1, pvh:1;
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
     unsigned long nr_pages; /* current number, not maximum */
     unsigned long nr_outstanding_pages;
Signature · 1 line
1.7.2.3
#2 lore raw

Re: [V0 PATCH] pvh: expose feature flags from tools for domUs

Quoted 2 lines · Mukesh Rathor

Expose features for pvh domUs from tools.

I assume this is targeting 4.5?

Quoted 91 lines
---
 tools/libxc/xc_cpuid_x86.c |   26 ++++++++++++++++----------
 tools/libxc/xc_domain.c    |    1 +
 tools/libxc/xenctrl.h      |    2 +-
 3 files changed, 18 insertions(+), 11 deletions(-)
tools/libxc/xc_cpuid_x86.c +16 -10
index bbbf9b8..33f6829 100644
@@ -433,7 +433,7 @@ static void xc_cpuid_hvm_policy(
 
 static void xc_cpuid_pv_policy(
     xc_interface *xch, domid_t domid,
-    const unsigned int *input, unsigned int *regs)
+    const unsigned int *input, unsigned int *regs, int is_pvh)
 {
     DECLARE_DOMCTL;
     unsigned int guest_width;
@@ -455,13 +455,16 @@ static void xc_cpuid_pv_policy(
 
     if ( (input[0] & 0x7fffffff) == 0x00000001 )
     {
-        clear_bit(X86_FEATURE_VME, regs[3]);
-        clear_bit(X86_FEATURE_PSE, regs[3]);
-        clear_bit(X86_FEATURE_PGE, regs[3]);
-        clear_bit(X86_FEATURE_MCE, regs[3]);
-        clear_bit(X86_FEATURE_MCA, regs[3]);
+        if ( !is_pvh )
+        {
+            clear_bit(X86_FEATURE_VME, regs[3]);
+            clear_bit(X86_FEATURE_PSE, regs[3]);
+            clear_bit(X86_FEATURE_PGE, regs[3]);
+            clear_bit(X86_FEATURE_MCE, regs[3]);
+            clear_bit(X86_FEATURE_MCA, regs[3]);
+            clear_bit(X86_FEATURE_PSE36, regs[3]);
+        }
         clear_bit(X86_FEATURE_MTRR, regs[3]);
-        clear_bit(X86_FEATURE_PSE36, regs[3]);
     }
 
     switch ( input[0] )
@@ -524,8 +527,11 @@ static void xc_cpuid_pv_policy(
         {
             set_bit(X86_FEATURE_SYSCALL, regs[3]);
         }
-        clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
-        clear_bit(X86_FEATURE_RDTSCP, regs[3]);
+        if ( !is_pvh )
+        {
+            clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
+            clear_bit(X86_FEATURE_RDTSCP, regs[3]);
+        }
 
         clear_bit(X86_FEATURE_SVM, regs[2]);
         clear_bit(X86_FEATURE_OSVW, regs[2]);
@@ -561,7 +567,7 @@ static int xc_cpuid_policy(
     if ( info.hvm )
         xc_cpuid_hvm_policy(xch, domid, input, regs);
     else
-        xc_cpuid_pv_policy(xch, domid, input, regs);
+        xc_cpuid_pv_policy(xch, domid, input, regs, info.pvh);
 
     return 0;
 }
tools/libxc/xc_domain.c +1 -0
index c2fdd74..f12999a 100644
@@ -316,6 +316,7 @@ int xc_domain_getinfo(xc_interface *xch,
         info->running  = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_running);
         info->hvm      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
         info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged);
+        info->pvh      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_pvh_guest);
 
         info->shutdown_reason =
             (domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift) &
tools/libxc/xenctrl.h +1 -1
index 13f816b..77d219a 100644
@@ -404,7 +404,7 @@ typedef struct xc_dominfo {
     uint32_t      ssidref;
     unsigned int  dying:1, crashed:1, shutdown:1,
                   paused:1, blocked:1, running:1,
-                  hvm:1, debugged:1;
+                  hvm:1, debugged:1, pvh:1;
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
     unsigned long nr_pages; /* current number, not maximum */
     unsigned long nr_outstanding_pages;
#3 lore raw

Re: [V0 PATCH] pvh: expose feature flags from tools for domUs

Quoted 5 lines · On Tue, 28 Jan 2014 11:14:36 +0000 Ian Campbell <[email protected]> wrote:
Quoted 2 lines · Mukesh Rathor

Expose features for pvh domUs from tools.

I assume this is targeting 4.5?

Yes. Unless it says "checks in the mail", it's 4.5 :).

-Mukesh

#4 lore raw

Re: [V0 PATCH] pvh: expose feature flags from tools for domUs

In reply to Mukesh Rathor
Quoted 28 lines · Mukesh Rathor

Expose features for pvh domUs from tools.

---
 tools/libxc/xc_cpuid_x86.c |   26 ++++++++++++++++----------
 tools/libxc/xc_domain.c    |    1 +
 tools/libxc/xenctrl.h      |    2 +-
 3 files changed, 18 insertions(+), 11 deletions(-)
tools/libxc/xc_cpuid_x86.c +1 -3
index bbbf9b8..33f6829 100644
@@ -433,7 +433,7 @@ static void xc_cpuid_hvm_policy(
 
 static void xc_cpuid_pv_policy(
     xc_interface *xch, domid_t domid,
-    const unsigned int *input, unsigned int *regs)
+    const unsigned int *input, unsigned int *regs, int is_pvh)
 {
     DECLARE_DOMCTL;
     unsigned int guest_width;
@@ -455,13 +455,16 @@ static void xc_cpuid_pv_policy(
 
     if ( (input[0] & 0x7fffffff) == 0x00000001 )
     {
-        clear_bit(X86_FEATURE_VME, regs[3]);
-        clear_bit(X86_FEATURE_PSE, regs[3]);

tools/libxc/xc_cpuid_x86.c static void xc_cpuid_pv_policy( · line 464

Quoted 10 lines
tools/libxc/xc_cpuid_x86.c +7 -3
-        clear_bit(X86_FEATURE_PGE, regs[3]);
-        clear_bit(X86_FEATURE_MCE, regs[3]);
-        clear_bit(X86_FEATURE_MCA, regs[3]);
+        if ( !is_pvh )
+        {
+            clear_bit(X86_FEATURE_VME, regs[3]);
+            clear_bit(X86_FEATURE_PSE, regs[3]);
+            clear_bit(X86_FEATURE_PGE, regs[3]);
+            clear_bit(X86_FEATURE_MCE, regs[3]);
+            clear_bit(X86_FEATURE_MCA, regs[3]);

Should we enable MCA/MCE flags for PVH DomUs? It looks to me like Dom0 is the only domain that can make use of MCE/MCA.

Roger.

#5 lore raw

Re: [V0 PATCH] pvh: expose feature flags from tools for domUs

Quoted 13 lines
Quoted 1 line
Quoted 1 line · Roger Pau Monné
Quoted 11 lines · Mukesh Rathor
tools/libxc/xc_cpuid_x86.c +2 -5
@@ -455,13 +455,16 @@ static void xc_cpuid_pv_policy(
 
     if ( (input[0] & 0x7fffffff) == 0x00000001 )
     {
-        clear_bit(X86_FEATURE_VME, regs[3]);
-        clear_bit(X86_FEATURE_PSE, regs[3]);
-        clear_bit(X86_FEATURE_PGE, regs[3]);
-        clear_bit(X86_FEATURE_MCE, regs[3]);
-        clear_bit(X86_FEATURE_MCA, regs[3]);
+        if ( !is_pvh )
+        {
Quoted 8 lines

tools/libxc/xc_cpuid_x86.c static void xc_cpuid_pv_policy( · line 464

Quoted 5 lines
tools/libxc/xc_cpuid_x86.c +5 -0
+            clear_bit(X86_FEATURE_VME, regs[3]);
+            clear_bit(X86_FEATURE_PSE, regs[3]);
+            clear_bit(X86_FEATURE_PGE, regs[3]);
+            clear_bit(X86_FEATURE_MCE, regs[3]);
+            clear_bit(X86_FEATURE_MCA, regs[3]);

Should we enable MCA/MCE flags for PVH DomUs? It looks to me like Dom0 is the only domain that can make use of MCE/MCA.

We still have vMCE ...

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw

Re: [V0 PATCH] pvh: expose feature flags from tools for domUs

In reply to Roger Pau Monné
Quoted 34 lines · On Tue, 28 Jan 2014 13:24:15 +0100 Roger Pau Monné <[email protected]> wrote:
Quoted 33 lines · Mukesh Rathor

Expose features for pvh domUs from tools.

---
 tools/libxc/xc_cpuid_x86.c |   26 ++++++++++++++++----------
 tools/libxc/xc_domain.c    |    1 +
 tools/libxc/xenctrl.h      |    2 +-
 3 files changed, 18 insertions(+), 11 deletions(-)
tools/libxc/xc_cpuid_x86.c +3 -6
index bbbf9b8..33f6829 100644
@@ -433,7 +433,7 @@ static void xc_cpuid_hvm_policy(
 
 static void xc_cpuid_pv_policy(
     xc_interface *xch, domid_t domid,
-    const unsigned int *input, unsigned int *regs)
+    const unsigned int *input, unsigned int *regs, int is_pvh)
 {
     DECLARE_DOMCTL;
     unsigned int guest_width;
@@ -455,13 +455,16 @@ static void xc_cpuid_pv_policy(
 
     if ( (input[0] & 0x7fffffff) == 0x00000001 )
     {
-        clear_bit(X86_FEATURE_VME, regs[3]);
-        clear_bit(X86_FEATURE_PSE, regs[3]);
-        clear_bit(X86_FEATURE_PGE, regs[3]);
-        clear_bit(X86_FEATURE_MCE, regs[3]);
-        clear_bit(X86_FEATURE_MCA, regs[3]);
+        if ( !is_pvh )
+        {
Quoted 8 lines

tools/libxc/xc_cpuid_x86.c static void xc_cpuid_pv_policy( · line 464

Quoted 5 lines
tools/libxc/xc_cpuid_x86.c +5 -0
+            clear_bit(X86_FEATURE_VME, regs[3]);
+            clear_bit(X86_FEATURE_PSE, regs[3]);
+            clear_bit(X86_FEATURE_PGE, regs[3]);
+            clear_bit(X86_FEATURE_MCE, regs[3]);
+            clear_bit(X86_FEATURE_MCA, regs[3]);

Should we enable MCA/MCE flags for PVH DomUs? It looks to me like Dom0 is the only domain that can make use of MCE/MCA.

Yes, PVH, like any other guest, may setup MCE handlers if they are enabled, and xen would inject any MCE to guest if it belongs to the guest.

thanks
Mukesh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw

Re: [V0 PATCH] pvh: expose feature flags from tools for domUs

In reply to Mukesh Rathor

ping? I think Roger you can ack from xen-pvh side. IanC/J, I guess one of you need to ack from tool side?

Again this for 4.5, and not 4.4.

thanks
Mukesh

Quoted 94 lines · On Fri, 24 Jan 2014 17:13:30 -0800 Mukesh Rathor <[email protected]>…

Expose features for pvh domUs from tools.

---
 tools/libxc/xc_cpuid_x86.c |   26 ++++++++++++++++----------
 tools/libxc/xc_domain.c    |    1 +
 tools/libxc/xenctrl.h      |    2 +-
 3 files changed, 18 insertions(+), 11 deletions(-)
tools/libxc/xc_cpuid_x86.c +16 -10
index bbbf9b8..33f6829 100644
@@ -433,7 +433,7 @@ static void xc_cpuid_hvm_policy(
 
 static void xc_cpuid_pv_policy(
     xc_interface *xch, domid_t domid,
-    const unsigned int *input, unsigned int *regs)
+    const unsigned int *input, unsigned int *regs, int is_pvh)
 {
     DECLARE_DOMCTL;
     unsigned int guest_width;
@@ -455,13 +455,16 @@ static void xc_cpuid_pv_policy(
 
     if ( (input[0] & 0x7fffffff) == 0x00000001 )
     {
-        clear_bit(X86_FEATURE_VME, regs[3]);
-        clear_bit(X86_FEATURE_PSE, regs[3]);
-        clear_bit(X86_FEATURE_PGE, regs[3]);
-        clear_bit(X86_FEATURE_MCE, regs[3]);
-        clear_bit(X86_FEATURE_MCA, regs[3]);
+        if ( !is_pvh )
+        {
+            clear_bit(X86_FEATURE_VME, regs[3]);
+            clear_bit(X86_FEATURE_PSE, regs[3]);
+            clear_bit(X86_FEATURE_PGE, regs[3]);
+            clear_bit(X86_FEATURE_MCE, regs[3]);
+            clear_bit(X86_FEATURE_MCA, regs[3]);
+            clear_bit(X86_FEATURE_PSE36, regs[3]);
+        }
         clear_bit(X86_FEATURE_MTRR, regs[3]);
-        clear_bit(X86_FEATURE_PSE36, regs[3]);
     }
 
     switch ( input[0] )
@@ -524,8 +527,11 @@ static void xc_cpuid_pv_policy(
         {
             set_bit(X86_FEATURE_SYSCALL, regs[3]);
         }
-        clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
-        clear_bit(X86_FEATURE_RDTSCP, regs[3]);
+        if ( !is_pvh )
+        {
+            clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
+            clear_bit(X86_FEATURE_RDTSCP, regs[3]);
+        }
 
         clear_bit(X86_FEATURE_SVM, regs[2]);
         clear_bit(X86_FEATURE_OSVW, regs[2]);
@@ -561,7 +567,7 @@ static int xc_cpuid_policy(
     if ( info.hvm )
         xc_cpuid_hvm_policy(xch, domid, input, regs);
     else
-        xc_cpuid_pv_policy(xch, domid, input, regs);
+        xc_cpuid_pv_policy(xch, domid, input, regs, info.pvh);
 
     return 0;
 }
tools/libxc/xc_domain.c +0 -0
index c2fdd74..f12999a 100644
@@ -316,6 +316,7 @@ int xc_domain_getinfo(xc_interface *xch,
         info->running

= !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_running); info->hvm = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest); info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged);
+ info->pvh

= !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_pvh_guest); 
         info->shutdown_reason =
             (domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift)

& diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 13f816b..77d219a 100644

tools/libxc/xenctrl.h +1 -1
@@ -404,7 +404,7 @@ typedef struct xc_dominfo {
     uint32_t      ssidref;
     unsigned int  dying:1, crashed:1, shutdown:1,
                   paused:1, blocked:1, running:1,
-                  hvm:1, debugged:1;
+                  hvm:1, debugged:1, pvh:1;
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1
 */ unsigned long nr_pages; /* current number, not maximum */
     unsigned long nr_outstanding_pages;
#8 lore raw

Re: [V0 PATCH] pvh: expose feature flags from tools for domUs

Quoted 3 lines · Mukesh Rathor

ping? I think Roger you can ack from xen-pvh side. IanC/J, I guess one of you need to ack from tool side?

The mechanical bits of the tools side look OK, I'll leave it to others to ack the actual bits you are setting/clearing.

Quoted 1 line

Again this for 4.5, and not 4.4.

Right, please ping/resend once 4.5 opens.

Ian.

#9 lore raw

Re: [V0 PATCH] pvh: expose feature flags from tools for domUs

In reply to Mukesh Rathor
Quoted 3 lines · Mukesh Rathor

Expose features for pvh domUs from tools.

The flags exposed for PVH by this patch look fine to me, but I've been wondering if it would be easier to use xc_cpuid_hvm_policy for PVH and just mask MTRR.

Roger.