diff mbox series

[5/6] domain: remove the 'is_xenstore' flag

Message ID 20190723160609.2177-6-paul.durrant@citrix.com (mailing list archive)
State Superseded
Headers show
Series stash domain create flags and then use them | expand

Commit Message

Paul Durrant July 23, 2019, 4:06 p.m. UTC
This patch introduces a convenience macro, is_xenstore_domain(), which
tests the domain 'createflags' directly and then uses that in place of
the 'is_xenstore' flag.

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>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
 xen/common/domain.c     | 5 +----
 xen/common/domctl.c     | 2 +-
 xen/include/xen/sched.h | 7 +++++--
 xen/include/xsm/dummy.h | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

Comments

Roger Pau Monné July 25, 2019, 9:47 a.m. UTC | #1
On Tue, Jul 23, 2019 at 05:06:08PM +0100, Paul Durrant wrote:
> This patch introduces a convenience macro, is_xenstore_domain(), which
> tests the domain 'createflags' 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>

Just one request below (which is not related to your code actually).

> ---
> 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>
> ---
>  xen/common/domain.c     | 5 +----
>  xen/common/domctl.c     | 2 +-
>  xen/include/xen/sched.h | 7 +++++--
>  xen/include/xsm/dummy.h | 2 +-
>  4 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index 6f405d2541..5703da357f 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -429,11 +429,8 @@ struct domain *domain_create(domid_t domid,
>          watchdog_domain_init(d);
>          init_status |= INIT_watchdog;
>  
> -        if ( d->createflags & XEN_DOMCTL_CDF_xs_domain )
> -        {
> -            d->is_xenstore = 1;
> +        if ( is_xenstore_domain(d) )
>              d->disable_migrate = 1;

While here can you also fix this line to use true instead of 1?

Thanks, Roger.
Paul Durrant July 25, 2019, 10:08 a.m. UTC | #2
> -----Original Message-----
> From: Roger Pau Monne <roger.pau@citrix.com>
> Sent: 25 July 2019 10:48
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: xen-devel@lists.xenproject.org; Stefano Stabellini <sstabellini@kernel.org>; Wei Liu <wl@xen.org>;
> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; George Dunlap <George.Dunlap@citrix.com>; Andrew
> Cooper <Andrew.Cooper3@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Tim (Xen.org) <tim@xen.org>;
> Julien Grall <julien.grall@arm.com>; Jan Beulich <jbeulich@suse.com>; Daniel De Graaf
> <dgdegra@tycho.nsa.gov>
> Subject: Re: [Xen-devel] [PATCH 5/6] domain: remove the 'is_xenstore' flag
> 
> On Tue, Jul 23, 2019 at 05:06:08PM +0100, Paul Durrant wrote:
> > This patch introduces a convenience macro, is_xenstore_domain(), which
> > tests the domain 'createflags' 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>
> 

Thanks.

> Just one request below (which is not related to your code actually).
> 
> > ---
> > 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>
> > ---
> >  xen/common/domain.c     | 5 +----
> >  xen/common/domctl.c     | 2 +-
> >  xen/include/xen/sched.h | 7 +++++--
> >  xen/include/xsm/dummy.h | 2 +-
> >  4 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/xen/common/domain.c b/xen/common/domain.c
> > index 6f405d2541..5703da357f 100644
> > --- a/xen/common/domain.c
> > +++ b/xen/common/domain.c
> > @@ -429,11 +429,8 @@ struct domain *domain_create(domid_t domid,
> >          watchdog_domain_init(d);
> >          init_status |= INIT_watchdog;
> >
> > -        if ( d->createflags & XEN_DOMCTL_CDF_xs_domain )
> > -        {
> > -            d->is_xenstore = 1;
> > +        if ( is_xenstore_domain(d) )
> >              d->disable_migrate = 1;
> 
> While here can you also fix this line to use true instead of 1?
> 

Sure.

  Paul

> Thanks, Roger.
diff mbox series

Patch

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 6f405d2541..5703da357f 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -429,11 +429,8 @@  struct domain *domain_create(domid_t domid,
         watchdog_domain_init(d);
         init_status |= INIT_watchdog;
 
-        if ( d->createflags & XEN_DOMCTL_CDF_xs_domain )
-        {
-            d->is_xenstore = 1;
+        if ( is_xenstore_domain(d) )
             d->disable_migrate = 1;
-        }
 
         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 9a98857237..1033ca0e8c 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -374,8 +374,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? */
@@ -972,6 +970,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->createflags & 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 */