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

RE: [PATCH 32/37] xen/arm: unified entry to parse all NUMA data from device tree


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Fri, 24 Sep 2021 07:58:15 +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; bh=LPOKGE2c7b+0EaNxWhyU8qdtwe1wc73sG+KhY52GqZM=; b=DaYy+RMH08D6CDeg+3SynvK7dqaj7XZIevbydUe+SSqE5L+/5KV3lLD7NHWo9PyMIAJzY/stVgW1MdWPkOoHMA4UjcauPGS2S+dnx2nuy9lm8m0xKtj75KHYKL7QirGzurMj1toi8g4JXB5bQhfHXMKe+IrzZdSHHb0JzoAUNuM2mXAp6Q/65NwLqJHrMr2IRmgDQYo+EoVqaBZt8zLUA5QQ7HyIrfwNB0A5bH2DSapO3Js9Tjj394mvMh2LBtvr5RHLCW8PJWWJmKRgPpPB4IxjFRrwhOdvqJYRa1tLxgbWy+XjscxkYjT0srRPed5jQFSoBnw5mpepi4YPdKlB6g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lUft3LcFVvbOtORL2WTEPsXlnRNWnPEEptHlIPGSJ645ReprVLcFNIYcUTvtCCpcrRDGA5oQbZKRK2THgSrmAowyY1tZHENSp2q15Qbnqjn/knL7FlcT/6bZG0ZI8pWyyrti6RjRvrpXkNZ6lZcUz6Nh/45AiRQuUVuDo+chTheLNuqKJWxeDas8pa7Q+88o13dl6fptGEBj85nAn7pi6czGUSRNntPVvXM4rYZwLC1wJO0X1M+/sOv8Hc3OUTJrwcRyKAUWr9i2Q7tFkNNI64AUiW8jVPGwd7CL7KIDD2KCXNT43TKvLYHC4VXnTWJ7jT10gMNpr6XHNW0WaL+Ozw==
  • Authentication-results-original: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Fri, 24 Sep 2021 07:58:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXsHM2z1sQ26jXekKStLWrlrd1WKuyhFCAgABOShA=
  • Thread-topic: [PATCH 32/37] xen/arm: unified entry to parse all NUMA data from device tree

Hi Stefano,

> -----Original Message-----
> From: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Sent: 2021年9月24日 11:17
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx; sstabellini@xxxxxxxxxx; julien@xxxxxxx;
> Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
> Subject: Re: [PATCH 32/37] xen/arm: unified entry to parse all NUMA data
> from device tree
> 
> On Thu, 23 Sep 2021, Wei Chen wrote:
> > In this API, we scan whole device tree to parse CPU node id, memory
>           ^ function   ^ the whole
> 
> > node id and distance-map. Though early_scan_node will invoke has a
> > handler to process memory nodes. If we want to parse memory node id
> > in this handler, we have to embeded NUMA parse code in this handler.
>                               ^ embed
> 
> > But we still need to scan whole device tree to find CPU NUMA id and
> > distance-map. In this case, we include memory NUMA id parse in this
> > API too. Another benefit is that we have a unique entry for device
>   ^ function
> 
> > tree NUMA data parse.
> 
> Ah, that's the explanation I was asking for earlier!
> 

The question about device_tree_get_meminfo?

> 
> > Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> > ---
> >  xen/arch/arm/numa_device_tree.c | 30 ++++++++++++++++++++++++++++++
> >  xen/include/asm-arm/numa.h      |  1 +
> >  2 files changed, 31 insertions(+)
> >
> > diff --git a/xen/arch/arm/numa_device_tree.c
> b/xen/arch/arm/numa_device_tree.c
> > index e7fa84df4c..6a3fed0002 100644
> > --- a/xen/arch/arm/numa_device_tree.c
> > +++ b/xen/arch/arm/numa_device_tree.c
> > @@ -242,3 +242,33 @@ static int __init
> fdt_parse_numa_distance_map_v1(const void *fdt, int node)
> >
> >      return 0;
> >  }
> > +
> > +static int __init fdt_scan_numa_nodes(const void *fdt,
> > +                int node, const char *uname, int depth,
> > +                u32 address_cells, u32 size_cells, void *data)
> 
> Please align parameters
> 

OK

> 
> > +{
> > +    int len, ret = 0;
> > +    const void *prop;
> > +
> > +    prop = fdt_getprop(fdt, node, "device_type", &len);
> > +    if (prop)
> 
> code style
> 

OK

> 
> > +    {
> > +        len += 1;
> > +        if ( memcmp(prop, "cpu", len) == 0 )
> > +            ret = fdt_parse_numa_cpu_node(fdt, node);
> > +        else if ( memcmp(prop, "memory", len) == 0 )
> > +            ret = fdt_parse_numa_memory_node(fdt, node, uname,
> > +                                address_cells, size_cells);
> 
> I realize that with the inclusion of '\0' in the check, the usage of
> memcmp should be safe, but I would prefer if we used strncmp instead.
> 

Ok, I will use strncmp in next version.

> 
> > +    }
> > +    else if ( fdt_node_check_compatible(fdt, node,
> > +                                "numa-distance-map-v1") == 0 )
> > +        ret = fdt_parse_numa_distance_map_v1(fdt, node);
> > +
> > +    return ret;
> > +}
> > +
> > +/* Initialize NUMA from device tree */
> > +int __init numa_device_tree_init(const void *fdt)
> > +{
> > +    return device_tree_for_each_node(fdt, 0, fdt_scan_numa_nodes, NULL);
> > +}
> > diff --git a/xen/include/asm-arm/numa.h b/xen/include/asm-arm/numa.h
> > index 7675012cb7..f46e8e2935 100644
> > --- a/xen/include/asm-arm/numa.h
> > +++ b/xen/include/asm-arm/numa.h
> > @@ -23,6 +23,7 @@ typedef u8 nodeid_t;
> >  #define NR_NODE_MEMBLKS NR_MEM_BANKS
> >
> >  extern void numa_set_distance(nodeid_t from, nodeid_t to, uint32_t
> distance);
> > +extern int numa_device_tree_init(const void *fdt);
> >
> >  #else
> >
> > --
> > 2.25.1
> >

 


Rackspace

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