xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH v2 0/6] stash domain create flags and then use them
@ 2019-07-25 13:39 Paul Durrant
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain Paul Durrant
                   ` (5 more replies)
  0 siblings, 6 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-25 13:39 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Paul Durrant, Jan Beulich, Shane Wang,
	Daniel De Graaf, Gang Wei, Roger Pau Monné

This series starts with a patch to stash the domain create flags in struct
domain then then follows up with various clean-up patches that this
enables.

Paul Durrant (6):
  domain: stash xen_domctl_createdomain flags in struct domain
  domain: remove 'guest_type' field (and enum guest_type)
  x86/hvm/domain: remove the 'hap_enabled' flag
  x86/domain: remove the 'oos_off' flag
  domain: remove the 'is_xenstore' flag
  x86/domain: remove the 's3_integrity' flag

 xen/arch/x86/domain.c            |  9 +--------
 xen/arch/x86/mm/paging.c         |  4 ++--
 xen/arch/x86/mm/shadow/common.c  |  5 ++---
 xen/arch/x86/mm/shadow/none.c    |  2 +-
 xen/arch/x86/tboot.c             |  2 +-
 xen/common/domain.c              | 15 +++++----------
 xen/common/domctl.c              | 12 ++----------
 xen/common/kernel.c              |  9 ++-------
 xen/include/asm-x86/domain.h     |  3 ---
 xen/include/asm-x86/hvm/domain.h |  9 +++------
 xen/include/asm-x86/paging.h     |  2 +-
 xen/include/asm-x86/shadow.h     |  2 +-
 xen/include/xen/sched.h          | 22 ++++++++++------------
 xen/include/xsm/dummy.h          |  2 +-
 14 files changed, 32 insertions(+), 66 deletions(-)
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: Gang Wei <gang.wei@intel.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Shane Wang <shane.wang@intel.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wl@xen.org>
-- 
2.20.1.2.gb21ebb671


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

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

* [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain
  2019-07-25 13:39 [Xen-devel] [PATCH v2 0/6] stash domain create flags and then use them Paul Durrant
@ 2019-07-25 13:39 ` Paul Durrant
  2019-07-29  9:20   ` George Dunlap
                     ` (2 more replies)
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 2/6] domain: remove 'guest_type' field (and enum guest_type) Paul Durrant
                   ` (4 subsequent siblings)
  5 siblings, 3 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-25 13:39 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Paul Durrant, Jan Beulich

These are canonical source of data used to set various other flags. If
they are available directly in struct domain then the other flags are no
longer needed.

This patch simply copies the flags into a new 'options' field in
struct domain. Subsequent patches will do the related clean-up work.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wl@xen.org>

v2:
 - Rename 'createflags' to 'options'
---
 xen/common/domain.c     | 6 ++++--
 xen/include/xen/sched.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index bc56a51815..eef486af05 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -331,6 +331,8 @@ struct domain *domain_create(domid_t domid,
     if ( (d = alloc_domain_struct()) == NULL )
         return ERR_PTR(-ENOMEM);
 
+    d->options = config ? config->flags : 0;
+
     /* Sort out our idea of is_system_domain(). */
     d->domain_id = domid;
 
@@ -352,7 +354,7 @@ struct domain *domain_create(domid_t domid,
     }
 
     /* Sort out our idea of is_{pv,hvm}_domain().  All system domains are PV. */
-    d->guest_type = ((config && (config->flags & XEN_DOMCTL_CDF_hvm_guest))
+    d->guest_type = ((d->options & XEN_DOMCTL_CDF_hvm_guest)
                      ? guest_type_hvm : guest_type_pv);
 
     TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id);
@@ -429,7 +431,7 @@ struct domain *domain_create(domid_t domid,
         watchdog_domain_init(d);
         init_status |= INIT_watchdog;
 
-        if ( config->flags & XEN_DOMCTL_CDF_xs_domain )
+        if ( d->options & XEN_DOMCTL_CDF_xs_domain )
         {
             d->is_xenstore = 1;
             d->disable_migrate = 1;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index c197e93d73..cff2990b10 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -306,6 +306,7 @@ enum guest_type {
 
 struct domain
 {
+    unsigned int     options;         /* copy of createdomain flags */
     domid_t          domain_id;
 
     unsigned int     max_vcpus;
-- 
2.20.1.2.gb21ebb671


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

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

* [Xen-devel] [PATCH v2 2/6] domain: remove 'guest_type' field (and enum guest_type)
  2019-07-25 13:39 [Xen-devel] [PATCH v2 0/6] stash domain create flags and then use them Paul Durrant
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain Paul Durrant
@ 2019-07-25 13:39 ` Paul Durrant
  2019-07-29  9:21   ` George Dunlap
  2019-07-29 14:27   ` Jan Beulich
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag Paul Durrant
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-25 13:39 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Paul Durrant, Jan Beulich, Roger Pau Monné

The enum guest_type was introduced in commit 6c6492780ea "pvh prep:
introduce pv guest type and has_hvm_container macros" to allow a new guest
type, distinct from either PV or HVM guest types, to be added in commit
8271d6522c6 "pvh: introduce PVH guest type". Subsequently, commit
33e5c32559e "x86: remove PVHv1 code" removed this third guest type.

This patch removes the struct domain field and enumeration as the guest
type can now be trivially determined from the 'options' field.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wl@xen.org>
---
 xen/common/domain.c     |  4 ----
 xen/common/domctl.c     | 10 +---------
 xen/common/kernel.c     |  9 ++-------
 xen/include/xen/sched.h | 14 ++++----------
 4 files changed, 7 insertions(+), 30 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index eef486af05..6ee281bd03 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -353,10 +353,6 @@ struct domain *domain_create(domid_t domid,
         hardware_domain = d;
     }
 
-    /* Sort out our idea of is_{pv,hvm}_domain().  All system domains are PV. */
-    d->guest_type = ((d->options & XEN_DOMCTL_CDF_hvm_guest)
-                     ? guest_type_hvm : guest_type_pv);
-
     TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id);
 
     /*
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 72a44953d0..ef6714c0aa 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -187,17 +187,9 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
         (d->controller_pause_count > 0  ? XEN_DOMINF_paused    : 0) |
         (d->debugger_attached           ? XEN_DOMINF_debugged  : 0) |
         (d->is_xenstore                 ? XEN_DOMINF_xs_domain : 0) |
+        (is_hvm_domain(d)               ? XEN_DOMINF_hvm_guest : 0) |
         d->shutdown_code << XEN_DOMINF_shutdownshift;
 
-    switch ( d->guest_type )
-    {
-    case guest_type_hvm:
-        info->flags |= XEN_DOMINF_hvm_guest;
-        break;
-    default:
-        break;
-    }
-
     xsm_security_domaininfo(d, info);
 
     info->tot_pages         = d->tot_pages;
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 612575430f..f7628d73ce 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -474,19 +474,14 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             fi.submap |= (1U << XENFEAT_ARM_SMCCC_supported);
 #endif
 #ifdef CONFIG_X86
-            switch ( d->guest_type )
-            {
-            case guest_type_pv:
+            if ( is_pv_domain(d) )
                 fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) |
                              (1U << XENFEAT_highmem_assist) |
                              (1U << XENFEAT_gnttab_map_avail_bits);
-                break;
-            case guest_type_hvm:
+            else
                 fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) |
                              (1U << XENFEAT_hvm_callback_vector) |
                              (has_pirq(d) ? (1U << XENFEAT_hvm_pirqs) : 0);
-                break;
-            }
 #endif
             break;
         default:
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index cff2990b10..aa09d2c574 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -300,10 +300,6 @@ struct vm_event_domain
 
 struct evtchn_port_ops;
 
-enum guest_type {
-    guest_type_pv, guest_type_hvm
-};
-
 struct domain
 {
     unsigned int     options;         /* copy of createdomain flags */
@@ -355,8 +351,6 @@ struct domain
     struct radix_tree_root pirq_tree;
     unsigned int     nr_pirqs;
 
-    enum guest_type guest_type;
-
     /* Is this guest dying (i.e., a zombie)? */
     enum { DOMDYING_alive, DOMDYING_dying, DOMDYING_dead } is_dying;
 
@@ -916,8 +910,8 @@ void watchdog_domain_destroy(struct domain *d);
 
 static inline bool is_pv_domain(const struct domain *d)
 {
-    return IS_ENABLED(CONFIG_PV)
-           ? evaluate_nospec(d->guest_type == guest_type_pv) : false;
+    return IS_ENABLED(CONFIG_PV) &&
+        !evaluate_nospec(d->options & XEN_DOMCTL_CDF_hvm_guest);
 }
 
 static inline bool is_pv_vcpu(const struct vcpu *v)
@@ -948,8 +942,8 @@ static inline bool is_pv_64bit_vcpu(const struct vcpu *v)
 #endif
 static inline bool is_hvm_domain(const struct domain *d)
 {
-    return IS_ENABLED(CONFIG_HVM)
-           ? evaluate_nospec(d->guest_type == guest_type_hvm) : false;
+    return IS_ENABLED(CONFIG_HVM) &&
+        evaluate_nospec(d->options & XEN_DOMCTL_CDF_hvm_guest);
 }
 
 static inline bool is_hvm_vcpu(const struct vcpu *v)
-- 
2.20.1.2.gb21ebb671


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

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

