[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC 02/10] is_system_domain: replace open-coded instances
From: Christopher Clark <christopher.w.clark@xxxxxxxxx> There were several instances of open-coded domid range checking. This commit replaces those with the is_system_domain inline function. Signed-off-by: Christopher Clark <christopher.w.clark@xxxxxxxxx> Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx> --- xen/arch/x86/cpu/vpmu.c | 2 +- xen/common/domctl.c | 2 +- xen/common/sched/core.c | 4 ++-- xen/include/xen/sched.h | 5 +++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c index 8ec4547bed..179f3dcc5a 100644 --- a/xen/arch/x86/cpu/vpmu.c +++ b/xen/arch/x86/cpu/vpmu.c @@ -188,7 +188,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs) * in XENPMU_MODE_ALL, for everyone. */ if ( (vpmu_mode & XENPMU_MODE_ALL) || - (sampled->domain->domain_id >= DOMID_FIRST_RESERVED) ) + (is_system_domain(sampled->domain)) ) { sampling = choose_hwdom_vcpu(); if ( !sampling ) diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 879a2adcbe..67021cc54b 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -536,7 +536,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) if ( !d ) { ret = -EINVAL; - if ( op->domain >= DOMID_FIRST_RESERVED ) + if ( is_system_domain_id(op->domain) ) break; rcu_read_lock(&domlist_read_lock); diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 8f4b1ca10d..6ea8bcf62f 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -821,7 +821,7 @@ int sched_init_domain(struct domain *d, unsigned int poolid) int ret; ASSERT(d->cpupool == NULL); - ASSERT(d->domain_id < DOMID_FIRST_RESERVED); + ASSERT(!is_system_domain(d)); if ( (ret = cpupool_add_domain(d, poolid)) ) return ret; @@ -845,7 +845,7 @@ int sched_init_domain(struct domain *d, unsigned int poolid) void sched_destroy_domain(struct domain *d) { - ASSERT(d->domain_id < DOMID_FIRST_RESERVED); + ASSERT(!is_system_domain(d)); if ( d->cpupool ) { diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 28146ee404..1df09bcb77 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -613,6 +613,11 @@ extern struct vcpu *idle_vcpu[NR_CPUS]; #define is_idle_domain(d) ((d)->domain_id == DOMID_IDLE) #define is_idle_vcpu(v) (is_idle_domain((v)->domain)) +static inline bool is_system_domain_id(domid_t id) +{ + return (id >= DOMID_FIRST_RESERVED); +} + static inline bool is_system_domain(const struct domain *d) { return d->domain_id >= DOMID_FIRST_RESERVED; -- 2.20.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |