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

RE: [XEN RFC PATCH 31/40] xen/x86: move nodes_cover_memory to common


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Tue, 31 Aug 2021 13:43:29 +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=uDc6XDhcgwqufSrt4vRDMbNAi7QmKZkRLPZ4JuvlPIE=; b=gdthfebzuUt5vKSXY44lAGUA8M0zu147/fWqURQ4AFo+UL95MkueccYtSjMgJsnOY29OawrNn7OH6N5JG5b4R1H0/umTTEKnd0znFwTH8Re0I5zguC3hvqRUBfcWcKBuIFY8xtzBkw/dRh4YSHxu84G/pUA9Dh+qw1noe/M5A1au5qi6Pm2sv5Pz60Q8metQIASqQ4foDR2xLZjmNj7Hr75wdbBuDSwOokufGbk0fCnZ0sVfZQKIZaSAK6ZSKdfaLxblTnXBkny1wIyrRwb72lQ95SewJNgL6luyA8fI/Jal4a8VbI/pfjmb09xLaogkLuqCm9Ks8XjowE1Fs3pOZg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nnmS/xsga11TsBz+qtX0ZDB23FkfZ9A4ZXnsPlmgU8HAMrjPw3IjA2fANXyeXUojqI8/qwDHHuTA5IYzUNevD86nXOFJdB8Z7MkPWQ1S2qv6kfkeaRROlIHgUsbXyqv7yWWHXVMsU1gz/h2KJ3YpEyxNndYs/FIIevvZ35P2ZdRORbISIDNZ0J0twPI9w3ktBbD0Yazf01Bey/M8KR2ZaCAva3KlQ69XsfrAVNJ/jIdvt/j8HmuZnRUhhH37tBlzjYi/VfXZUsOyZyPx9ZjAuIrQA2qXuohxM1dXegBXi/e3V1sZXb5+X3mXgfhXZ/N1wttKcsRqbF0568IH6c/tEw==
  • 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 13:43:54 +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: AQHXjptKZECAg9VCjEW42dN79DG/FauM7oIAgADJbwA=
  • Thread-topic: [XEN RFC PATCH 31/40] xen/x86: move nodes_cover_memory to common

Hi Stefano,

> -----Original Message-----
> From: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Sent: 2021年8月31日 9:17
> 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 31/40] xen/x86: move nodes_cover_memory to
> common
> 
> On Wed, 11 Aug 2021, Wei Chen wrote:
> > Not only ACPU NUMA, but also Arm device tree based NUMA
> > will use nodes_cover_memory to do sanity check. So we move
> > this function from arch/x86 to common.
> >
> > Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> > ---
> >  xen/arch/x86/srat.c    | 40 ----------------------------------------
> >  xen/common/numa.c      | 40 ++++++++++++++++++++++++++++++++++++++++
> >  xen/include/xen/numa.h |  1 +
> >  3 files changed, 41 insertions(+), 40 deletions(-)
> >
> > diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
> > index dd3aa30843..dcebc7adec 100644
> > --- a/xen/arch/x86/srat.c
> > +++ b/xen/arch/x86/srat.c
> > @@ -308,46 +308,6 @@ acpi_numa_memory_affinity_init(const struct
> acpi_srat_mem_affinity *ma)
> >     num_node_memblks++;
> >  }
> >
> > -/* Sanity check to catch more bad SRATs (they are amazingly common).
> > -   Make sure the PXMs cover all memory. */
> > -static int __init nodes_cover_memory(void)
> > -{
> > -   int i;
> > -   uint32_t nr_banks = arch_meminfo_get_nr_bank();
> > -
> > -   for (i = 0; i < nr_banks; i++) {
> > -           int j, found;
> > -           unsigned long long start, end;
> > -
> > -           if (arch_meminfo_get_ram_bank_range(i, &start, &end)) {
> > -                   continue;
> > -           }
> > -
> > -           do {
> > -                   found = 0;
> > -                   for_each_node_mask(j, memory_nodes_parsed)
> > -                           if (start < nodes[j].end
> > -                               && end > nodes[j].start) {
> > -                                   if (start >= nodes[j].start) {
> > -                                           start = nodes[j].end;
> > -                                           found = 1;
> > -                                   }
> > -                                   if (end <= nodes[j].end) {
> > -                                           end = nodes[j].start;
> > -                                           found = 1;
> > -                                   }
> > -                           }
> > -           } while (found && start < end);
> > -
> > -           if (start < end) {
> > -                   printk(KERN_ERR "SRAT: No PXM for e820 range: "
> > -                           "%016Lx - %016Lx\n", start, end);
> > -                   return 0;
> > -           }
> > -   }
> > -   return 1;
> > -}
> > -
> >  void __init acpi_numa_arch_fixup(void) {}
> >
> >  static uint64_t __initdata srat_region_mask;
> > diff --git a/xen/common/numa.c b/xen/common/numa.c
> > index 79ab250543..74960885a6 100644
> > --- a/xen/common/numa.c
> > +++ b/xen/common/numa.c
> > @@ -193,6 +193,46 @@ void __init cutoff_node(int i, u64 start, u64 end)
> >     }
> >  }
> >
> > +/* Sanity check to catch more bad SRATs (they are amazingly common).
> > +   Make sure the PXMs cover all memory. */
> > +int __init nodes_cover_memory(void)
> > +{
> > +   int i;
> > +   uint32_t nr_banks = arch_meminfo_get_nr_bank();
> > +
> > +   for (i = 0; i < nr_banks; i++) {
> > +           int j, found;
> > +           unsigned long long start, end;
> > +
> > +           if (arch_meminfo_get_ram_bank_range(i, &start, &end)) {
> > +                   continue;
> > +           }
> > +
> > +           do {
> > +                   found = 0;
> > +                   for_each_node_mask(j, memory_nodes_parsed)
> > +                           if (start < nodes[j].end
> > +                               && end > nodes[j].start) {
> > +                                   if (start >= nodes[j].start) {
> > +                                           start = nodes[j].end;
> > +                                           found = 1;
> > +                                   }
> > +                                   if (end <= nodes[j].end) {
> > +                                           end = nodes[j].start;
> > +                                           found = 1;
> > +                                   }
> > +                           }
> > +           } while (found && start < end);
> > +
> > +           if (start < end) {
> > +                   printk(KERN_ERR "SRAT: No PXM for e820 range: "
> > +                           "%016Lx - %016Lx\n", start, end);
> 
> I don't know if you are already doing this in a later patch but the
> message shouldn't say e820 as it doesn't exist on all architecture.
> Maybe "for address range" or "for memory range" would suffice.
> 
> Normally we don't do change together with code movement but in this case
> I think it would be OK.

OK, I will do it in next version.

 


Rackspace

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