* [Xen-devel] [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag
  2019-07-25 13:39 [Xen-devel] [PATCH v2 0/6] stash domain create flags and then use them Paul Durrant
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain Paul Durrant
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 2/6] domain: remove 'guest_type' field (and enum guest_type) Paul Durrant
@ 2019-07-25 13:39 ` Paul Durrant
  2019-07-29  9:26   ` Roger Pau Monné
  2019-07-29 14:35   ` Jan Beulich
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag Paul Durrant
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-25 13:39 UTC (permalink / raw)
  To: xen-devel
  Cc: Andrew Cooper, Paul Durrant, Wei Liu, Jan Beulich, Roger Pau Monné

The hap_enabled() macro can determine whether the feature is available
using the domain 'options'; there is no need for a separate flag.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>

v2:
 - Defer changes to shadow_domain_init() to patch #4
---
 xen/arch/x86/domain.c            | 7 +------
 xen/arch/x86/mm/paging.c         | 4 ++--
 xen/include/asm-x86/hvm/domain.h | 9 +++------
 xen/include/asm-x86/paging.h     | 2 +-
 4 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index ea55160887..65f47a7627 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -564,12 +564,7 @@ int arch_domain_create(struct domain *d,
     HYPERVISOR_COMPAT_VIRT_START(d) =
         is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u;
 
-    /* Need to determine if HAP is enabled before initialising paging */
-    if ( is_hvm_domain(d) )
-        d->arch.hvm.hap_enabled =
-            hvm_hap_supported() && (config->flags & XEN_DOMCTL_CDF_hap);
-
-    if ( (rc = paging_domain_init(d, config->flags)) != 0 )
+    if ( (rc = paging_domain_init(d)) != 0 )
         goto fail;
     paging_initialised = true;
 
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 011089368a..097a27f608 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -632,7 +632,7 @@ void paging_log_dirty_init(struct domain *d, const struct log_dirty_ops *ops)
 /*           CODE FOR PAGING SUPPORT            */
 /************************************************/
 /* Domain paging struct initialization. */
-int paging_domain_init(struct domain *d, unsigned int domcr_flags)
+int paging_domain_init(struct domain *d)
 {
     int rc;
 
@@ -653,7 +653,7 @@ int paging_domain_init(struct domain *d, unsigned int domcr_flags)
     if ( hap_enabled(d) )
         hap_domain_init(d);
     else
-        rc = shadow_domain_init(d, domcr_flags);
+        rc = shadow_domain_init(d, d->options);
 
     return rc;
 }
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index 6c7c4f5aa6..7897e36b94 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -156,7 +156,6 @@ struct hvm_domain {
 
     struct viridian_domain *viridian;
 
-    bool_t                 hap_enabled;
     bool_t                 mem_sharing_enabled;
     bool_t                 qemu_mapcache_invalidate;
     bool_t                 is_s3_suspended;
@@ -195,11 +194,9 @@ struct hvm_domain {
     };
 };
 
-#ifdef CONFIG_HVM
-#define hap_enabled(d)  (is_hvm_domain(d) && (d)->arch.hvm.hap_enabled)
-#else
-#define hap_enabled(d)  ({(void)(d); false;})
-#endif
+#define hap_enabled(d) \
+    (hvm_hap_supported() && is_hvm_domain(d) && \
+     evaluate_nospec(d->options & XEN_DOMCTL_CDF_hap))
 
 #endif /* __ASM_X86_HVM_DOMAIN_H__ */
 
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index cf57ca708d..ab7887f23c 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -207,7 +207,7 @@ void paging_vcpu_init(struct vcpu *v);
 
 /* Set up the paging-assistance-specific parts of a domain struct at
  * start of day.  Called for every domain from arch_domain_create() */
-int paging_domain_init(struct domain *d, unsigned int domcr_flags);
+int paging_domain_init(struct domain *d);
 
 /* Handler for paging-control ops: operations from user-space to enable
  * and disable ephemeral shadow modes (test mode and log-dirty mode) and
-- 
2.20.1.2.gb21ebb671


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

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

* [Xen-devel] [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag
  2019-07-25 13:39 [Xen-devel] [PATCH v2 0/6] stash domain create flags and then use them Paul Durrant
                   ` (2 preceding siblings ...)
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag Paul Durrant
@ 2019-07-25 13:39 ` Paul Durrant
  2019-07-29  9:21   ` George Dunlap
  2019-07-29 15:13   ` Jan Beulich
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 5/6] domain: remove the 'is_xenstore' flag Paul Durrant
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 6/6] x86/domain: remove the 's3_integrity' flag Paul Durrant
  5 siblings, 2 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-25 13:39 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, George Dunlap, Andrew Cooper, Tim Deegan, Paul Durrant,
	Jan Beulich, Roger Pau Monné

The flag is not needed since the domain 'options' can now be tested
directly.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>

v2:
 - Move some of the hunks from patch #3
 - Also update the definition of shadow_domain_init() in none.c
---
 xen/arch/x86/mm/paging.c        | 2 +-
 xen/arch/x86/mm/shadow/common.c | 5 ++---
 xen/arch/x86/mm/shadow/none.c   | 2 +-
 xen/include/asm-x86/domain.h    | 1 -
 xen/include/asm-x86/shadow.h    | 2 +-
 5 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 097a27f608..69aa228e46 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -653,7 +653,7 @@ int paging_domain_init(struct domain *d)
     if ( hap_enabled(d) )
         hap_domain_init(d);
     else
-        rc = shadow_domain_init(d, d->options);
+        rc = shadow_domain_init(d);
 
     return rc;
 }
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index fa18de0bb6..911d91e502 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -46,7 +46,7 @@ static void sh_clean_dirty_bitmap(struct domain *);
 
 /* Set up the shadow-specific parts of a domain struct at start of day.
  * Called for every domain from arch_domain_create() */
-int shadow_domain_init(struct domain *d, unsigned int domcr_flags)
+int shadow_domain_init(struct domain *d)
 {
     static const struct log_dirty_ops sh_ops = {
         .enable  = sh_enable_log_dirty,
@@ -62,7 +62,6 @@ int shadow_domain_init(struct domain *d, unsigned int domcr_flags)
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
     d->arch.paging.shadow.oos_active = 0;
-    d->arch.paging.shadow.oos_off = domcr_flags & XEN_DOMCTL_CDF_oos_off;
 #endif
     d->arch.paging.shadow.pagetable_dying_op = 0;
 
@@ -2523,7 +2522,7 @@ static void sh_update_paging_modes(struct vcpu *v)
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
     /* We need to check that all the vcpus have paging enabled to
      * unsync PTs. */
-    if ( is_hvm_domain(d) && !d->arch.paging.shadow.oos_off )
+    if ( is_hvm_domain(d) && !(d->options & XEN_DOMCTL_CDF_oos_off) )
     {
         int pe = 1;
         struct vcpu *vptr;
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
index a70888bd98..2fddf4274c 100644
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -18,7 +18,7 @@ static void _clean_dirty_bitmap(struct domain *d)
     ASSERT(is_pv_domain(d));
 }
 
-int shadow_domain_init(struct domain *d, unsigned int domcr_flags)
+int shadow_domain_init(struct domain *d)
 {
     static const struct log_dirty_ops sh_none_ops = {
         .enable  = _enable_log_dirty,
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 933b85901f..5f9899469c 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -115,7 +115,6 @@ struct shadow_domain {
 
     /* OOS */
     bool_t oos_active;
-    bool_t oos_off;
 
     /* Has this domain ever used HVMOP_pagetable_dying? */
     bool_t pagetable_dying_op;
diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h
index f29f0f652b..8ebb89c027 100644
--- a/xen/include/asm-x86/shadow.h
+++ b/xen/include/asm-x86/shadow.h
@@ -49,7 +49,7 @@
 
 /* Set up the shadow-specific parts of a domain struct at start of day.
  * Called from paging_domain_init(). */
-int shadow_domain_init(struct domain *d, unsigned int domcr_flags);
+int shadow_domain_init(struct domain *d);
 
 /* Setup the shadow-specific parts of a vcpu struct. It is called by
  * paging_vcpu_init() in paging.c */
-- 
2.20.1.2.gb21ebb671


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

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

* [Xen-devel] [PATCH v2 5/6] domain: remove the 'is_xenstore' flag
  2019-07-25 13:39 [Xen-devel] [PATCH v2 0/6] stash domain create flags and then use them Paul Durrant
                   ` (3 preceding siblings ...)
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag Paul Durrant
@ 2019-07-25 13:39 ` Paul Durrant
  2019-07-29  9:22   ` George Dunlap
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 6/6] x86/domain: remove the 's3_integrity' flag Paul Durrant
  5 siblings, 1 reply; 24+ messages in thread
