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

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


  • To: Christopher Clark <christopher.w.clark@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 19 Sep 2023 15:04:44 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=/7RCBPrjpI2PF4mb5ps927YTihFgxB3Uj3x1a7Cw/F4=; b=Eiy8KDIEfKlzcXIrPmhe4RWhaGlqvmlp7aFUv4Bq4HRyqNjoW071AFtLWtdpZsVu2v2qB2cq7a1YGUbPaMKUvxv1C5knX1ViXffERy8NW2IMDI8mmM8Xmh6BCybOW57WJRnGfgweKQHormFm1zBODyXWgTXxj/tSzvbVKZuE+rieEK3VyfVc6+Us7TOjt7+jR807yYw+PkmIMIPks/JJ4Rxxydiw3zNHALXl/zrq9o3f+ONEtYVzSlXuVcEhcez5Gq3fFu0qt31sheO/Xl+dI9dB/36KZlTbIT1b2ws7B1Hewplom7uRVcaySlRnHYaJVJWv1ArfIMxlQUqH0ttJRQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L2RXRpgwO3xH7GAsdjLkGE0Jp6UwDqGZy7UeEcCoB9N7Y62IlAGyZr6I0xIfGZqnMDJsRbU7X3DNGnYfxJslxrzNSNw0nDrLSTE1CTIX/Y3BGiZ3ORW20rVdEcpPDGXAdAOhSGcR5JM+7+G/pwHo9Z0rn/A/VaM4dhbp1YfRnBGW05q9ZDk8vijc5Y4Qu/kgi5pOFez3HniHaxA6b2k5ffOFaqRwI1NGRRrvMQTXWErllvVG8ojKXZ8Zg1Ace6RjQQrImb6kZ3eNK+56hiKorqP5qAG05ZwKD1pKJWbeveArf3ZFSGUgQ6qvX8NRYotAT3SdbVsJqAqPNdjHFWsvww==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Daniel Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>, stefano.stabellini@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Luca Fancellu <luca.fancellu@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Rich Persaud <persaur@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 19 Sep 2023 13:04:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 01.07.2023 09:18, Christopher Clark wrote:
> @@ -1127,18 +1139,18 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>             bootsym(boot_edd_info_nr));
>  
>      /* Check that we have at least one Multiboot module. */
> -    if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0) )
> +    if ( !(mbi->flags & MBI_MODULES) || (boot_info->nr_mods == 0) )
>          panic("dom0 kernel not specified. Check bootloader configuration\n");
>  
>      /* Check that we don't have a silly number of modules. */
> -    if ( mbi->mods_count > sizeof(module_map) * 8 )
> +    if ( boot_info->nr_mods > sizeof(module_map) * 8 )
>      {
> -        mbi->mods_count = sizeof(module_map) * 8;
> +        boot_info->nr_mods = sizeof(module_map) * 8;

As long as you don't replace all consumers of mbi->mods_count (see in
particular the call trees down from early_microcode_init() and down from
xsm_multiboot_init()), I don't think you can drop the original assignment.

>          printk("Excessive multiboot modules - using the first %u only\n",
> -               mbi->mods_count);
> +               boot_info->nr_mods);
>      }
>  
> -    bitmap_fill(module_map, mbi->mods_count);
> +    bitmap_fill(module_map, boot_info->nr_mods);
>      __clear_bit(0, module_map); /* Dom0 kernel is always first */
>  
>      if ( pvh_boot )
> @@ -1311,9 +1323,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>      kexec_reserve_area(&boot_e820);
>  
>      initial_images = mod;
> -    nr_initial_images = mbi->mods_count;
> +    boot_info->nr_mods = boot_info->nr_mods;

Overly mechanical change? To prevent such going unnoticed, maybe
boot_info should be pointer-to-const? Would of course require the
bounding to occur earlier, so you truly don't need to write the struct
after filling it in multiboot_to_bootinfo(). Or you move the call to
that function down a little. Yet other options also exist.

> -    for ( i = 0; !efi_enabled(EFI_LOADER) && i < mbi->mods_count; i++ )
> +    for ( i = 0; !efi_enabled(EFI_LOADER) && i < boot_info->nr_mods; i++ )

Seeing all sorts of changes of this kind - did you consider naming the
pointer variable (which will become a function parameter as to what I
understood from your reply to Stefano) just "bi"? (I wouldn't suggest
this if the variable was to remain file-scope.)

Jan



 


Rackspace

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