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

Re: [PATCH v1 14/18] x86: generalize vcpu for domain building


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 27 Jul 2022 14:46:02 +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=zqd+48DSo0RjELBHKVqgoD0AjchervHlYUoDIDGCM84=; b=ciBb/WvIF+1A+ANl3+A9O+F9f+Nxkx/w/ksDR4XIb4CqBXZV5K/sJ2ArH/HREsfRoW75jfI6HqUMDUYmTRbrkEPKaEXhmNSKkuBzkqfPum+MT9HQDzMHz+dvvTgCnlm6AA10aM75OYKp0wS9FIF3ezaWcI/bYHsqykv6j7Dp2QPnNnuJ4qfYv6UQh/xmp+lvB4lOJFmKLwePGi5U4qMJs0EyomQN5HUs3TZUCrcZbeR7yFC0GWtAmrAhZ25RP51fat/SudQTk6s7NG9/154LCpd3I+pYdRD6w3YZZHUnzB00jaQe1TgiCoTX5VOmS8sgqw6JTsZhr3uodurbjNH3Dw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZDRfXKRJTe6GTYhJgqRsINqQO3OKRWb7cORYqjJjh91MgfsMd1k5ywmJJ0DjnWuI0UuouwXDgaDa+czlv3yjSvVa+K+jjeNf3CWHlADTqXce9F8tHWjTHoX26kk8s6cR+U7AJQE6TTutk1Tlm0N8noLwBSu3lThe+Tns7JVU8r6y6hbHKhJ2VC9rnVLD6UxasaIeBCX261DD4RZphuEmZUpBN0Cef0RSGOLalK7p2RmbOMUDeHrdNUaIiU+6aof3n7KLv02ZN8W66093rfxIdPbhiv5IIIolN8mx0TQC3ymi96o0aUo8Ke/frc908IJ46NZ2CW4wn2szILx6DTiH+A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: scott.davis@xxxxxxxxxx, christopher.clark@xxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 27 Jul 2022 12:46:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.07.2022 23:04, Daniel P. Smith wrote:
> Here, the vcpu initialization code for dom0 creation is generalized for use 
> for
> other domains.

Yet with "other domains" still only ones created during boot, aiui.
Imo such details want spelling out.

The title also is too generic / imprecise.

> --- a/xen/arch/x86/domain_builder.c
> +++ b/xen/arch/x86/domain_builder.c
> @@ -28,6 +28,18 @@ static unsigned int __init dom_max_vcpus(struct 
> boot_domain *bd)
>          return bd->ncpus;
>  }
>  
> +struct vcpu *__init alloc_dom_vcpu0(struct boot_domain *bd)

domain_alloc_vcpu0()?

> +{
> +    if ( bd->functions & BUILD_FUNCTION_INITIAL_DOM )
> +        return alloc_dom0_vcpu0(bd->domain);
> +
> +    bd->domain->node_affinity = node_online_map;
> +    bd->domain->auto_node_affinity = true;

I can spot neither consumers of nor code being replaced by this.

> +    return vcpu_create(bd->domain, 0);
> +}
> +
> +
>  void __init arch_create_dom(

No double blank lines please.

> --- a/xen/common/sched/core.c
> +++ b/xen/common/sched/core.c
> @@ -14,6 +14,8 @@
>   */
>  
>  #ifndef COMPAT
> +#include <xen/bootdomain.h>
> +#include <xen/domain_builder.h>
>  #include <xen/init.h>
>  #include <xen/lib.h>
>  #include <xen/param.h>
> @@ -3399,13 +3401,13 @@ void wait(void)
>  }
>  
>  #ifdef CONFIG_X86
> -void __init sched_setup_dom0_vcpus(struct domain *d)
> +void __init sched_setup_dom_vcpus(struct boot_domain *bd)

Perhaps simply drop the original _dom0 infix?

>  {
>      unsigned int i;
>      struct sched_unit *unit;
>  
> -    for ( i = 1; i < d->max_vcpus; i++ )
> -        vcpu_create(d, i);
> +    for ( i = 1; i < bd->domain->max_vcpus; i++ )
> +        vcpu_create(bd->domain, i);

Seeing the further uses below, perhaps better introduce a local variable
"d", like you do elsewhere?

> @@ -3413,19 +3415,24 @@ void __init sched_setup_dom0_vcpus(struct domain *d)
>       * onlining them. This avoids pinning a vcpu to a not yet online cpu 
> here.
>       */
>      if ( pv_shim )
> -        sched_set_affinity(d->vcpu[0]->sched_unit,
> +        sched_set_affinity(bd->domain->vcpu[0]->sched_unit,
>                             cpumask_of(0), cpumask_of(0));
>      else
>      {
> -        for_each_sched_unit ( d, unit )
> +        for_each_sched_unit ( bd->domain, unit )
>          {
> -            if ( !opt_dom0_vcpus_pin && !dom0_affinity_relaxed )
> -                sched_set_affinity(unit, &dom0_cpus, NULL);
> -            sched_set_affinity(unit, NULL, &dom0_cpus);
> +            if ( builder_is_initdom(bd) )
> +            {
> +                if ( !opt_dom0_vcpus_pin && !dom0_affinity_relaxed )
> +                    sched_set_affinity(unit, &dom0_cpus, NULL);
> +                sched_set_affinity(unit, NULL, &dom0_cpus);
> +            }
> +            else
> +                sched_set_affinity(unit, NULL, cpupool_valid_cpus(cpupool0));

Hard-coded cpupool0?

> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -2,6 +2,7 @@
>  #ifndef __SCHED_H__
>  #define __SCHED_H__
>  
> +#include <xen/bootdomain.h>

Please don't - this header has already too many dependencies. All you really
need ...

> @@ -1003,7 +1004,7 @@ static inline bool sched_has_urgent_vcpu(void)
>  }
>  
>  void vcpu_set_periodic_timer(struct vcpu *v, s_time_t value);
> -void sched_setup_dom0_vcpus(struct domain *d);
> +void sched_setup_dom_vcpus(struct boot_domain *d);

... for this is a forward declaration of struct boot_domain.

Jan



 


Rackspace

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