From: Paul Durrant @ 2019-07-25 13:39 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Paul Durrant, Jan Beulich, Daniel De Graaf,
	Roger Pau Monné

This patch introduces a convenience macro, is_xenstore_domain(), which
tests the domain 'options' directly and then uses that in place of
the 'is_xenstore' flag.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wl@xen.org>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>

v2:
 - Set 'disable_migrate' to true rather 1
---
 xen/common/domain.c     | 9 +++------
 xen/common/domctl.c     | 2 +-
 xen/include/xen/sched.h | 7 +++++--
 xen/include/xsm/dummy.h | 2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 6ee281bd03..9db7cbae72 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -348,7 +348,7 @@ struct domain *domain_create(domid_t domid,
         if ( hardware_domid < 0 || hardware_domid >= DOMID_FIRST_RESERVED )
             panic("The value of hardware_dom must be a valid domain ID\n");
 
-        d->disable_migrate = 1;
+        d->disable_migrate = true;
         old_hwdom = hardware_domain;
         hardware_domain = d;
     }
@@ -427,11 +427,8 @@ struct domain *domain_create(domid_t domid,
         watchdog_domain_init(d);
         init_status |= INIT_watchdog;
 
-        if ( d->options & XEN_DOMCTL_CDF_xs_domain )
-        {
-            d->is_xenstore = 1;
-            d->disable_migrate = 1;
-        }
+        if ( is_xenstore_domain(d) )
+            d->disable_migrate = true;
 
         d->iomem_caps = rangeset_new(d, "I/O Memory", RANGESETF_prettyprint_hex);
         d->irq_caps   = rangeset_new(d, "Interrupts", 0);
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index ef6714c0aa..f2b582812c 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -186,7 +186,7 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
         (d->is_shut_down                ? XEN_DOMINF_shutdown  : 0) |
         (d->controller_pause_count > 0  ? XEN_DOMINF_paused    : 0) |
         (d->debugger_attached           ? XEN_DOMINF_debugged  : 0) |
-        (d->is_xenstore                 ? XEN_DOMINF_xs_domain : 0) |
+        (is_xenstore_domain(d)          ? XEN_DOMINF_xs_domain : 0) |
         (is_hvm_domain(d)               ? XEN_DOMINF_hvm_guest : 0) |
         d->shutdown_code << XEN_DOMINF_shutdownshift;
 
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index aa09d2c574..973998b288 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -372,8 +372,6 @@ struct domain
     bool             is_privileged;
     /* Can this guest access the Xen console? */
     bool             is_console;
-    /* Is this a xenstore domain (not dom0)? */
-    bool             is_xenstore;
     /* Non-migratable and non-restoreable? */
     bool             disable_migrate;
     /* Is this guest being debugged by dom0? */
@@ -970,6 +968,11 @@ static inline bool is_vcpu_online(const struct vcpu *v)
     return !test_bit(_VPF_down, &v->pause_flags);
 }
 
