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

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


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 21 Dec 2021 10:20:34 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5aLE9fdf9dWfUlU6DfzmijN1/DEkeGK+E8OdRzu6QV8=; b=FUehrQooL5Pphe1/fypFuvMbHFFAsy/4/6tM1pUkX0iaDkfp1q8vBIU9ws+7op7u6bCooExGr8nl8nTeFNhIg+JXQKxEmmaMhg4jv2RwKEOzJhWOu/vhsEOv0sRUOLKAKdxMzCRQvaTfmnfUacMXaIcy39/5prlstKLwtx4MmgPYAgbhLgn5PHA/cu2codWTLb9QJQaEXC3LmrouZb4RZTYQHaiFTkR7jv3QUCjTCAoW4woYzAvAmxeuykEJUPIFyuddPoQlOdJQBKrZ0DH72oX2YT8KHbYd+rb0Tq1AHkZRWm+kvrPPXRNzPLvJJJu0vEkGEO8XglYjWWedvVaYjA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UAoRFjw2wcWtng5vALPm2I0QnWXJOEywYNXpEYgv6hCZVTe+CRh8hp7bSTg+NguT5hr4lySZSoGV6fXnQLYjrHYmByOihbY//MvKZDi1MSG+hZUqEMXEI9l/fUlT88jGJtUog6vuYD3XYPAq/6u2paLlipsI9vgBVqB5mctTtLnL+MaViltu0jeF9bIvSfiCrS1G51USYu2BO3cFg9ws/i4ohb5hjuZyp+5Znv0awk1UUZ9i8/By6WC/Clg6ink6OeqmWVGbKKxtadPJDXDaBvo3YvKxd5995LdiMKj5C6mWYcZECv8NDfz+C3fHGuXkHbR3TeJjoIkupjOg+eAA9w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • 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 09:20:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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, ...

> +}
> +
>  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®.