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

Re: [RFC 1/6] dom0: replace explict zero checks


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Thu, 3 Aug 2023 09:33:33 -0400
  • 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=1691069617; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Ah/XQd/hZBpE0Stgw+77JLFwk+CLLIchBNGJVpobHsw=; b=SA70azil8tnYy79SvP1wvrnL962CXEFnroSL3gVu2Jv0GpMwq+srw7uMZsSttFIh3G8d82Ne7kPc0rahaB3Xcuo5CCRD5JmKHGPW0lnKHUtJxNnAFrt0XGJVfNZCL7liWzV6DiR8Y5032OYjO4Tg/yHLIgLVM6jYb9pbKnddLtc=
  • Arc-seal: i=1; a=rsa-sha256; t=1691069617; cv=none; d=zohomail.com; s=zohoarc; b=a3h63MK2gqqr7HV5WiKivaBYU2qc1JH8mSkkMRa3GGxpAJrc3mDSJLRWCNLMhu4aDvLIVQZnd09ViDGkdrxurtq4PeZUdgHRmfpcyNk87NvJmLm/2gWz0Ocsa8Lnndw364Qez1mHeP6bysOBTWJpZkC6oTv6w2H/vvcytFKsJAA=
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Nathan Studer <nathan.studer@xxxxxxxxxxxxxxx>, Stewart Hildebrand <stewart@xxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 03 Aug 2023 13:33:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 8/2/23 03:46, Jan Beulich wrote:
On 01.08.2023 22:20, Daniel P. Smith wrote:
A legacy concept is that the initial domain will have a domain id of zero. As a
result there are places where a check that a domain is the inital domain is
determined by an explicit check that the domid is zero.

It might help if you at least outlined here why/how this is going to
change.

Okay, I will try expanding on this further.

--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1058,6 +1058,13 @@ void scheduler_disable(void);
  void watchdog_domain_init(struct domain *d);
  void watchdog_domain_destroy(struct domain *d);
+static always_inline bool is_initial_domain(const struct domain *d)
+{
+    static int init_domain_id = 0;

This may then also help with the question on why you use a static
variable here. (In any event the type of this variable wants to
be correct; plain int isn't appropriate ...

Ah, so this is a dated patch that I brought because of the abstraction it made. The intent in the original series for making it static was in preparation to handle the shim case where init_domid() would have return a non-zero value.

So the static can be dropped and changed to domid_t.

+    return d->domain_id == init_domain_id;

... for this comparison.)

Jan

v/r,
dps



 


Rackspace

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