+static inline bool is_xenstore_domain(const struct domain *d)
+{
+    return d->options & XEN_DOMCTL_CDF_xs_domain;
+}
+
 extern bool sched_smt_power_savings;
 
 extern enum cpufreq_controller {
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index ef52bb1764..b8e185e6fa 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -79,7 +79,7 @@ static always_inline int xsm_default_action(
         {
             return 0;
     case XSM_XS_PRIV:
-            if ( src->is_xenstore )
+            if ( is_xenstore_domain(src) )
                 return 0;
         }
         /* fall through */
-- 
2.20.1.2.gb21ebb671


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

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

* [Xen-devel] [PATCH v2 6/6] x86/domain: remove the 's3_integrity' flag
  2019-07-25 13:39 [Xen-devel] [PATCH v2 0/6] stash domain create flags and then use them Paul Durrant
                   ` (4 preceding siblings ...)
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 5/6] domain: remove the 'is_xenstore' flag Paul Durrant
@ 2019-07-25 13:39 ` Paul Durrant
  2019-07-29 15:21   ` Jan Beulich
  5 siblings, 1 reply; 24+ messages in thread
From: Paul Durrant @ 2019-07-25 13:39 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, Andrew Cooper, Paul Durrant, Jan Beulich, Shane Wang,
	Gang Wei, Roger Pau Monné

The flag is not needed since the domain 'options' can now be tested
directly.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: Gang Wei <gang.wei@intel.com>
Cc: Shane Wang <shane.wang@intel.com>
---
 xen/arch/x86/domain.c        | 2 --
 xen/arch/x86/tboot.c         | 2 +-
 xen/include/asm-x86/domain.h | 2 --
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 65f47a7627..2203882445 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -538,8 +538,6 @@ int arch_domain_create(struct domain *d,
                d->domain_id);
     }
 
-    d->arch.s3_integrity = config->flags & XEN_DOMCTL_CDF_s3_integrity;
-
     emflags = config->arch.emulation_flags;
 
     if ( is_hardware_domain(d) && is_pv_domain(d) )
diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index f3fdee4d39..3db8a8a8d8 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -212,7 +212,7 @@ static void tboot_gen_domain_integrity(const uint8_t key[TB_KEY_SIZE],
     vmac_set_key((uint8_t *)key, &ctx);
     for_each_domain( d )
     {
-        if ( !d->arch.s3_integrity )
+        if ( !(d->options & XEN_DOMCTL_CDF_s3_integrity) )
             continue;
         printk("MACing Domain %u\n", d->domain_id);
 
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 5f9899469c..5c038a1065 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -295,8 +295,6 @@ struct arch_domain
     uint32_t pci_cf8;
     uint8_t cmos_idx;
 
-    bool_t s3_integrity;
-
     union {
         struct pv_domain pv;
         struct hvm_domain hvm;
-- 
2.20.1.2.gb21ebb671


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

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

* Re: [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain Paul Durrant
@ 2019-07-29  9:20   ` George Dunlap
  2019-07-29  9:24   ` Roger Pau Monné
  2019-07-30  9:17   ` Jan Beulich
  2 siblings, 0 replies; 24+ messages in thread
From: George Dunlap @ 2019-07-29  9:20 UTC (permalink / raw)
  To: Paul Durrant, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich

On 7/25/19 2:39 PM, Paul Durrant wrote:
> These are canonical source of data used to set various other flags. If
> they are available directly in struct domain then the other flags are no
> longer needed.
> 
> This patch simply copies the flags into a new 'options' field in
> struct domain. Subsequent patches will do the related clean-up work.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>

This looks great, thanks:

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

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

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

* Re: [Xen-devel] [PATCH v2 2/6] domain: remove 'guest_type' field (and enum guest_type)
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 2/6] domain: remove 'guest_type' field (and enum guest_type) Paul Durrant
@ 2019-07-29  9:21   ` George Dunlap
  2019-07-29 14:27   ` Jan Beulich
  1 sibling, 0 replies; 24+ messages in thread
From: George Dunlap @ 2019-07-29  9:21 UTC (permalink / raw)
  To: Paul Durrant, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Roger Pau Monné

On 7/25/19 2:39 PM, Paul Durrant wrote:
> The enum guest_type was introduced in commit 6c6492780ea "pvh prep:
> introduce pv guest type and has_hvm_container macros" to allow a new guest
> type, distinct from either PV or HVM guest types, to be added in commit
> 8271d6522c6 "pvh: introduce PVH guest type". Subsequently, commit
> 33e5c32559e "x86: remove PVHv1 code" removed this third guest type.
> 
> This patch removes the struct domain field and enumeration as the guest
> type can now be trivially determined from the 'options' field.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>

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

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

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

* Re: [Xen-devel] [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag Paul Durrant
@ 2019-07-29  9:21   ` George Dunlap
  2019-07-29 15:13   ` Jan Beulich
  1 sibling, 0 replies; 24+ messages in thread
From: George Dunlap @ 2019-07-29  9:21 UTC (permalink / raw)
  To: Paul Durrant, xen-devel
  Cc: Wei Liu, George Dunlap, Andrew Cooper, Tim Deegan, Jan Beulich,
	Roger Pau Monné

On 7/25/19 2:39 PM, Paul Durrant wrote:
> The flag is not needed since the domain 'options' can now be tested
> directly.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> Acked-by: Tim Deegan <tim@xen.org>

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

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

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

* Re: [Xen-devel] [PATCH v2 5/6] domain: remove the 'is_xenstore' flag
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 5/6] domain: remove the 'is_xenstore' flag Paul Durrant
@ 2019-07-29  9:22   ` George Dunlap
  0 siblings, 0 replies; 24+ messages in thread
From: George Dunlap @ 2019-07-29  9:22 UTC (permalink / raw)
  To: Paul Durrant, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Daniel De Graaf, Roger Pau Monné

On 7/25/19 2:39 PM, Paul Durrant wrote:
> This patch introduces a convenience macro, is_xenstore_domain(), which
> tests the domain 'options' directly and then uses that in place of
> the 'is_xenstore' flag.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>

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

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

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

* Re: [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain Paul Durrant
  2019-07-29  9:20   ` George Dunlap
@ 2019-07-29  9:24   ` Roger Pau Monné
  2019-07-30  9:17   ` Jan Beulich
  2 siblings, 0 replies; 24+ messages in thread
From: Roger Pau Monné @ 2019-07-29  9:24 UTC (permalink / raw)
  To: Paul Durrant
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, xen-devel

On Thu, Jul 25, 2019 at 02:39:15PM +0100, Paul Durrant wrote:
> These are canonical source of data used to set various other flags. If
> they are available directly in struct domain then the other flags are no
> longer needed.
> 
> This patch simply copies the flags into a new 'options' field in
> struct domain. Subsequent patches will do the related clean-up work.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks.

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

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

* Re: [Xen-devel] [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag Paul Durrant
@ 2019-07-29  9:26   ` Roger Pau Monné
  2019-07-29 14:35   ` Jan Beulich
  1 sibling, 0 replies; 24+ messages in thread
From: Roger Pau Monné @ 2019-07-29  9:26 UTC (permalink / raw)
  To: Paul Durrant; +Cc: xen-devel, Wei Liu, Jan Beulich, Andrew Cooper

On Thu, Jul 25, 2019 at 02:39:17PM +0100, Paul Durrant wrote:
> The hap_enabled() macro can determine whether the feature is available
> using the domain 'options'; there is no need for a separate flag.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.

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

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

* Re: [Xen-devel] [PATCH v2 2/6] domain: remove 'guest_type' field (and enum guest_type)
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 2/6] domain: remove 'guest_type' field (and enum guest_type) Paul Durrant
  2019-07-29  9:21   ` George Dunlap
@ 2019-07-29 14:27   ` Jan Beulich
  1 sibling, 0 replies; 24+ messages in thread
From: Jan Beulich @ 2019-07-29 14:27 UTC (permalink / raw)
  To: Paul Durrant
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, TimDeegan,
	Julien Grall, xen-devel, Roger Pau Monné

On 25.07.2019 15:39, Paul Durrant wrote:
> @@ -916,8 +910,8 @@ void watchdog_domain_destroy(struct domain *d);
>   
>   static inline bool is_pv_domain(const struct domain *d)
>   {
> -    return IS_ENABLED(CONFIG_PV)
> -           ? evaluate_nospec(d->guest_type == guest_type_pv) : false;
> +    return IS_ENABLED(CONFIG_PV) &&
> +        !evaluate_nospec(d->options & XEN_DOMCTL_CDF_hvm_guest);

I think the ! should move inside evaluate_nospec(). With this (which
can be easily done while committing, if no other need for a v3 arises)

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag Paul Durrant
  2019-07-29  9:26   ` Roger Pau Monné
@ 2019-07-29 14:35   ` Jan Beulich
  2019-07-29 15:00     ` Paul Durrant
  1 sibling, 1 reply; 24+ messages in thread
From: Jan Beulich @ 2019-07-29 14:35 UTC (permalink / raw)
  To: Paul Durrant; +Cc: xen-devel, Roger Pau Monné, Wei Liu, Andrew Cooper

On 25.07.2019 15:39, Paul Durrant wrote:
> @@ -195,11 +194,9 @@ struct hvm_domain {
>       };
>   };
>   
> -#ifdef CONFIG_HVM
> -#define hap_enabled(d)  (is_hvm_domain(d) && (d)->arch.hvm.hap_enabled)
> -#else
> -#define hap_enabled(d)  ({(void)(d); false;})
> -#endif
> +#define hap_enabled(d) \
> +    (hvm_hap_supported() && is_hvm_domain(d) && \
> +     evaluate_nospec(d->options & XEN_DOMCTL_CDF_hap))

Rather than adding yet another && here I think you want to
reject XEN_DOMCTL_CDF_hap in arch_sanitise_domain_config()
when !hvm_hap_supported(). Similarly the is_hvm_domain()
could then also be eliminated by checking that CDF_hap is
set only together with CDF_hvm (or by clearing CDF_hap if
CDF_hvm is clear - depends on what compatibility needs
there are.

This would then also eliminate the double evaluation of
"d".

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag
  2019-07-29 14:35   ` Jan Beulich
@ 2019-07-29 15:00     ` Paul Durrant
  0 siblings, 0 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-29 15:00 UTC (permalink / raw)
  To: 'Jan Beulich'; +Cc: xen-devel, Roger Pau Monne, Wei Liu, Andrew Cooper

> -----Original Message-----
> From: Jan Beulich <JBeulich@suse.com>
> Sent: 29 July 2019 15:36
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: xen-devel@lists.xenproject.org; Andrew Cooper <Andrew.Cooper3@citrix.com>; Roger Pau Monne
> <roger.pau@citrix.com>; Wei Liu <wl@xen.org>
> Subject: Re: [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag
> 
> On 25.07.2019 15:39, Paul Durrant wrote:
> > @@ -195,11 +194,9 @@ struct hvm_domain {
> >       };
> >   };
> >
> > -#ifdef CONFIG_HVM
> > -#define hap_enabled(d)  (is_hvm_domain(d) && (d)->arch.hvm.hap_enabled)
> > -#else
> > -#define hap_enabled(d)  ({(void)(d); false;})
> > -#endif
> > +#define hap_enabled(d) \
> > +    (hvm_hap_supported() && is_hvm_domain(d) && \
> > +     evaluate_nospec(d->options & XEN_DOMCTL_CDF_hap))
> 
> Rather than adding yet another && here I think you want to
> reject XEN_DOMCTL_CDF_hap in arch_sanitise_domain_config()
> when !hvm_hap_supported(). Similarly the is_hvm_domain()
> could then also be eliminated by checking that CDF_hap is
> set only together with CDF_hvm (or by clearing CDF_hap if
> CDF_hvm is clear - depends on what compatibility needs
> there are.
> 
> This would then also eliminate the double evaluation of
> "d".

Oh yes, that's neater. I'll do that, and also fix up patch #2.

  Paul

> 
> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag Paul Durrant
  2019-07-29  9:21   ` George Dunlap
@ 2019-07-29 15:13   ` Jan Beulich
  2019-07-29 15:39     ` Paul Durrant
  1 sibling, 1 reply; 24+ messages in thread
From: Jan Beulich @ 2019-07-29 15:13 UTC (permalink / raw)
  To: Paul Durrant
  Cc: Wei Liu, GeorgeDunlap, Andrew Cooper, Tim Deegan, xen-devel,
	Roger Pau Monné

On 25.07.2019 15:39, Paul Durrant wrote:
> @@ -2523,7 +2522,7 @@ static void sh_update_paging_modes(struct vcpu *v)
>   #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
>       /* We need to check that all the vcpus have paging enabled to
>        * unsync PTs. */
> -    if ( is_hvm_domain(d) && !d->arch.paging.shadow.oos_off )
> +    if ( is_hvm_domain(d) && !(d->options & XEN_DOMCTL_CDF_oos_off) )

Afaics this is the only evaluation of the flag, i.e. it's HVM
specific. In which cases it should probably follow the model
outlined for patch 3, at which point the is_hvm_domain() here
becomes redundant (i.e. could be demoted to an ASSERT() inside
the if()).

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 6/6] x86/domain: remove the 's3_integrity' flag
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 6/6] x86/domain: remove the 's3_integrity' flag Paul Durrant
@ 2019-07-29 15:21   ` Jan Beulich
  2019-07-29 15:42     ` Paul Durrant
  0 siblings, 1 reply; 24+ messages in thread
