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

Re: [PATCH v9 1/6] x86/boot: convert domain construction to use boot info


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Fri, 15 Nov 2024 12:02:52 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=citrix.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=U27MWjamgrwi1T2d6lRtdMSo83fRLXmhOZbb3c1j0Ik=; b=DK/m/9j0j0y52f0YHiFUENcn2aOesJnE+gZ4SSyPu/XCUQUUqhe5QWkAWCVXfM8EynTCXixAwrvwGMIgkcGirvZdPzx51zzAikdsERg2+DTwB0WkCAoAClaIem774RVAaq6jP24cm8ycwao2RoY95OGrXhBbsIgPe5X9S+fWZTwdAsm209jkQdhldvq8ZQ0GEBlEo1GTloECUuIsxAO/uU+KJcjrOW1Y84lAh6kpHbWH57DaMwJhVnYmSWD3GLNTLDr+J5AMXqW6rcE9DVxc+mqAVL6x4TUV+HX9sv65OK/o09zDLbxf+uQowlKUU7jC42Jg69HHoffFtOzSWHTJZg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b/RS50gZ7ll50uW0KbGIGPEhlniKGvLY2Pu+0aohVD9dhy58E18MNlimyiYfUgaGnDix7LtTKT405ZwYCPefwGWF2x4xY4ST9j6jgSX6t4+SDObnhote701mWPBxd8LhY70EwrVeefUYkWcxxpn1EhFlp1KN2ID93C16YWS4stwjSKfz0A/AI7D1pm0EzgZJTo6KWvlFptwbTSIVtzAM9sA4JkBNty03BOt1ABzhzPb2F5Yt0U5J42zlcLJvZ4W9SJFTm+mykuHMLFSkBbQu7EnHoXgkdWxCm/at4bKGZEl6odDYNAMBqWrouc54HJW1bEm7LXBPiNKLvxY8OHKG2w==
  • Cc: <christopher.w.clark@xxxxxxxxx>, <stefano.stabellini@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 15 Nov 2024 17:14:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-11-15 12:01, Andrew Cooper wrote:
On 15/11/2024 4:33 pm, Jason Andryuk wrote:
On 2024-11-15 08:11, Daniel P. Smith wrote:
diff --git a/xen/arch/x86/hvm/dom0_build.c
b/xen/arch/x86/hvm/dom0_build.c
index 3dd913bdb029..d1bdf1b14601 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1300,16 +1301,26 @@ static void __hwdom_init
pvh_setup_mmcfg(struct domain *d)
       }
   }
   -int __init dom0_construct_pvh(struct domain *d, const module_t
*image,
-                              unsigned long image_headroom,
-                              module_t *initrd,
-                              const char *cmdline)
+int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
   {
       paddr_t entry, start_info;
+    struct boot_module *image;
+    struct boot_module *initrd = NULL;
+    unsigned int idx;
       int rc;
         printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n",
d->domain_id);
   +    idx = first_boot_module_index(bi, BOOTMOD_KERNEL);
+    if ( idx >= bi->nr_modules )

What do you think about introducing a new define:

     #define BOOTMOD_NOT_FOUND (MAX_NR_BOOTMODS + 1)

For first_boot_module_index() to return.  And then:

     if ( idx == BOOTMOD_NOT_FOUND )

?

Care would need to be taken vs BOOTMOD_XEN, which could have the same
numeric value in a big HL configuration.

It's a little subtle that BOOTMOD_XEN could be at MAX_NR_BOOTMODS + 1, and first_boot_module_index() will return that for "not found". Which I overlooked when making the suggestion.

 From a "reading the code" point of view, a range check against any
invalid value is better seeing as the next thing we do is index an
array, so I'm marginally on the side of "keep it as it is".

first_boot_module_index() is looking for a specific BOOTMOD_*, so I thought it would be a little safer to just return either a valid index or BOOTMOD_NOT_FOUND (which might have to become ~0).

This particular logic can't trip because of earlier checks in
__start_xen(), and gets rewritten in patch 4 in the conversion to
boot_domains, so I'm also not overly fussed at extra polish on this
specific piece of logic.

If maintainers are okay with it as-is, then I have no issue with the code as-is and

Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>

Regards,
Jason



 


Rackspace

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