All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Daniel P. Smith" <dpsmith@apertussolutions.com>
Cc: jason.andryuk@amd.com, christopher.w.clark@gmail.com,
	stefano.stabellini@amd.com,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v9 5/6] x86/boot: introduce domid field to struct boot_domain
Date: Wed, 27 Nov 2024 11:32:22 +0100	[thread overview]
Message-ID: <bfbd15eb-9888-4988-b9a1-8191a696a4c2@suse.com> (raw)
In-Reply-To: <20241115131204.32135-6-dpsmith@apertussolutions.com>

On 15.11.2024 14:12, Daniel P. Smith wrote:
> Add a domid field to struct boot_domain to hold the assigned domain id for the
> domain. During initialization, ensure all instances of struct boot_domain have
> the invalid domid to ensure that the domid must be set either by convention or
> configuration.

I'm missing the "why" part here - after all ...

> --- a/xen/arch/x86/include/asm/bootdomain.h
> +++ b/xen/arch/x86/include/asm/bootdomain.h
> @@ -12,6 +12,8 @@ struct boot_module;
>  struct domain;
>  
>  struct boot_domain {
> +    domid_t domid;
> +
>      struct boot_module *kernel;
>      struct boot_module *ramdisk;
>  

... just out of context here there is struct domain *. I can only guess that
the domain ID is needed for the time until the domain pointer was actually
filled.

> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -339,6 +339,9 @@ static struct boot_info *__init multiboot_fill_boot_info(
>      /* Variable 'i' should be one entry past the last module. */
>      bi->mods[i].type = BOOTMOD_XEN;
>  
> +    for ( i = 0; i < MAX_NR_BOOTDOMS; i++ )
> +        bi->domains[i].domid = DOMID_INVALID;

Generally I think ARRAY_SIZE() is better to use for loop boundaries. Yet
then - why don't you statically initialize the array in xen_boot_info?

> @@ -977,7 +980,6 @@ static struct domain *__init create_dom0(struct boot_info *bi)
>      };
>      struct boot_domain *bd = &bi->domains[0];
>      struct domain *d;
> -    domid_t domid;
>  
>      if ( opt_dom0_pvh )
>      {
> @@ -993,15 +995,15 @@ static struct domain *__init create_dom0(struct boot_info *bi)
>          dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
>  
>      /* Create initial domain.  Not d0 for pvshim. */
> -    domid = get_initial_domain_id();
> -    d = domain_create(domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged);
> +    bd->domid = get_initial_domain_id();
> +    d = domain_create(bd->domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged);
>      if ( IS_ERR(d) )
> -        panic("Error creating d%u: %ld\n", domid, PTR_ERR(d));
> +        panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(d));

As to the comment at the top - this change alone certainly doesn't clarify
the "why".

>      init_dom0_cpuid_policy(d);
>  
>      if ( alloc_dom0_vcpu0(d) == NULL )
> -        panic("Error creating d%uv0\n", domid);
> +        panic("Error creating d%uv0\n", bd->domid);

Imo this would better use d->domain_id. And while touching it, %u would also
want swapping for %d.

Jan


  parent reply	other threads:[~2024-11-27 10:32 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
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 [this message]
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=bfbd15eb-9888-4988-b9a1-8191a696a4c2@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=christopher.w.clark@gmail.com \
    --cc=dpsmith@apertussolutions.com \
    --cc=jason.andryuk@amd.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.