From: Jan Beulich @ 2019-07-29 15:21 UTC (permalink / raw)
  To: Paul Durrant
  Cc: Wei Liu, Shane Wang, Andrew Cooper, xen-devel, Gang Wei,
	Roger Pau Monné

On 25.07.2019 15:39, Paul Durrant wrote:
> The flag is not needed since the domain 'options' can now be tested
> directly.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>

I may be asking a little much, as it's not directly related to
what you want to do here, but since TBOOT has a separate config
option, rejecting bogus use of CDF_s3_integrity again in
arch_sanitise_domain_config() would be a useful augmentation
here. If you don't want to do so, then feel free to add
Reviewed-by: Jan Beulich <jbeulich@suse.com>
on the patch as in its current shape.

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag
  2019-07-29 15:13   ` Jan Beulich
@ 2019-07-29 15:39     ` Paul Durrant
  0 siblings, 0 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-29 15:39 UTC (permalink / raw)
  To: 'Jan Beulich'
  Cc: Wei Liu, Andrew Cooper, Tim (Xen.org),
	George Dunlap, xen-devel, Roger Pau Monne

> -----Original Message-----
> From: Jan Beulich <JBeulich@suse.com>
> Sent: 29 July 2019 16:14
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: xen-devel@lists.xenproject.org; Andrew Cooper <Andrew.Cooper3@citrix.com>; Roger Pau Monne
> <roger.pau@citrix.com>; George Dunlap <George.Dunlap@citrix.com>; Tim (Xen.org) <tim@xen.org>; Wei Liu
> <wl@xen.org>
> Subject: Re: [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag
> 
> On 25.07.2019 15:39, Paul Durrant wrote:
> > @@ -2523,7 +2522,7 @@ static void sh_update_paging_modes(struct vcpu *v)
> >   #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
> >       /* We need to check that all the vcpus have paging enabled to
> >        * unsync PTs. */
> > -    if ( is_hvm_domain(d) && !d->arch.paging.shadow.oos_off )
> > +    if ( is_hvm_domain(d) && !(d->options & XEN_DOMCTL_CDF_oos_off) )
> 
> Afaics this is the only evaluation of the flag, i.e. it's HVM
> specific. In which cases it should probably follow the model
> outlined for patch 3, at which point the is_hvm_domain() here
> becomes redundant (i.e. could be demoted to an ASSERT() inside
> the if()).

Ok, I'll do that.

  Paul

> 
> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 6/6] x86/domain: remove the 's3_integrity' flag
  2019-07-29 15:21   ` Jan Beulich
@ 2019-07-29 15:42     ` Paul Durrant
  0 siblings, 0 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-29 15:42 UTC (permalink / raw)
  To: 'Jan Beulich'
  Cc: Wei Liu, Shane Wang, Andrew Cooper, xen-devel, Gang Wei, Roger Pau Monne

