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

RE: [XEN RFC PATCH 28/40] xen/x86: decouple nodes_cover_memory with E820 map


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Tue, 31 Aug 2021 10:19:33 +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=4IKDhjHP13ikJp4Gm+eQQ6AijbsnKgH1sgcEPVXV8R4=; b=jlcADDo2uJI6TaZ7wn1+Xl/Fx7RknmCnypGsphD0r7E+Vgqu1FRWCisbx3t51LEEcSIPAm9+rZMMnE1qBG0gGKI5my93i+JXnCuUjaR52yX4M8/IuOynREpShrdjGnbTollW9gPrfWMWNYpRhV6ooao1p/2W8TsOLqgMqNB7hPG+ZXCY1Q2S8GPH2hQ0/j9cnfOFH2wzY6VBsiz3YLOcNrXOapwwjqQtnQiRLRGXOMNSr0ZGCfFQano0Cih3SjAdArzDkPl/3kZRqhcPlSiHU/4Y3BV6My4rWfN4pbgq81npRHrtdoMizlEd6ChlztbXz4Z6+3/9bpToJPAmKlu9hA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XHfEspqa+rMsKGfAkgGjF3FQwJ+5xgY+LYjLwD0KTkjzGE/oWhfXy33AwhNDyQsN/Jy9lBVQ2UCfJML7bUiUwcVZddq79kAWxxU7U126I5IJD9rp9dp1Iqtx2CCAlIZ1r0Ut64mO+2/RRa0rCdbJzClychy9J8KG3tkknGk2ooN6CrsY1K8V9ZOH766jqsWlmb+jeAtSXmaWelxfz7nQAuD86vbwZFj4CXEpmh5oLYI/5wmEnJm3zwVWKgRdXGczQpra0e1f/7b5QyV4LdAxwyxXsf/VsUCStFPGK0uFQd8nLdip1V4wWIaQamHxO8mEFcFWI0tTrU4WKLOVgQR5Xw==
  • 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: Tue, 31 Aug 2021 10:19:49 +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: AQHXjptHSBshcE01bUa1mLwvQ77KFKuM6/qAgACaDsA=
  • Thread-topic: [XEN RFC PATCH 28/40] xen/x86: decouple nodes_cover_memory with E820 map

Hi Stefano,

> -----Original Message-----
> From: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Sent: 2021年8月31日 9:08
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx; sstabellini@xxxxxxxxxx; julien@xxxxxxx;
> jbeulich@xxxxxxxx; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
> Subject: Re: [XEN RFC PATCH 28/40] xen/x86: decouple nodes_cover_memory
> with E820 map
> 
> On Wed, 11 Aug 2021, Wei Chen wrote:
> > We will reuse nodes_cover_memory for Arm to check its bootmem
> > info. So we introduce two arch helpers to get memory map's
> > entry number and specified entry's range:
> >     arch_get_memory_bank_number
> >     arch_get_memory_bank_range
> >
> > Depends above two helpers, we make nodes_cover_memory become
> > architecture independent.
> 
> You might want to note that the only change from an x86 perspective is
> the additional checks:
> 
>   !start || !end
> 

Thanks, I will add it.

> 
> > Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> > ---
> >  xen/arch/x86/numa.c    | 18 ++++++++++++++++++
> >  xen/arch/x86/srat.c    |  8 +++-----
> >  xen/include/xen/numa.h |  4 ++++
> >  3 files changed, 25 insertions(+), 5 deletions(-)
> >
> > diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
> > index 6908738305..8b43be4aa7 100644
> > --- a/xen/arch/x86/numa.c
> > +++ b/xen/arch/x86/numa.c
> > @@ -128,6 +128,24 @@ unsigned int __init arch_get_dma_bitsize(void)
> >                   + PAGE_SHIFT, 32);
> >  }
> >
> > +uint32_t __init arch_meminfo_get_nr_bank(void)
> > +{
> > +   return e820.nr_map;
> > +}
> > +
> > +int __init arch_meminfo_get_ram_bank_range(int bank,
> > +   unsigned long long *start, unsigned long long *end)
> > +{
> > +   if (e820.map[bank].type != E820_RAM || !start || !end) {
> > +           return -1;
> > +   }
> > +
> > +   *start = e820.map[bank].addr;
> > +   *end = e820.map[bank].addr + e820.map[bank].size;
> > +
> > +   return 0;
> > +}
> > +
> >  static void dump_numa(unsigned char key)
> >  {
> >      s_time_t now = NOW();
> > diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
> > index 6d68b8a614..2298353846 100644
> > --- a/xen/arch/x86/srat.c
> > +++ b/xen/arch/x86/srat.c
> > @@ -316,18 +316,16 @@ acpi_numa_memory_affinity_init(const struct
> acpi_srat_mem_affinity *ma)
> >  static int __init nodes_cover_memory(void)
> >  {
> >     int i;
> > +   uint32_t nr_banks = arch_meminfo_get_nr_bank();
> >
> > -   for (i = 0; i < e820.nr_map; i++) {
> > +   for (i = 0; i < nr_banks; i++) {
> >             int j, found;
> >             unsigned long long start, end;
> >
> > -           if (e820.map[i].type != E820_RAM) {
> > +           if (arch_meminfo_get_ram_bank_range(i, &start, &end)) {
> >                     continue;
> >             }
> >
> > -           start = e820.map[i].addr;
> > -           end = e820.map[i].addr + e820.map[i].size;
> > -
> >             do {
> >                     found = 0;
> >                     for_each_node_mask(j, memory_nodes_parsed)
> > diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
> > index 0475823b13..6d18059bcd 100644
> > --- a/xen/include/xen/numa.h
> > +++ b/xen/include/xen/numa.h
> > @@ -89,6 +89,10 @@ static inline void clear_node_cpumask(int cpu)
> >     cpumask_clear_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
> >  }
> >
> > +extern uint32_t arch_meminfo_get_nr_bank(void);
> > +extern int arch_meminfo_get_ram_bank_range(int bank,
> > +    unsigned long long *start, unsigned long long *end);
> > +
> >  #endif /* CONFIG_NUMA */
> >
> >  #endif /* _XEN_NUMA_H */
> > --
> > 2.25.1
> >

 


Rackspace

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