[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC 2/6] roles: provide abstraction for the possible domain roles
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 3 Aug 2023 10:12:25 -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=1691071950; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=kgbWUzvjAJOai+vyRMYUHqrwL1+0ZrXPwIxIAWO83No=; b=NTZy37Ykt6EK1Eax3m09lPVLXyxQwnGWyjffNqvxwiE0dEhcrHdfTjxND1oG5khzFMMh3h9q4725IUh38zxBNpsqC4PjW4GOEM7BdWTwmhkK0zjI2k/Hgi9tnHbhXrcSFILho1Yaa13son4jkxuVlbA2K3RwXt4B5xy0tmYjJ2A=
- Arc-seal: i=1; a=rsa-sha256; t=1691071950; cv=none; d=zohomail.com; s=zohoarc; b=Pt6gRMM6IMzhXREFSYSHGzioHoVMqsXCGAvRsTCiwMChVaCD5YdxkOJvqIee7eOLZo7/TQMm6gFhWg6uhnYI7Qnrl7/LHW3g8Y3XDTvATlar3bMeQ3eP2/0KIyuUtbKwTjspTllT0R4FQ3nL1ORzeadsqYQ7daTN6xt+0Mhr2Ss=
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Thu, 03 Aug 2023 14:12:49 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 8/2/23 03:51, Jan Beulich wrote:
On 01.08.2023 22:20, Daniel P. Smith wrote:
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -340,6 +340,14 @@ static int late_hwdom_init(struct domain *d)
setup_io_bitmap(dom0);
#endif
+ /*
+ * "dom0" may have been created under the unbounded role, demote it from
+ * that role, reducing it to the control domain role and any other roles it
+ * may have been given.
+ */
+ dom0->role &= ~(ROLE_UNBOUNDED_DOMAIN & ROLE_HARDWARE_DOMAIN);
This doesn't look to remove anything, when taking into account ...
Ugh, you are correct. It was meant to be a bitwise and of dom0-role with
a mask that has every bit set except ROLE_UNBOUNDED_DOMAIN and
ROLE_HARDWARE_DOMAIN. But being a bonehead, I bitwise and the two roles
instead of or-ing them. I agree with your comment below, which will
reduce to just masking a bitwise not of ROLE_HARDWARE_DOMAIN.
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -467,8 +467,10 @@ struct domain
#endif
/* is node-affinity automatically computed? */
bool auto_node_affinity;
- /* Is this guest fully privileged (aka dom0)? */
- bool is_privileged;
+#define ROLE_UNBOUNDED_DOMAIN (1U<<0)
+#define ROLE_CONTROL_DOMAIN (1U<<1)
+#define ROLE_HARDWARE_DOMAIN (1U<<2)
... that each of the constants has just a single bit set. Seeing the
& there I was expecting something like
#define ROLE_UNBOUNDED_DOMAIN (ROLE_CONTROL_DOMAIN | ROLE_HARDWARE_DOMAIN)
instead.
Agree, instead of consuming one the limited number of bits for a role
that represents a domain having all roles, just or all the roles
together. Then I can reclaim one of the bits of the flag field.
v/r,
dps
|