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

RE: [PATCH v7 2/6] xen/x86: move generically usable NUMA code from x86 to common


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Mon, 7 Nov 2022 10:09:36 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • 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=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g2D1WVBIkXQWLQXPSwj6jwCDPYZEn9bTpcIizuYfUcw=; b=kbXjVRsiUwI1Sbs1tQFuhcrWSaJ5nL4fJh6fTVzMNya8QyBsXsygs9J8RrQbnVyF+xM221zwmmzNJq815Rki7wGAthadzsKY/sKEaP/UCAEz9lCbwfeixMOCVbTpXnVhMQ9wforpGJk9y0iA5TOLnaEz57ti2CkEa+3HnyFfJ6gBEIH8ma1v91u8z7H6qDFlnH7MwoiqUeecd5vc1t+M+/jT+MO0IdauCiSC257+sj9t6gHHnIiq4PJrlF0tRZFUJB4bizNe4R3JZJ1WkWpT6GTPyofwe+ObMg0vMSlG9rS0iXQ5+BBxt+R5RBBSwrehA9YZFFVzUEMwuEM6GyGujQ==
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g2D1WVBIkXQWLQXPSwj6jwCDPYZEn9bTpcIizuYfUcw=; b=hFvAAiT9hUpejXNIongaU/NO+vi9ENIDGeynGyeRvleQPEu+48agjVTy7xD4Jewb9e8tLM8OQqhGH3RXc6A1Cb9oOKbRgEH3AJ8fh7vjn5mfvNe3nzHe61KENBnMW8x2UGAMLDsqLhyvbkFnRfXO80QMl8x/1H+hEAe5+3KHw9df2g2ncASiZVkuLEteFpzQRkcdSyHgFTsnudI2J2uP5bXiFbStuxyA4Se8A5wUxrVwHZBr5zTmGCM91bjlk2MjoD7vvGuUrUaY5ZMwKtyaUFmWNesVzlHk9ayzt+rvfYe3tG5sOUZHzYZyhFEFyBTYswP3PnjwoVyl1i8ahBWSPw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=nbZI5eNcl05vRuGz6hmB8OuJ+P6pAbKi1bWnpMQn5IrJqapTQkDDsAHdCvvbE8UedydOsIIpKfqv6CbmKOpKLFPT28xZ4ltPY74AS9soIwQF7LdNLx6ajHzvRK5Y9F/TFHwRpT38C8HFHqh2eOCmGbwmViiSW57DOO61BDF0bPyHk87oczDU8eQ86ZEL3R4vOhUsNDkcI9resdCTCB1msvigf5I9H18pVwLBN2a9jXhyAZx1pJap/07DiDaBWRR4bDEldA8yylFgXqgagjHKrxwOrNWmEFr5+GDL3fl2sdkVHmidvVoWLB9qEjbZdQKZy9RtFdkaH+shrJfXHn9mtw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B6VCzhO9owUydYJKeuLfFZxCMrnDRjJbaULqgpBPguA6nTzOUSpwYz4gptAlUetHOBzglOyAaEfRpEsaMa25jHlU6MMkNiE7gbS9N0wXJUFXOxly81zVIHFVa06rHJ3WFfe3WdJpHVTGqcU+ljbW7bwJxW/TLavTUxtaFzhmXIbSif/IJ+CV35n9T2A1CGc5aLQw0NLSdbmFdetC9T32aS9+jzalAXR0sPc88Mi7jMSvy9gNRkAvrB63lvEDnVqLTZ37eqth0+5cS9pNo0jVXBTOuK6DGN/Rma4QIp6E3cSKere7snBsCb3YmeUadk15azEPIlC+GO8erP4sldhx8w==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: nd <nd@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 07 Nov 2022 10:10:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHY5EtNNbUvPHFuhkmLf666GxDtVa4tV7mAgAX/kBA=
  • Thread-topic: [PATCH v7 2/6] xen/x86: move generically usable NUMA code from x86 to common

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 2022年11月3日 22:26
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: nd <nd@xxxxxxx>; Andrew Cooper <andrew.cooper3@xxxxxxxxxx>; Roger Pau
> Monné <roger.pau@xxxxxxxxxx>; Wei Liu <wl@xxxxxxx>; George Dunlap
> <george.dunlap@xxxxxxxxxx>; Julien Grall <julien@xxxxxxx>; Stefano
> Stabellini <sstabellini@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v7 2/6] xen/x86: move generically usable NUMA code
> from x86 to common
> 
> On 20.10.2022 08:14, Wei Chen wrote:
> > There are some codes in x86/numa.c can be shared by common
> > architectures to implememnt NUMA support. Just like some
> > variables and functions to check and store NUMA memory map.
> > And some variables and functions to do NUMA initialization.
> >
> > In this patch, we move them to common/numa.c and xen/numa.h
> > and use the CONFIG_NUMA to gate them for non-NUMA supported
> > architectures. As the target header file is Xen-style, so
> > we trim some spaces and replace tabs for the codes that has
> > been moved to xen/numa.h at the same time.
> >
> > As acpi_scan_nodes has been used in a common function, it
> > doesn't make sense to use acpi_xxx in common code, so we
> > rename it to numa_process_nodes in this patch too. After that
> > if we still use CONFIG_ACPI_NUMA in to gate numa_process_nodes
> > in numa_initmem_init, that doesn't make sense. As CONFIG_NUMA
> > will be selected by CONFIG_ACPI_NUMA for x86. So, we replace
> > CONFIG_ACPI_NUMA by CONFIG_NUMA to gate numa_process_nodes.
> >
> > As arch_numa_disabled has been implememnted for ACPI NUMA,
> > we can rename srat_disabled to numa_disabled and move it
> > to common code as well.
> >
> > The macro node_to_first_cpu(node) hasn't been used anywhere,
> > so we drop it in this patch too.
> >
> > Because some architectures allow to use all 64 physical address
> > bits, but some architectures are not (like Arm64 allows 52, 48
> > bits). In this case, we use min(PADDR_BITS, BITS_PER_LONG - 1)
> > to calculate the shift when only one node is in the system in
> > this patch too.
> >
> > Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> 
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> with one small further request (could be taken care of also while
> committing if no other need for a v8 arises):
> 

