[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3] is_system_domain: replace open-coded instances


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Tue, 21 Dec 2021 07:01:07 -0500
  • Arc-authentication-results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@xxxxxxxxxxxxxxxxxxxx; dmarc=pass header.from=<dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640088099; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=5R9QaYyJhgWtfIVhR6d2ZethYKNjWG6uSGh12D7jGy8=; b=NfGri9rrHaqRZQH1Z3YW1Y6tUVyFlL51sQmj7EPepkTQagOpFxiRcuceidT+k8DNLRXG6DcX/H+F0Sk2fNM8a9hSzLVJc7P+oaVav8i142rs5CJkQ+PYgt4PH/L3STMc6ZARx8vdKulJaf2kcm/nV+zUz4ZsYW7hW2gQIlMOPvc=
  • Arc-seal: i=1; a=rsa-sha256; t=1640088099; cv=none; d=zohomail.com; s=zohoarc; b=hguY7AcVJz1olFi6Awsbb5TzsIF8hgaEdLjhntGKv1NRhtTnAhaaePtO9qBfUk9CACbme/OY/KGKfYKkB5QBJjF80d4lLmYjEt2xZcZtTv3DTR5rMlo3thX9jbsQm9vrG5MWIjOdqgUOGqMpN5gUI4K2jF5MFZtEGdMc/IvS4qE=
  • Cc: Christopher Clark <christopher.w.clark@xxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 21 Dec 2021 12:01:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12/21/21 4:20 AM, Jan Beulich wrote:
On 20.12.2021 17:28, Daniel P. Smith wrote:
From: Christopher Clark <christopher.w.clark@xxxxxxxxx>

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 <christopher.w.clark@xxxxxxxxx>
Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
Acked-by: Dario Faggioli <dfaggioli@xxxxxxxx>

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.