xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo
@ 2016-07-15 16:57 Andrew Cooper
  2016-07-18 15:26 ` Wei Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Cooper @ 2016-07-15 16:57 UTC (permalink / raw)
  To: Xen-devel
  Cc: Stefano Stabellini, Wei Liu, Andrew Cooper, Ian Jackson,
	Julien Grall, Jan Beulich

This allows a toolstack to identify whether a running domain is using hardware
assisted paging or not.

The appropriate tests differ by architecture, so introduce
arch_get_domain_info().  ARM unconditionally sets the new flag, while x86
checks with the paging subsystem first.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxc/include/xenctrl.h | 2 +-
 tools/libxc/xc_domain.c       | 1 +
 xen/arch/arm/domctl.c         | 6 ++++++
 xen/arch/x86/domctl.c         | 7 +++++++
 xen/common/domctl.c           | 2 ++
 xen/include/public/domctl.h   | 3 +++
 xen/include/xen/domain.h      | 2 ++
 7 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index e904bd5..fdc148a 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -442,7 +442,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, pvh:1, xenstore:1;
+                  hvm:1, debugged:1, pvh:1, xenstore:1, hap:1;
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
     unsigned long nr_pages; /* current number, not maximum */
     unsigned long nr_outstanding_pages;
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 050216e..296b852 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -372,6 +372,7 @@ int xc_domain_getinfo(xc_interface *xch,
         info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged);
         info->pvh      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_pvh_guest);
         info->xenstore = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_xs_domain);
+        info->hap      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hap);
 
         info->shutdown_reason =
             (domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift) &
diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index f61f98a..afa16d8 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -14,6 +14,12 @@
 #include <xsm/xsm.h>
 #include <public/domctl.h>
 
+void arch_get_domain_info(const struct domain *d,
+                          struct xen_domctl_getdomaininfo *info)
+{
+    info->flags |= XEN_DOMINF_hap;
+}
+
 long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
                     XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 {
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index aedf264..08f0031 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -229,6 +229,13 @@ static void update_domain_cpuid_info(struct domain *d,
     }
 }
 
+void arch_get_domain_info(const struct domain *d,
+                          struct xen_domctl_getdomaininfo *info)
+{
+    if ( paging_mode_enabled(d) && paging_mode_hap(d) )
+        info->flags |= XEN_DOMINF_hap;
+}
+
 #define MAX_IOPORTS 0x10000
 
 long arch_do_domctl(
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index b784e6c..c827963 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -215,6 +215,8 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
     info->cpupool = d->cpupool ? d->cpupool->cpupool_id : CPUPOOLID_NONE;
 
     memcpy(info->handle, d->handle, sizeof(xen_domain_handle_t));
+
+    arch_get_domain_info(d, info);
 }
 
 static unsigned int default_vcpu0_location(cpumask_t *online)
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index d6d2319..ddd3de4 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -103,6 +103,9 @@ struct xen_domctl_getdomaininfo {
 /* domain is a xenstore domain */
 #define _XEN_DOMINF_xs_domain 8
 #define XEN_DOMINF_xs_domain  (1U<<_XEN_DOMINF_xs_domain)
+/* domain has hardware assisted paging */
+#define _XEN_DOMINF_hap       9
+#define XEN_DOMINF_hap        (1U<<_XEN_DOMINF_hap)
  /* XEN_DOMINF_shutdown guest-supplied code.  */
 #define XEN_DOMINF_shutdownmask 255
 #define XEN_DOMINF_shutdownshift 16
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index a1a6f25..bce0ea1 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -18,6 +18,8 @@ int vcpu_reset(struct vcpu *);
 
 struct xen_domctl_getdomaininfo;
 void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info);
+void arch_get_domain_info(const struct domain *d,
+                          struct xen_domctl_getdomaininfo *info);
 
 /*
  * Arch-specifics.
-- 
2.1.4


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

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

* Re: [PATCH] xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo
  2016-07-15 16:57 [PATCH] xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo Andrew Cooper
@ 2016-07-18 15:26 ` Wei Liu
  2016-07-20 11:38 ` Julien Grall
  2016-07-27 11:01 ` George Dunlap
  2 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2016-07-18 15:26 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Stefano Stabellini, Wei Liu, Ian Jackson, Xen-devel,
	Julien Grall, Jan Beulich