Thanks. This series is in merge conflict status now, do I need to
send a v8 to fix the merge conflict? If yes, I will fix above as
well, after PATCH#5 be reviewed.

> > --- /dev/null
> > +++ b/xen/common/numa.c
> > @@ -0,0 +1,464 @@
> > +/*
> > + * Generic VM initialization for NUMA setups.
> > + * Copyright 2002,2003 Andi Kleen, SuSE Labs.
> > + * Adapted for Xen: Ryan Harper <ryanh@xxxxxxxxxx>
> > + */
> > +
> > +#include <xen/init.h>
> > +#include <xen/keyhandler.h>
> > +#include <xen/mm.h>
> > +#include <xen/nodemask.h>
> > +#include <xen/numa.h>
> > +#include <xen/param.h>
> > +#include <xen/sched.h>
> > +#include <xen/softirq.h>
> > +
> > +struct node_data __ro_after_init node_data[MAX_NUMNODES];
> > +
> > +/* Mapping from pdx to node id */
> > +unsigned int __ro_after_init memnode_shift;
> > +unsigned long __ro_after_init memnodemapsize;
> > +nodeid_t *__ro_after_init memnodemap;
> > +static typeof(*memnodemap) __ro_after_init _memnodemap[64];
> > +
> > +nodeid_t __read_mostly cpu_to_node[NR_CPUS] = {
> > +    [0 ... NR_CPUS-1] = NUMA_NO_NODE
> > +};
> > +
> > +cpumask_t __read_mostly node_to_cpumask[MAX_NUMNODES];
> > +
> > +nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
> > +
> > +bool __ro_after_init numa_off;
> > +
> > +bool numa_disabled(void)
> > +{
> > +    return numa_off || arch_numa_disabled();
> > +}
> > +
> > +/*
> > + * Given a shift value, try to populate memnodemap[]
> > + * Returns :
> > + * 1 if OK
> > + * 0 if memnodmap[] too small (of shift too small)
> 
> May I ask that you correct this comment line: "of" (alone) makes no sense
> here. Either "or" was meant or it would want to be "because of". Unless
> this is a language tweak I'm entirely unaware of ...

Yes, if we need a v8, I will correct it.

Cheers,
Wei Chen

> 
> Jan

 


Rackspace

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