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

Re: [PATCH v3 1/7] xen: introduce hardware domain create flag


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 7 Apr 2025 14:16:44 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=zu5/r573VL/mCk3hgJ7R6knSDglwaXrKHfEamfgfekY=; b=ir2Ux6F8wW6XT9n5ANoPetqua+oPsOjGgCHIFbQL5BHO3bSLYEH+hq8NAz6vpb40Z1Nzy7KnOmSXTK+X+pcNnpufALn6IWNxVUfJRKpTSg/Zvuj+mmRClNa5AcQRlzSxDLI1oqYX2R8+pmq11RbGZHUFiGDMRlkWk5JkZ8WSNqnD/8wQ7IlSU08HBq5z2c6MG5JpadvUj6DmvEZlxvPnBan2ivDV0IIp+rE7PMA+Ej5vhi4y8tXmqerZgT5zOlup2LPkZLIyzbx1g20Aqn+Uqlrg9Be102bAhTKH8AuYsurDW2UCQq2dTb5aGfgBBGSiiripONXBDNH1zTmxKOwcZw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eSL0AbEVj4izsGUPfV9ImjyUEQvqLk7HF+0b+nyPnEc/OAZm4bL+7qTw8nPUnJpgPZOP36I8AA4FU20J64FLWzTZwnSWSgGMafeoVgbuj2vNyEQAT6aOGAzsIJYxhp1LcUoZ5dxlG50vplV88pVOHZCx/E+JIRhgjLHtEp/YKyK84UfIsO8jK7FMjk6Ggphar/AI5UGFM5ESMP9q68xkouaRt7bxhgHpswNMjAVEqFAg5sNf506NQSkH1gDetjsHOoI02p7EO9pmzw2KEcplb+p9aYv0sjK3aP16kHOHYRXxMLIolILEhtAgeWE1CsJ9QNRkdyi6zVmY8nRud+YnQA==
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 07 Apr 2025 18:17:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-04-04 03:38, Jan Beulich wrote:
On 03.04.2025 23:46, Jason Andryuk wrote:
From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>

Add and use a new internal create domain flag to specify the hardware
domain.  This removes the hardcoding of domid 0 as the hardware domain.

This allows more flexibility with domain creation.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v3:
Or-in CDF_hardware for late hwdom case

Except that ...

--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -820,13 +820,18 @@ struct domain *domain_create(domid_t domid,
      d->is_privileged = flags & CDF_privileged;
/* Sort out our idea of is_hardware_domain(). */
-    if ( domid == 0 || domid == hardware_domid )
+    if ( (flags & CDF_hardware) || domid == hardware_domid )
      {
          if ( hardware_domid < 0 || hardware_domid >= DOMID_FIRST_RESERVED )
              panic("The value of hardware_dom must be a valid domain ID\n");
+ /* late_hwdom is only allowed for dom0. */
+        if ( hardware_domain && hardware_domain->domain_id )
+            return ERR_PTR(-EINVAL);
+
          old_hwdom = hardware_domain;
          hardware_domain = d;
+        flags |= CDF_hardware;
      }

... this isn't quite enough. You're only modifying what will go out of scope
when returning from the function. What's at least equally important to OR into
is d->cdf.

Yes, thanks for catching that.

I'll move d->cdf assignment to after here instead of or-ing in a second time.

With that, it seems like it should also be removed from old_hwdom?

old_hwdom->cdf &= ~CDF_hardware

Regards,
Jason



 


Rackspace

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