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

Re: [PATCH v6 01/44] x86/boot: move x86 boot module counting into a new boot_info struct


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Thu, 17 Oct 2024 18:32:27 -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=1729204355; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=vGIAkDNB2sXTt3FTeWfWAF+i+JJIF4Hz6HMFD/0qFHQ=; b=BekLHtWQqmafpJ3+OjJxbliQEOPPUOKEQLBZFa/NIg0cixhLP9sJ1W1XB/uAwTbGn6PIU51JC4B+XVH6KBzHSUxMoan1MymM0AvwqX0vi0QT7EqZ5je/lZP/MS0rxHl0XVifa+vy+6cjIByRxLzdGos3qk5LYgF+jrWdsrk9JP4=
  • Arc-seal: i=1; a=rsa-sha256; t=1729204355; cv=none; d=zohomail.com; s=zohoarc; b=CXNZwQFLx/20b37IhCKaXn90PGQpxnX28M52L7RNU96Wkf1m3ZzC4OUHSK8MuJoI/GcY9JtitXjIscrXzvBOYiUhrJOGSIh+aj7COeT6hym8lGeBbXCMeuWvXibtSNEGvHwG06CYEJ4wSOcvTsJIaDV4K+Swzno5H0AOX875aq4=
  • Cc: Christopher Clark <christopher.w.clark@xxxxxxxxx>, jason.andryuk@xxxxxxx, stefano.stabellini@xxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 17 Oct 2024 22:32:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10/17/24 15:50, Andrew Cooper wrote:
On 17/10/2024 6:02 pm, Daniel P. Smith wrote:
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a6e77c9ed9fc..6201ca0fad19 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -274,16 +275,28 @@ static int __init cf_check parse_acpi_param(const char *s)
  custom_param("acpi", parse_acpi_param);
static const module_t *__initdata initial_images;
-static unsigned int __initdata nr_initial_images;
+
+struct boot_info __initdata xen_boot_info;
+
+static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
+{
+    struct boot_info *bi = &xen_boot_info;
+    const multiboot_info_t *mbi = __va(mbi_p);
+
+    bi->nr_modules = (mbi->flags & MBI_MODULES) ? mbi->mods_count : 0;

Having looked to end of the series, this and a few other expressions are
still awkward.

The nicer way looks like:

struct boot_info __initdata xen_boot_info = {
     .loader = "unknown",
     .cmdline = "",
};

static struct boot_info *__init multiboot_fill_boot_info(unsigned long
mbi_p)
{
     struct boot_info *bi = &xen_boot_info;
     const multiboot_info_t *mbi = __va(mbi_p);
     module_t *mods = __va(mbi->mods_addr);
     unsigned int i;

     if ( mbi->flags & MBI_MODULES )
         bi->nr_modules = mbi->mods_count;

     if ( mbi->flags & MBI_LOADERNAME )
         bi->loader = __va(mbi->boot_loader_name);

     if ( mbi->flags & MBI_CMDLINE )
         bi->cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);

     if ( mbi->flags & MBI_MEMMAP )
     {
         bi->memmap_addr = mbi->mmap_addr;
         bi->memmap_length = mbi->mmap_length;
     }


which is easier to read and follow.  Thoughts?

You are right, that is much cleaner. I'm good with it.

v/r,
dps



 


Rackspace

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