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

RE: [XEN RFC PATCH 39/40] xen/x86: move numa_setup to common to support NUMA switch in command line


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Sat, 28 Aug 2021 03:22:57 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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-SenderADCheck; bh=BdW5LUbKSohvr1VGur+vvw+tZt9sW/MDjmK8yQ4D5BI=; b=Fhc3He3FBkyuV2bZJL+APR+iwFc6OeCUeuPJrpoIKByL0Fs0nLe1ieq1NsHECavHL/1K7bDTyZut7RWNVhz5XSBYgmOnHFJ/nenarvg9YTUbNjq2kJxFboph85sxGOgxQMJV5xQmBsDVEdCik/9TwQ4wxnR/DiPNTavzABYx5YqGnidEMKsXT9FHzEGS3Lhm2TTyzdsjyZsa6vXE1aMsScovWzUOHXPHy3xx8bpGg86rRxqTl9e3Cyg2nZY83DQDVyIqlFfLmK8J1NDT8h1WZh1CtaXZRu4+woQhCJDljnrDLPYYqNwhBPUFnLh7uMeF62awx5/wxfwP1DeS1utPeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X72/TC+XvofyRZ9ifSZB5D+6TFjEqS/lR9mEcBGLb6QDNdHvUv6be2zpZkDbv1x3QEo8U3ZDLbtudjqTtwlW+XW8tMdlJM6Jp66gBt02mXNcTe1ksuzicuTYYpcsAxcB8KLaY/cREl4wXiLTzAox0snG47dQ0ZUVF99N1GmGAt8A/pw60IwAH48anEKU0peifQNkFDI2kOJStQrp1RJnzpfyngFj3Fr2c4qgFHOk+UWlWe3JJophGtGPzpIDALY7r8/dUVRNO/4lHA18fUjb5NFVBp3WFpC24rqFukf/6AVa84I/GQ7aZR2L8wm6TegTjFuUQ1dwVQvZY5F5aZhm/w==
  • Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Sat, 28 Aug 2021 03:23:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXjptVFJvPelB8mUqFa8hfwTS7pauHhPgAgADUYQA=
  • Thread-topic: [XEN RFC PATCH 39/40] xen/x86: move numa_setup to common to support NUMA switch in command line

Hi Julien,

> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> Sent: 2021年8月27日 22:38
> To: Wei Chen <Wei.Chen@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx;
> sstabellini@xxxxxxxxxx; jbeulich@xxxxxxxx
> Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
> Subject: Re: [XEN RFC PATCH 39/40] xen/x86: move numa_setup to common to
> support NUMA switch in command line
> 
> Hi Wei,
> 
> On 11/08/2021 11:24, Wei Chen wrote:
> > Xen x86 has created a command line parameter "numa" as NUMA switch for
> > user to turn on/off NUMA. As device tree based NUMA has been enabled
> > for Arm, this parameter can be reused by Arm. So in this patch, we move
> > this parameter to common.
> >
> > Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> > ---
> >   xen/arch/x86/numa.c    | 34 ----------------------------------
> >   xen/common/numa.c      | 35 ++++++++++++++++++++++++++++++++++-
> >   xen/include/xen/numa.h |  1 -
> >   3 files changed, 34 insertions(+), 36 deletions(-)
> >
> > diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
> > index 8b43be4aa7..380d8ed6fd 100644
> > --- a/xen/arch/x86/numa.c
> > +++ b/xen/arch/x86/numa.c
> > @@ -11,7 +11,6 @@
> >   #include <xen/nodemask.h>
> >   #include <xen/numa.h>
> >   #include <xen/keyhandler.h>
> > -#include <xen/param.h>
> >   #include <xen/time.h>
> >   #include <xen/smp.h>
> >   #include <xen/pfn.h>
> > @@ -19,9 +18,6 @@
> >   #include <xen/sched.h>
> >   #include <xen/softirq.h>
> >
> > -static int numa_setup(const char *s);
> > -custom_param("numa", numa_setup);
> > -
> >   #ifndef Dprintk
> >   #define Dprintk(x...)
> >   #endif
> > @@ -50,35 +46,6 @@ void numa_set_node(int cpu, nodeid_t node)
> >       cpu_to_node[cpu] = node;
> >   }
> >
> > -/* [numa=off] */
> > -static __init int numa_setup(const char *opt)
> > -{
> > -    if ( !strncmp(opt,"off",3) )
> > -        numa_off = true;
> > -    else if ( !strncmp(opt,"on",2) )
> > -        numa_off = false;
> > -#ifdef CONFIG_NUMA_EMU
> > -    else if ( !strncmp(opt, "fake=", 5) )
> > -    {
> > -        numa_off = false;
> > -        numa_fake = simple_strtoul(opt+5,NULL,0);
> > -        if ( numa_fake >= MAX_NUMNODES )
> > -            numa_fake = MAX_NUMNODES;
> > -    }
> > -#endif
> > -#ifdef CONFIG_ACPI_NUMA
> > -    else if ( !strncmp(opt,"noacpi",6) )
> > -    {
> > -        numa_off = false;
> > -        acpi_numa = -1;
> > -    }
> > -#endif
> > -    else
> > -        return -EINVAL;
> > -
> > -    return 0;
> > -}
> > -
> >   /*
> >    * Setup early cpu_to_node.
> >    *
> > @@ -287,4 +254,3 @@ static __init int register_numa_trigger(void)
> >       return 0;
> >   }
> >   __initcall(register_numa_trigger);
> > -
> > diff --git a/xen/common/numa.c b/xen/common/numa.c
> > index 88f1594127..c98eb8d571 100644
> > --- a/xen/common/numa.c
> > +++ b/xen/common/numa.c
> > @@ -14,8 +14,12 @@
> >   #include <xen/smp.h>
> >   #include <xen/pfn.h>
> >   #include <xen/sched.h>
> > +#include <xen/param.h>
> >   #include <asm/acpi.h>
> >
> > +static int numa_setup(const char *s);
> > +custom_param("numa", numa_setup);
> > +
> >   struct node_data node_data[MAX_NUMNODES];
> >
> >   /* Mapping from pdx to node id */
> > @@ -324,7 +328,7 @@ int __init numa_scan_nodes(u64 start, u64 end)
> >   }
> >
> >   #ifdef CONFIG_NUMA_EMU
> > -int numa_fake __initdata = 0;
> > +static int numa_fake __initdata = 0;
> >
> >   /* Numa emulation */
> >   static int __init numa_emulation(u64 start_pfn, u64 end_pfn)
> > @@ -409,3 +413,32 @@ void __init numa_initmem_init(unsigned long
> start_pfn, unsigned long end_pfn)
> >       /* architecture specified fallback operations */
> >       arch_numa_init_failed_fallback();
> >   }
> > +
> > +/* [numa=off] */
> 
> The documentation also needs be be updated to reflect that facts this
> option is not architecture-agnostic.
> 

Ok, I will update the relate document in next version.

> > +static __init int numa_setup(const char *opt)
> > +{
> > +    if ( !strncmp(opt,"off",3) )
> > +        numa_off = true;
> > +    else if ( !strncmp(opt,"on",2) )
> > +        numa_off = false;
> > +#ifdef CONFIG_NUMA_EMU
> > +    else if ( !strncmp(opt, "fake=", 5) )
> > +    {
> > +        numa_off = false;
> > +        numa_fake = simple_strtoul(opt+5,NULL,0);
> > +        if ( numa_fake >= MAX_NUMNODES )
> > +            numa_fake = MAX_NUMNODES;
> > +    }
> > +#endif
> > +#ifdef CONFIG_ACPI_NUMA
> > +    else if ( !strncmp(opt,"noacpi",6) )
> > +    {
> > +        numa_off = false;
> > +        acpi_numa = -1;
> > +    }
> > +#endif
> 
> Looking at this code, I am not quite too sure to understand the
> difference between between "numa=noacpi" and "numa=off".
> 
> In fact, I am tempted to say this option should disappear because this
> is odd to have a firmware specific option just for ACPI but not DT. Even
> if we have one for each, this makes things a bit more complicated for
> the admin.
> 

Yes, I agree. I would consider a proper way to address it in next version.
If x86 maintainers can give some background of these two options would be
better.

> > +    else
> > +        return -EINVAL;
> > +
> > +    return 0;
> > +}
> > diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
> > index b9b5d1ad88..c647fef736 100644
> > --- a/xen/include/xen/numa.h
> > +++ b/xen/include/xen/numa.h
> > @@ -83,7 +83,6 @@ extern void numa_initmem_init(unsigned long start_pfn,
> unsigned long end_pfn);
> >   extern void numa_set_node(int cpu, nodeid_t node);
> >   extern int numa_scan_nodes(u64 start, u64 end);
> >   extern bool numa_off;
> > -extern int numa_fake;
> >   extern s8 acpi_numa;
> >
> >   extern void setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end);
> >
> 
> Cheers,
> 
> --
> Julien Grall

 


Rackspace

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