From: Julien Grall <julien@xen.org>
To: David Woodhouse <dwmw2@infradead.org>, xen-devel@lists.xenproject.org
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
"Wei Liu" <wl@xen.org>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"George Dunlap" <George.Dunlap@eu.citrix.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Varad Gautam" <vrd@amazon.de>,
"Ian Jackson" <ian.jackson@eu.citrix.com>,
"Hongyan Xia" <hongyxia@amazon.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Paul Durrant" <pdurrant@amazon.co.uk>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH 7/8] x86/setup: simplify handling of initrdidx when no initrd present
Date: Thu, 13 Feb 2020 11:47:54 +0100 [thread overview]
Message-ID: <6764d461-f79b-afa1-2623-f1e3451098e4@xen.org> (raw)
In-Reply-To: <20200201003303.2363081-7-dwmw2@infradead.org>
Hi David,
On 01/02/2020 01:33, David Woodhouse wrote:
> From: David Woodhouse <dwmw@amazon.co.uk>
>
> Remove a ternary operator that made my brain hurt.
>
> Replace it with something simpler that makes it somewhat clearer that
> the check for initrdidx < mbi->mods_count is because mbi->mods_count
> is what find_first_bit() will return when it doesn't find anything.
>
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
> xen/arch/x86/setup.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index 5f68a1308f..10209e6bfb 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -687,7 +687,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
> char *cmdline, *kextra, *loader;
> unsigned int initrdidx, num_parked = 0;
> multiboot_info_t *mbi;
> - module_t *mod;
> + module_t *mod, *initrd = NULL;
> unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1];
> int i, j, e820_warn = 0, bytes = 0;
> bool acpi_boot_table_init_done = false, relocated = false;
> @@ -1793,6 +1793,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
> xen_processor_pmbits |= XEN_PROCESSOR_PM_CX;
>
> initrdidx = find_first_bit(module_map, mbi->mods_count);
> + if ( initrdidx < mbi->mods_count )
IIUC, the check on initrdx > 0 was pointless as bit 0 will always be
cleared (it is used for dom0 kernel). It might be worth mentionning it
in the commit message. Something like:
"The initrd can never be in the first module (i.e initrdidx == 0) as
this is always used by the dom0 kernel. So the check can be simplify."
Acked-by: Julien Grall <julien@xen.org>
> + initrd = mod + initrdidx;
> +
> if ( bitmap_weight(module_map, mbi->mods_count) > 1 )
> printk(XENLOG_WARNING
> "Multiple initrd candidates, picking module #%u\n",
> @@ -1817,9 +1820,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
> * We're going to setup domain0 using the module(s) that we stashed safely
> * above our heap. The second module, if present, is an initrd ramdisk.
> */
> - if ( construct_dom0(dom0, mod, modules_headroom,
> - (initrdidx > 0) && (initrdidx < mbi->mods_count)
> - ? mod + initrdidx : NULL, cmdline) != 0)
> + if ( construct_dom0(dom0, mod, modules_headroom, initrd, cmdline) != 0 )
> panic("Could not set up DOM0 guest OS\n");
>
> if ( cpu_has_smap )
>
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-02-13 10:48 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-01 0:32 [Xen-devel] [PATCH 0/8] Early cleanups and bug fixes in preparation for live update David Woodhouse
2020-02-01 0:32 ` [Xen-devel] [PATCH 1/8] x86/smp: reset x2apic_enabled in smp_send_stop() David Woodhouse
2020-02-03 16:18 ` Roger Pau Monné
2020-02-01 0:32 ` [Xen-devel] [PATCH 2/8] x86/setup: Fix badpage= handling for memory above HYPERVISOR_VIRT_END David Woodhouse
2020-02-03 10:57 ` Julien Grall
2020-02-20 15:38 ` Jan Beulich
2020-03-06 22:52 ` Julien Grall
2020-02-01 0:32 ` [Xen-devel] [PATCH 3/8] x86/setup: Don't skip 2MiB underneath relocated Xen image David Woodhouse
2020-02-01 0:32 ` [Xen-devel] [PATCH 4/8] xen/vmap: allow vm_init_type to be called during early_boot David Woodhouse
2020-02-13 10:36 ` Julien Grall
2020-02-21 16:42 ` Jan Beulich
2020-02-01 0:33 ` [Xen-devel] [PATCH 5/8] xen/vmap: allow vmap() to be called during early boot David Woodhouse
2020-02-03 14:00 ` Julien Grall
2020-02-03 16:37 ` David Woodhouse
2020-02-04 11:00 ` George Dunlap
2020-02-04 11:06 ` David Woodhouse
2020-02-04 11:18 ` David Woodhouse
2020-02-09 18:19 ` Julien Grall
2020-02-21 16:46 ` Jan Beulich
2020-02-01 0:33 ` [Xen-devel] [PATCH 6/8] x86/setup: move vm_init() before end_boot_allocator() David Woodhouse
2020-02-03 11:10 ` Xia, Hongyan
2020-02-03 14:03 ` David Woodhouse
2020-02-21 16:48 ` Jan Beulich
2020-02-01 0:33 ` [Xen-devel] [PATCH 7/8] x86/setup: simplify handling of initrdidx when no initrd present David Woodhouse
2020-02-13 10:47 ` Julien Grall [this message]
2020-02-21 16:59 ` Jan Beulich
2020-02-24 13:31 ` Julien Grall
2020-02-25 12:34 ` Jan Beulich
2020-02-26 7:13 ` Julien Grall
2020-02-26 8:37 ` Jan Beulich
2020-02-01 0:33 ` [Xen-devel] [PATCH 8/8] x86/setup: lift dom0 creation out into create_dom0() function David Woodhouse
2020-02-03 14:28 ` Julien Grall
2020-02-03 15:03 ` David Woodhouse
2020-02-21 17:06 ` Jan Beulich
2020-03-17 23:45 ` David Woodhouse
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=6764d461-f79b-afa1-2623-f1e3451098e4@xen.org \
--to=julien@xen.org \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dwmw2@infradead.org \
--cc=hongyxia@amazon.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=pdurrant@amazon.co.uk \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=vrd@amazon.de \
--cc=wl@xen.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).