On Fri, Jul 15, 2016 at 05:57:45PM +0100, Andrew Cooper wrote:
> This allows a toolstack to identify whether a running domain is using hardware
> assisted paging or not.
> 
> The appropriate tests differ by architecture, so introduce
> arch_get_domain_info().  ARM unconditionally sets the new flag, while x86
> checks with the paging subsystem first.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien.grall@arm.com>
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> ---
>  tools/libxc/include/xenctrl.h | 2 +-
>  tools/libxc/xc_domain.c       | 1 +

Subject to acks from x86 and ARM maintainers:

Acked-by: Wei Liu <wei.liu2@citrix.com>

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

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

* Re: [PATCH] xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo
  2016-07-15 16:57 [PATCH] xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo Andrew Cooper
  2016-07-18 15:26 ` Wei Liu
@ 2016-07-20 11:38 ` Julien Grall
  2016-07-27 11:01 ` George Dunlap
  2 siblings, 0 replies; 4+ messages in thread
From: Julien Grall @ 2016-07-20 11:38 UTC (permalink / raw)
  To: Andrew Cooper, Xen-devel
  Cc: Ian Jackson, Stefano Stabellini, Wei Liu, Jan Beulich

Hi Andrew,

On 15/07/16 17:57, Andrew Cooper wrote:
> diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
> index f61f98a..afa16d8 100644
> --- a/xen/arch/arm/domctl.c
> +++ b/xen/arch/arm/domctl.c
> @@ -14,6 +14,12 @@
>  #include <xsm/xsm.h>
>  #include <public/domctl.h>
>
> +void arch_get_domain_info(const struct domain *d,
> +                          struct xen_domctl_getdomaininfo *info)
> +{
> +    info->flags |= XEN_DOMINF_hap;
> +}
> +

The ARM change looks good to me. I have just one request, would be it 
possible to add a comment in the code explaining why hap is 
unconditionally set? (I.e domains are always using hap on ARM).

With that:

Reviewed-by: Julien Grall <julien.grall@arm.com>

>  long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
>                      XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
>  {

Regards,

-- 
Julien Grall

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

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

* Re: [PATCH] xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo
  2016-07-15 16:57 [PATCH] xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo Andrew Cooper
  2016-07-18 15:26 ` Wei Liu
  2016-07-20 11:38 ` Julien Grall
@ 2016-07-27 11:01 ` George Dunlap
  2 siblings, 0 replies; 4+ messages in thread
From: George Dunlap @ 2016-07-27 11:01 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Stefano Stabellini, Wei Liu, Ian Jackson, Xen-devel,
	Julien Grall, Jan Beulich

On Fri, Jul 15, 2016 at 5:57 PM, Andrew Cooper
<andrew.cooper3@citrix.com> wrote:
> This allows a toolstack to identify whether a running domain is using hardware
> assisted paging or not.
>
> The appropriate tests differ by architecture, so introduce
> arch_get_domain_info().  ARM unconditionally sets the new flag, while x86
> checks with the paging subsystem first.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

For THE REST:

Reviewed-by: George Dunlap <george.dunlap@citrix.com>

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

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

end of thread, other threads:[~2016-07-27 11:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-15 16:57 [PATCH] xen/domctl: Add DOMINFO_hap to xen_domctl_getdomaininfo Andrew Cooper
2016-07-18 15:26 ` Wei Liu
2016-07-20 11:38 ` Julien Grall
2016-07-27 11:01 ` George Dunlap

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).