> -----Original Message-----
> From: Jan Beulich <JBeulich@suse.com>
> Sent: 29 July 2019 16:21
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: xen-devel@lists.xenproject.org; Andrew Cooper <Andrew.Cooper3@citrix.com>; Roger Pau Monne
> <roger.pau@citrix.com>; Gang Wei <gang.wei@intel.com>; Shane Wang <shane.wang@intel.com>; Wei Liu
> <wl@xen.org>
> Subject: Re: [PATCH v2 6/6] x86/domain: remove the 's3_integrity' flag
> 
> On 25.07.2019 15:39, Paul Durrant wrote:
> > The flag is not needed since the domain 'options' can now be tested
> > directly.
> >
> > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> > Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
> 
> I may be asking a little much, as it's not directly related to
> what you want to do here, but since TBOOT has a separate config
> option, rejecting bogus use of CDF_s3_integrity again in
> arch_sanitise_domain_config() would be a useful augmentation
> here. If you don't want to do so, then feel free to add
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> on the patch as in its current shape.

Ok, I'll take a look at doing that while I'm re-working the others.

  Paul

> 
> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain
  2019-07-25 13:39 ` [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain Paul Durrant
  2019-07-29  9:20   ` George Dunlap
  2019-07-29  9:24   ` Roger Pau Monné
@ 2019-07-30  9:17   ` Jan Beulich
  2019-07-30  9:24     ` Paul Durrant
  2019-07-30  9:25     ` Jan Beulich
  2 siblings, 2 replies; 24+ messages in thread
From: Jan Beulich @ 2019-07-30  9:17 UTC (permalink / raw)
  To: Paul Durrant
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

