From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jason Andryuk <jason.andryuk@amd.com>,
"Daniel P. Smith" <dpsmith@apertussolutions.com>,
xen-devel@lists.xenproject.org
Cc: christopher.w.clark@gmail.com, stefano.stabellini@amd.com,
"Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v9 1/6] x86/boot: convert domain construction to use boot info
Date: Fri, 15 Nov 2024 17:01:58 +0000 [thread overview]
Message-ID: <f45f516d-cf90-419f-b7a7-7fc91f9f2729@citrix.com> (raw)
In-Reply-To: <24e23ea2-e359-41f3-be62-6b7bdff4e074@amd.com>
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.
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".
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.
~Andrew
next prev parent reply other threads:[~2024-11-15 17:02 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 13:11 [PATCH v9 0/6] Boot modules for Hyperlaunch Daniel P. Smith
2024-11-15 13:11 ` [PATCH v9 1/6] x86/boot: convert domain construction to use boot info Daniel P. Smith
2024-11-15 14:25 ` Andrew Cooper
2024-11-15 14:32 ` Daniel P. Smith
2024-11-15 16:33 ` Jason Andryuk
2024-11-15 17:01 ` Andrew Cooper [this message]
2024-11-15 17:02 ` Jason Andryuk
2024-11-15 13:12 ` [PATCH v9 2/6] x86/boot: introduce module release Daniel P. Smith
2024-11-15 16:50 ` Jason Andryuk
2024-11-15 17:09 ` Andrew Cooper
2024-11-15 17:16 ` Daniel P. Smith
2024-11-15 17:18 ` Jason Andryuk
2024-11-18 16:13 ` Andrew Cooper
2024-11-15 13:12 ` [PATCH v9 3/6] x86/boot: add start and size fields to struct boot_module Daniel P. Smith
2024-11-15 17:31 ` Jason Andryuk
2024-11-15 13:12 ` [PATCH v9 4/6] x86/boot: introduce boot domain Daniel P. Smith
2024-11-27 10:22 ` Jan Beulich
2024-12-04 16:24 ` Daniel P. Smith
2024-11-15 13:12 ` [PATCH v9 5/6] x86/boot: introduce domid field to struct boot_domain Daniel P. Smith
2024-11-15 15:31 ` Daniel P. Smith
2024-11-27 10:32 ` Jan Beulich
2024-12-04 16:45 ` Daniel P. Smith
2024-12-09 8:55 ` Jan Beulich
2024-12-11 0:57 ` Daniel P. Smith
2024-11-15 13:12 ` [PATCH v9 6/6] x86/boot: add cmdline " Daniel P. Smith
2024-11-15 15:12 ` Daniel P. Smith
2024-11-15 16:34 ` Daniel P. Smith
2024-11-15 18:20 ` Jason Andryuk
2024-11-20 17:57 ` Daniel P. Smith
2024-11-20 22:32 ` Jason Andryuk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f45f516d-cf90-419f-b7a7-7fc91f9f2729@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=christopher.w.clark@gmail.com \
--cc=dpsmith@apertussolutions.com \
--cc=jason.andryuk@amd.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=stefano.stabellini@amd.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.