On 12/21/21 4:20 AM, Jan Beulich wrote:
On 20.12.2021 17:28, Daniel P. Smith wrote:
From: Christopher Clark <[email protected]>
This is a split out of the hyperlaunch dom0 series.
There were several instances of open-coded domid range checking. This commit
replaces those with the is_system_domain or is_system_domid inline function.
Signed-off-by: Christopher Clark <[email protected]>
Signed-off-by: Daniel P. Smith <[email protected]>
Acked-by: Dario Faggioli <[email protected]>
While I'm not outright opposed, I'd still like to raise the question whether
we really want to intermix "is system domain" and "is in-range domain ID"
predicates. Personally I'd prefer the latter to remain open-coded range
checks.
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -613,9 +613,14 @@ 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_domid(domid_t id)
+{
+ return (id >= DOMID_FIRST_RESERVED);
Nit: Generally we omit parentheses in cases like this, ...
ack
+}
+
static inline bool is_system_domain(const struct domain *d)
{
- return d->domain_id >= DOMID_FIRST_RESERVED;
... just like was the case here.
Jan