[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] xen/domain: Prepare data for is_{pv, hvm}_domain() as early as possible
commit 6817c6fd38086d2cb998571a3db4a38a1098d6aa Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Mon Sep 3 14:22:16 2018 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Tue Sep 4 13:25:44 2018 +0100 xen/domain: Prepare data for is_{pv,hvm}_domain() as early as possible Given two subtle failures from getting this wrong before, and more cleanup on the way, move the setting of d->guest_type as early as possible. Note that despite moving the assignment of d->guest_type outside of the is_idle_domain(d) check, it still behaves the same. Previously, system domains had no direct assignment of d->guest_type and behaved as PV guests because guest_type_pv has the value 0. While tidying up the predicate, leave a comment referring to is_system_domain(), and move the associated ASSERT() to be beside the assignment. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/common/domain.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 256c59a489..43ab926a1c 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -272,8 +272,12 @@ struct domain *domain_create(domid_t domid, if ( (d = alloc_domain_struct()) == NULL ) return ERR_PTR(-ENOMEM); + /* Sort out our idea of is_system_domain(). */ d->domain_id = domid; + /* Debug sanity. */ + ASSERT(is_system_domain(d) ? config == NULL : config != NULL); + /* Sort out our idea of is_control_domain(). */ d->is_privileged = is_priv; @@ -289,8 +293,11 @@ struct domain *domain_create(domid_t domid, hardware_domain = d; } - /* Debug sanity. */ - ASSERT(is_system_domain(d) ? config == NULL : config != NULL); + /* Sort out our idea of is_{pv,hvm}_domain(). */ + if ( config && (config->flags & XEN_DOMCTL_CDF_hvm_guest) ) + d->guest_type = guest_type_hvm; + else + d->guest_type = guest_type_pv; TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id); @@ -331,11 +338,6 @@ struct domain *domain_create(domid_t domid, if ( !is_idle_domain(d) ) { - if ( config->flags & XEN_DOMCTL_CDF_hvm_guest ) - d->guest_type = guest_type_hvm; - else - d->guest_type = guest_type_pv; - if ( !is_hardware_domain(d) ) d->nr_pirqs = nr_static_irqs + extra_domU_irqs; else -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |