Hi Stefano,

> -----Original Message-----
> From: Stefano Stabellini <[email protected]>
> Sent: 2021年8月31日 9:51
> To: Wei Chen <[email protected]>
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; Bertrand Marquis <[email protected]>
> Subject: Re: [XEN RFC PATCH 38/40] xen/arm: enable device tree based NUMA
> in system init
> 
> On Wed, 11 Aug 2021, Wei Chen wrote:
> > Everything is ready, we can remove the fake NUMA node and
> > depends on device tree to create NUMA system.
> >
> > Signed-off-by: Wei Chen <[email protected]>
> > ---
> >  xen/arch/arm/numa.c        | 45 ++++++++++++++++++++++----------------
> >  xen/include/asm-arm/numa.h |  7 ------
> >  2 files changed, 26 insertions(+), 26 deletions(-)
> >
> > diff --git a/xen/arch/arm/numa.c b/xen/arch/arm/numa.c
> > index 2a18c97470..3b04220e60 100644
> > --- a/xen/arch/arm/numa.c
> > +++ b/xen/arch/arm/numa.c
> > @@ -18,6 +18,7 @@
> >   *
> >   */
> >  #include <xen/init.h>
> > +#include <xen/device_tree.h>
> >  #include <xen/nodemask.h>
> >  #include <xen/numa.h>
> >  #include <xen/pfn.h>
> > @@ -83,28 +84,34 @@ void __init numa_init(bool acpi_off)
> >      paddr_t ram_size = 0;
> >      paddr_t ram_end = 0;
> >
> > -    printk(XENLOG_WARNING
> > -        "NUMA has not been supported yet, NUMA off!\n");
> > -    /* Arm NUMA has not been implemented until this patch */
> > -    numa_off = true;
> > +    /* NUMA has been turned off through Xen parameters */
> > +    if ( numa_off )
> > +        goto mem_init;
> >
> > -    /*
> > -     * Set all cpu_to_node mapping to 0, this will make cpu_to_node
> > -     * function return 0 as previous fake cpu_to_node API.
> > -     */
> > -    for ( idx = 0; idx < NR_CPUS; idx++ )
> > -        cpu_to_node[idx] = 0;
> > -
> > -    /*
> > -     * Make node_to_cpumask, node_spanned_pages and node_start_pfn
> > -     * return as previous fake APIs.
> > -     */
> > -    for ( idx = 0; idx < MAX_NUMNODES; idx++ ) {
> > -        node_to_cpumask[idx] = cpu_online_map;
> > -        node_spanned_pages(idx) = (max_page - mfn_x(first_valid_mfn));
> > -        node_start_pfn(idx) = (mfn_x(first_valid_mfn));
> > +    /* Initialize NUMA from device tree when system is not ACPI booted
> */
> > +    if ( acpi_off )
> > +    {
> > +#ifdef CONFIG_DEVICE_TREE_NUMA
> > +        int ret = numa_device_tree_init(device_tree_flattened);
> > +        if ( !ret )
> > +            goto mem_init;
> > +        printk(XENLOG_WARNING
> > +               "Init NUMA from device tree failed, ret=%d\n", ret);
> > +#else
> > +        printk(XENLOG_WARNING
> > +               "CONFIG_DEVICE_TREE_NUMA is not set, NUMA off!\n");
> 
> I don't think we want to see this warning every time at boot when
> CONFIG_DEVICE_TREE_NUMA is off. I'd set it to XENLOG_DEBUG or remove it.
> 

OK

> Also given that we have many stub functions in
> xen/include/asm-arm/numa.h already, maybe we could also have a stub
> function for numa_device_tree_init so that we won'd need an #ifdef
> CONFIG_DEVICE_TREE_NUMA here.
> 

Yes, it's a good idea. I will do it.

> 
> > +#endif
> > +        numa_off = true;
> > +    }
> > +    else
> > +    {
> > +        /* We don't support NUMA for ACPI boot currently */
> > +        printk(XENLOG_WARNING
> > +               "ACPI NUMA has not been supported yet, NUMA off!\n");
> > +        numa_off = true;
> >      }
> >
> > +mem_init:
> >      /*
> >       * Find the minimal and maximum address of RAM, NUMA will
> >       * build a memory to node mapping table for the whole range.
> > diff --git a/xen/include/asm-arm/numa.h b/xen/include/asm-arm/numa.h
> > index a3982a94b6..425eb9aede 100644
> > --- a/xen/include/asm-arm/numa.h
> > +++ b/xen/include/asm-arm/numa.h
> > @@ -30,13 +30,6 @@ extern int numa_device_tree_init(const void *fdt);
> >  extern void numa_set_distance(nodeid_t from, nodeid_t to, uint32_t
> distance);
> >  extern void arch_numa_init_failed_fallback(void);
> >
> > -/*
> > - * Temporary for fake NUMA node, when CPU, memory and distance
> > - * matrix will be read from DTB or ACPI SRAT. The following
> > - * symbols will be removed.
> > - */
> > -extern mfn_t first_valid_mfn;
> > -
> >  #else
> >
> >  /* Fake one node for now. See also node_online_map. */
> > --
> > 2.25.1
> >

Reply via email to