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

Re: [PATCH 02/10] x86 setup: per-arch bootmodule structure, headroom field


  • To: Christopher Clark <christopher.w.clark@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 19 Sep 2023 15:39:48 +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=ZE77XIIREE9ECC2hP3WdScR24/fTLYEKuHkJydljJbc=; b=HA0ZPrFe0lLKsN65XUnTgFZhNJfLvIGu0zxO22BytMV9nHf1R5IrpibywoZK1Yg4W4v063LdZzesTXWiFgIE0wQfr8bKwQX92PGISt6EfPN1UjONPxjOCO7WVgS9SO0+ivv4MUpkzxHZowbIK1LbaQRMZB/25+H3VEhPA7n4JBGXwi2NzEGCliaplkcb9W5beOA+IYFsp8CPUIJ/jSj2MgAyauY+VIG8N/9lXE0SSFL70mZ5Qmu/YpBFPl7fbxx8V9JtqushgA5e9NERA9+wAJ6PaQesX/EbxxF8uroH/+w7D5dZq2gaEbpwAyEfn+0tO4z+vsakMlYNb1zvyvphfg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JkbTNTtZYZQ/dVjEy3KUhyBIsgenpdZQXrMTDFmFkASKxYy2Vvg4hqpgsS5+CDavHbhlpPCgghjIALwj5xmvsu8DjHZyEsjuXHxp27FjDobPV7iOTi/EG3ayGR8T0jNrO5bK8MTxpqaX0Rt8ppShywYYyf4xTVebJO8RhpnJRuYu8w6rn/dKeqgaHffdBzSVzax94ysOXEjCzCB3Qq889e1WmVnYy5iRShZtuofxTdfwdVFaXdsu7g/3uDnjrHOPCtJ3zQFaRRGIyy5rwLVVMxGNp27YQoLRsJuiJ8G/zvwprS0l1G9gOKVN7xpAksVh5d6cbYPachnRvQQiM1tBLQ==
  • 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:40:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 01.07.2023 09:18, Christopher Clark wrote:
> @@ -105,11 +102,14 @@ unsigned long __init bzimage_headroom(void *image_start,
>  }
>  
>  int __init bzimage_parse(void *image_base, void **image_start,
> +                         unsigned int headroom,
>                           unsigned long *image_len)
>  {
>      struct setup_header *hdr = (struct setup_header *)(*image_start);
>      int err = bzimage_check(hdr, *image_len);
> -    unsigned long output_len;
> +    unsigned long output_len, orig_image_len;
> +
> +    orig_image_len = *image_len - headroom;
>  
>      if ( err < 0 )
>          return err;
> @@ -125,7 +125,7 @@ int __init bzimage_parse(void *image_base, void 
> **image_start,
>  
>      BUG_ON(!(image_base < *image_start));
>  
> -    output_len = output_length(*image_start, orig_image_len);
> +    output_len = output_length(*image_start, *image_len);

If this is correct, then I would imply that so far we passed too large a
value (a too small one pretty certainly wouldn't have worked). But I
wonder whether you aren't passing too large a value now. In any event
ideally such a functional change would be split out; otherwise it very
clearly needs mentioning (justifying) in the description.

> --- /dev/null
> +++ b/xen/arch/x86/include/asm/bootinfo.h
> @@ -0,0 +1,18 @@
> +#ifndef __ARCH_X86_BOOTINFO_H__
> +#define __ARCH_X86_BOOTINFO_H__
> +
> +struct arch_bootmodule {
> +    unsigned headroom;
> +};

But this isn't a per-module property, is it?

> @@ -961,7 +967,8 @@ static struct domain *__init create_dom0(const module_t 
> *image,
>          write_cr4(read_cr4() & ~X86_CR4_SMAP);
>      }
>  
> -    if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
> +    if ( construct_dom0(d, image, boot_info->mods[0].arch->headroom, initrd,
> +                        cmdline) != 0 )
>          panic("Could not construct domain 0\n");

This looks to render the function's "headroom" parameter unused.

> --- a/xen/include/xen/bootinfo.h
> +++ b/xen/include/xen/bootinfo.h
> @@ -3,8 +3,19 @@
>  
>  #include <xen/types.h>
>  
> +#ifdef CONFIG_X86
> +#include <asm/bootinfo.h>
> +#else
> +    struct arch_bootmodule { };
> +#endif

This wants making use of include/asm-generic/ now, provided the non-x86
header are going to remain empty. Otherwise arch headers will want
introducing right away; there shouldn't be a CONFIG_X86 use here.

> +struct boot_module {
> +    struct arch_bootmodule *arch;
> +};

Why a pointer? By the names it's a 1:1 relationship, so ...

>  struct boot_info {
>      unsigned int nr_mods;
> +    struct boot_module *mods;

... only the pointer here is what takes care of there being multiple
instances (likely as before represented as an array).

Jan



 


Rackspace

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