On 25.07.2019 15:39, Paul Durrant wrote:
> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -306,6 +306,7 @@ enum guest_type {
>   
>   struct domain
>   {
> +    unsigned int     options;         /* copy of createdomain flags */
>      domid_t          domain_id;
>   
>      unsigned int     max_vcpus;

I was about to commit this when I noticed the placement here:
I think it would be pretty good to retain domain_id as the
first field. I'll be happy to make that adjustment while
committing, as long as you are fine with me doing so.

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain
  2019-07-30  9:17   ` Jan Beulich
@ 2019-07-30  9:24     ` Paul Durrant
  2019-07-30  9:25     ` Jan Beulich
  1 sibling, 0 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-30  9:24 UTC (permalink / raw)
  To: 'Jan Beulich'
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	Andrew Cooper, Tim (Xen.org),
	George Dunlap, Julien Grall, Ian Jackson, xen-devel

> -----Original Message-----
> From: Jan Beulich <JBeulich@suse.com>
> Sent: 30 July 2019 10:17
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: xen-devel@lists.xenproject.org; Julien Grall <julien.grall@arm.com>; Andrew Cooper
> <Andrew.Cooper3@citrix.com>; George Dunlap <George.Dunlap@citrix.com>; Ian Jackson
> <Ian.Jackson@citrix.com>; Stefano Stabellini <sstabellini@kernel.org>; Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com>; Tim (Xen.org) <tim@xen.org>; Wei Liu <wl@xen.org>
> Subject: Re: [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain
> 
> On 25.07.2019 15:39, Paul Durrant wrote:
> > --- a/xen/include/xen/sched.h
> > +++ b/xen/include/xen/sched.h
> > @@ -306,6 +306,7 @@ enum guest_type {
> >
> >   struct domain
> >   {
> > +    unsigned int     options;         /* copy of createdomain flags */
> >      domid_t          domain_id;
> >
> >      unsigned int     max_vcpus;
> 
> I was about to commit this when I noticed the placement here:
> I think it would be pretty good to retain domain_id as the
> first field. I'll be happy to make that adjustment while
> committing, as long as you are fine with me doing so.

Yes, sure. I guess put it just below domid instead.

  Paul

> 
> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain
  2019-07-30  9:17   ` Jan Beulich
  2019-07-30  9:24     ` Paul Durrant
@ 2019-07-30  9:25     ` Jan Beulich
  2019-07-30  9:53       ` Paul Durrant
  1 sibling, 1 reply; 24+ messages in thread
From: Jan Beulich @ 2019-07-30  9:25 UTC (permalink / raw)
  To: Paul Durrant
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	JulienGrall, xen-devel

On 30.07.2019 11:17, Jan Beulich wrote:
> On 25.07.2019 15:39, Paul Durrant wrote:
>> --- a/xen/include/xen/sched.h
>> +++ b/xen/include/xen/sched.h
>> @@ -306,6 +306,7 @@ enum guest_type {
>>    
>>    struct domain
>>    {
>> +    unsigned int     options;         /* copy of createdomain flags */
>>       domid_t          domain_id;
>>    
>>       unsigned int     max_vcpus;
> 
> I was about to commit this when I noticed the placement here:
> I think it would be pretty good to retain domain_id as the
> first field. I'll be happy to make that adjustment while
> committing, as long as you are fine with me doing so.

And I realize I should have said where I'd want to put it: I
think it wants to go next to guest_type, so that once that
field goes away structure layout (i.e. holes and overall size)
is the same again.

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain
  2019-07-30  9:25     ` Jan Beulich
@ 2019-07-30  9:53       ` Paul Durrant
  0 siblings, 0 replies; 24+ messages in thread
From: Paul Durrant @ 2019-07-30  9:53 UTC (permalink / raw)
  To: 'Jan Beulich'
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	Andrew Cooper, Tim (Xen.org),
	George Dunlap, JulienGrall, Ian Jackson, xen-devel

> -----Original Message-----
> From: Jan Beulich <JBeulich@suse.com>
> Sent: 30 July 2019 10:26
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: JulienGrall <julien.grall@arm.com>; Andrew Cooper <Andrew.Cooper3@citrix.com>; George Dunlap
> <George.Dunlap@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Stefano Stabellini
> <sstabellini@kernel.org>; xen-devel@lists.xenproject.org; Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com>; Tim (Xen.org) <tim@xen.org>; Wei Liu <wl@xen.org>
> Subject: Re: [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain
> 
> On 30.07.2019 11:17, Jan Beulich wrote:
> > On 25.07.2019 15:39, Paul Durrant wrote:
> >> --- a/xen/include/xen/sched.h
> >> +++ b/xen/include/xen/sched.h
> >> @@ -306,6 +306,7 @@ enum guest_type {
> >>
> >>    struct domain
> >>    {
> >> +    unsigned int     options;         /* copy of createdomain flags */
> >>       domid_t          domain_id;
> >>
> >>       unsigned int     max_vcpus;
> >
> > I was about to commit this when I noticed the placement here:
> > I think it would be pretty good to retain domain_id as the
> > first field. I'll be happy to make that adjustment while
> > committing, as long as you are fine with me doing so.
> 
> And I realize I should have said where I'd want to put it: I
> think it wants to go next to guest_type, so that once that
> field goes away structure layout (i.e. holes and overall size)
> is the same again.

Ok, I don't really mind.

  Paul

> 
> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-07-30  9:54 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 13:39 [Xen-devel] [PATCH v2 0/6] stash domain create flags and then use them Paul Durrant
2019-07-25 13:39 ` [Xen-devel] [PATCH v2 1/6] domain: stash xen_domctl_createdomain flags in struct domain Paul Durrant
2019-07-29  9:20   ` George Dunlap
2019-07-29  9:24   ` Roger Pau Monné
2019-07-30  9:17   ` Jan Beulich
2019-07-30  9:24     ` Paul Durrant
2019-07-30  9:25     ` Jan Beulich
2019-07-30  9:53       ` Paul Durrant
2019-07-25 13:39 ` [Xen-devel] [PATCH v2 2/6] domain: remove 'guest_type' field (and enum guest_type) Paul Durrant
2019-07-29  9:21   ` George Dunlap
2019-07-29 14:27   ` Jan Beulich
2019-07-25 13:39 ` [Xen-devel] [PATCH v2 3/6] x86/hvm/domain: remove the 'hap_enabled' flag Paul Durrant
2019-07-29  9:26   ` Roger Pau Monné
2019-07-29 14:35   ` Jan Beulich
2019-07-29 15:00     ` Paul Durrant
2019-07-25 13:39 ` [Xen-devel] [PATCH v2 4/6] x86/domain: remove the 'oos_off' flag Paul Durrant
2019-07-29  9:21   ` George Dunlap
2019-07-29 15:13   ` Jan Beulich
2019-07-29 15:39     ` Paul Durrant
2019-07-25 13:39 ` [Xen-devel] [PATCH v2 5/6] domain: remove the 'is_xenstore' flag Paul Durrant
2019-07-29  9:22   ` George Dunlap
2019-07-25 13:39 ` [Xen-devel] [PATCH v2 6/6] x86/domain: remove the 's3_integrity' flag Paul Durrant
2019-07-29 15:21   ` Jan Beulich
2019-07-29 15:42     ` Paul Durrant

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