From: Julien Grall <julien.grall@arm.com>
To: vijay.kilari@gmail.com, xen-devel@lists.xen.org
Cc: kevin.tian@intel.com, sstabellini@kernel.org,
wei.liu2@citrix.com, George.Dunlap@eu.citrix.com,
andrew.cooper3@citrix.com, dario.faggioli@citrix.com,
ian.jackson@eu.citrix.com, tim@xen.org, jbeulich@suse.com,
Vijaya Kumar K <Vijaya.Kumar@cavium.com>
Subject: Re: [RFC PATCH v3 16/24] ARM: NUMA: Add memory NUMA support
Date: Mon, 24 Jul 2017 13:43:14 +0100 [thread overview]
Message-ID: <904b5f95-f3de-066b-f0c6-40906a0960b5@arm.com> (raw)
In-Reply-To: <1500378106-2620-17-git-send-email-vijay.kilari@gmail.com>
Hi Vijay,
On 18/07/17 12:41, vijay.kilari@gmail.com wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
>
> Implement arch_sanitize_nodes_memory() which looks at all banks
> in bootinfo.mem, update nodes[] with corresponding nodeid.
> Call numa_scan_nodes() generic function with ram start and
> end address, which takes care of further computing memnodeshift
> and populating memnodemap[] using generic implementation.
>
> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
> ---
> v3: - Dropped common code from asm-arm/numa.h
> - Re-used numa_initmem_init() from common code.
> ---
> xen/arch/arm/numa/numa.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++-
> xen/common/numa.c | 14 +++++++++
> xen/include/xen/numa.h | 1 +
> 3 files changed, 91 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/numa/numa.c b/xen/arch/arm/numa/numa.c
> index dc80aa5..85352dc 100644
> --- a/xen/arch/arm/numa/numa.c
> +++ b/xen/arch/arm/numa/numa.c
> @@ -18,6 +18,7 @@
> #include <xen/ctype.h>
> #include <xen/nodemask.h>
> #include <xen/numa.h>
> +#include <xen/pfn.h>
> #include <asm/acpi.h>
>
> static uint8_t (*node_distance_fn)(nodeid_t a, nodeid_t b);
> @@ -64,9 +65,66 @@ void register_node_distance(uint8_t (fn)(nodeid_t a, nodeid_t b))
> node_distance_fn = fn;
> }
>
> +bool __init arch_sanitize_nodes_memory(void)
Likely when I say a function is confusing on a previous version, it
means you have to add more comments in the function...
> +{
> + nodemask_t mem_nodes_parsed;
> + int bank, nodeid;
> + struct node *nd;
> + paddr_t start, size, end;
> +
> + nodes_clear(mem_nodes_parsed);
> + for ( bank = 0 ; bank < bootinfo.mem.nr_banks; bank++ )
> + {
> + start = bootinfo.mem.bank[bank].start;
> + size = bootinfo.mem.bank[bank].size;
> + end = start + size;
> +
> + nodeid = get_mem_nodeid(start, end);
> + if ( nodeid >= NUMA_NO_NODE )
This check is very confusing.
> + {
> + printk(XENLOG_WARNING
> + "NUMA: node for mem bank start 0x%lx - 0x%lx not found\n",
start and end are paddr_t should it should be PRI_paddr.
> + start, end);
> +
> + return false;
> + }
> +
> + nd = get_numa_node(nodeid);
> + if ( !node_test_and_set(nodeid, mem_nodes_parsed) )
> + {
> + nd->start = start;
> + nd->end = end;
> + }
> + else
> + {
> + if ( start < nd->start )
> + nd->start = start;
> + if ( nd->end < end )
> + nd->end = end;
This function is called "sanitize nodes", but here you also update
start/end. Mind explaining why you need this on ARM when it is not
necessary on x86?
> + }
> + }
> +
> + return true;
> +}
> +
> +static void __init numa_reset_numa_nodes(void)
> +{
> + int i;
> + struct node *nd;
> +
> + for ( i = 0; i < MAX_NUMNODES; i++ )
> + {
> + nd = get_numa_node(i);
> + nd->start = 0;
> + nd->end = 0;
> + }
> +}
> +
> void __init numa_init(void)
> {
> - int ret = 0;
> + int ret = 0, bank;
> + paddr_t ram_start = ~0;
> + paddr_t ram_end = 0;
>
> nodes_clear(processor_nodes_parsed);
> init_cpu_to_node();
> @@ -83,6 +141,23 @@ void __init numa_init(void)
> }
>
> no_numa:
> + for ( bank = 0 ; bank < bootinfo.mem.nr_banks; bank++ )
> + {
> + paddr_t bank_start = bootinfo.mem.bank[bank].start;
> + paddr_t bank_end = bank_start + bootinfo.mem.bank[bank].size;
> +
> + ram_start = min(ram_start, bank_start);
> + ram_end = max(ram_end, bank_end);
> + }
> +
> + /*
> + * In arch_sanitize_nodes_memory() we update nodes[] properly.
> + * Hence we reset the nodes[] before calling numa_scan_nodes().
> + */
> + numa_reset_numa_nodes();
> +
> + numa_initmem_init(PFN_UP(ram_start), PFN_DOWN(ram_end));
I might miss something. numa_initmem_init is here to scan the NUMA nodes
and set them up. So why are you calling it here?
> +
> return;
> }
>
> diff --git a/xen/common/numa.c b/xen/common/numa.c
> index 5e985d2..0f79a07 100644
> --- a/xen/common/numa.c
> +++ b/xen/common/numa.c
> @@ -76,6 +76,20 @@ nodeid_t get_memblk_nodeid(unsigned int id)
> return memblk_nodeid[id];
> }
>
> +int __init get_mem_nodeid(paddr_t start, paddr_t end)
> +{
> + unsigned int i;
> +
> + for ( i = 0; i < get_num_node_memblks(); i++ )
> + {
> + if ( start >= node_memblk_range[i].start &&
> + end <= node_memblk_range[i].end )
> + return memblk_nodeid[i];
> + }
> +
> + return -EINVAL;
> +}
> +
> static nodeid_t *get_memblk_nodeid_map(void)
> {
> return &memblk_nodeid[0];
> diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
> index 8a306e7..a541eb7 100644
> --- a/xen/include/xen/numa.h
> +++ b/xen/include/xen/numa.h
> @@ -70,6 +70,7 @@ struct node *get_numa_node(unsigned int id);
> nodeid_t get_memblk_nodeid(unsigned int memblk);
> struct node *get_node_memblk_range(unsigned int memblk);
> int numa_add_memblk(nodeid_t nodeid, paddr_t start, uint64_t size);
> +int get_mem_nodeid(paddr_t start, paddr_t end);
> int get_num_node_memblks(void);
> bool arch_sanitize_nodes_memory(void);
> void numa_failed(void);
>
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-07-24 12:43 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 11:41 [RFC PATCH v3 00/24] ARM: Add Xen NUMA support vijay.kilari
2017-07-18 11:41 ` [RFC PATCH v3 01/24] NUMA: Make number of NUMA nodes configurable vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-18 17:52 ` Julien Grall
2017-07-19 8:17 ` Wei Liu
2017-07-19 15:48 ` Julien Grall
2017-07-28 10:11 ` Jan Beulich
2017-07-18 17:55 ` Julien Grall
2017-07-19 7:00 ` Vijay Kilari
2017-07-19 15:55 ` Julien Grall
2017-07-20 7:30 ` Vijay Kilari
2017-07-20 10:57 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 02/24] x86: NUMA: Clean up: Fix coding styles and drop unused code vijay.kilari
2017-07-19 16:23 ` Julien Grall
2017-07-19 16:27 ` Wei Liu
2017-07-19 16:34 ` Julien Grall
2017-07-20 7:00 ` Vijay Kilari
2017-07-20 11:00 ` Julien Grall
2017-07-20 12:05 ` Vijay Kilari
2017-07-20 12:09 ` Julien Grall
2017-07-20 12:29 ` Vijay Kilari
2017-07-20 12:33 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 03/24] x86: NUMA: Fix datatypes and attributes vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-18 11:41 ` [RFC PATCH v3 04/24] x86: NUMA: Rename and sanitize memnode shift code vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-19 17:12 ` Julien Grall
2017-07-20 6:56 ` Vijay Kilari
2017-07-18 11:41 ` [RFC PATCH v3 05/24] x86: NUMA: Add accessors for nodes[] and node_memblk_range[] structs vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-19 6:40 ` Vijay Kilari
2017-07-19 17:18 ` Julien Grall
2017-07-20 7:41 ` Vijay Kilari
2017-07-20 11:03 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 06/24] x86: NUMA: Rename some generic functions vijay.kilari
2017-07-19 17:23 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 07/24] ARM: NUMA: Add existing ARM numa code under CONFIG_NUMA vijay.kilari
2017-07-18 18:06 ` Julien Grall
2017-07-20 9:31 ` Vijay Kilari
2017-07-20 11:10 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 08/24] NUMA: x86: Move numa code and make it generic vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-18 18:16 ` Julien Grall
2017-07-19 6:47 ` Vijay Kilari
2017-07-19 17:41 ` Julien Grall
2017-07-20 8:55 ` Vijay Kilari
2017-07-20 11:14 ` Julien Grall
2017-07-24 20:28 ` Stefano Stabellini
2017-07-18 11:41 ` [RFC PATCH v3 09/24] NUMA: x86: Move common code from srat.c vijay.kilari
2017-07-20 11:17 ` Julien Grall
2017-07-20 11:43 ` Vijay Kilari
2017-07-24 20:35 ` Stefano Stabellini
2017-07-18 11:41 ` [RFC PATCH v3 10/24] NUMA: Allow numa initialization with DT vijay.kilari
2017-07-19 17:58 ` Julien Grall
2017-07-20 10:28 ` Vijay Kilari
2017-07-20 11:20 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 11/24] ARM: fdt: Export and introduce new fdt functions vijay.kilari
2017-07-18 15:29 ` Wei Liu
2017-07-18 16:29 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 12/24] ARM: NUMA: DT: Parse CPU NUMA information vijay.kilari
2017-07-19 18:26 ` Julien Grall
2017-07-20 9:20 ` Vijay Kilari
2017-07-18 11:41 ` [RFC PATCH v3 13/24] ARM: NUMA: DT: Parse memory " vijay.kilari
2017-07-19 18:39 ` Julien Grall
2017-07-20 10:37 ` Vijay Kilari
2017-07-20 11:24 ` Julien Grall
2017-07-20 11:26 ` Julien Grall
2017-07-21 11:10 ` Vijay Kilari
2017-07-21 12:35 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 14/24] ARM: NUMA: DT: Parse NUMA distance information vijay.kilari
2017-07-20 13:02 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 15/24] ARM: NUMA: DT: Add CPU NUMA support vijay.kilari
2017-07-24 11:24 ` Julien Grall
2017-07-25 6:47 ` Vijay Kilari
2017-07-25 18:38 ` Julien Grall
2017-07-25 18:48 ` Stefano Stabellini
2017-07-25 18:51 ` Julien Grall
2017-07-25 19:06 ` Stefano Stabellini
2017-07-26 17:18 ` Julien Grall
2017-07-26 17:21 ` Stefano Stabellini
2017-07-18 11:41 ` [RFC PATCH v3 16/24] ARM: NUMA: Add memory " vijay.kilari
2017-07-24 12:43 ` Julien Grall [this message]
2017-07-18 11:41 ` [RFC PATCH v3 17/24] ARM: NUMA: DT: Do not expose numa info to DOM0 vijay.kilari
2017-07-24 20:48 ` Stefano Stabellini
2017-07-26 17:22 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 18/24] ACPI: Refactor acpi SRAT and SLIT table handling code vijay.kilari
2017-07-18 15:36 ` Wei Liu
2017-07-19 6:33 ` Vijay Kilari
2017-07-18 11:41 ` [RFC PATCH v3 19/24] ARM: NUMA: Extract MPIDR from MADT table vijay.kilari
2017-07-24 22:17 ` Stefano Stabellini
2017-07-26 18:12 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 20/24] ACPI: Move arch specific SRAT parsing vijay.kilari
2017-07-24 21:15 ` Stefano Stabellini
2017-07-18 11:41 ` [RFC PATCH v3 21/24] ARM: NUMA: ACPI: Extract proximity from SRAT table vijay.kilari
2017-07-24 22:17 ` Stefano Stabellini
2017-07-26 18:18 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 22/24] ARM: NUMA: Initialize ACPI NUMA vijay.kilari
2017-07-24 22:11 ` Stefano Stabellini
2017-07-26 18:23 ` Julien Grall
2017-07-18 11:41 ` [RFC PATCH v3 23/24] NUMA: Move CONFIG_NUMA to common Kconfig vijay.kilari
2017-07-18 16:25 ` Julien Grall
2017-07-18 18:00 ` Julien Grall
2017-07-28 10:08 ` Jan Beulich
2017-07-18 11:41 ` [RFC PATCH v3 24/24] NUMA: Enable ACPI_NUMA config vijay.kilari
2017-07-18 16:18 ` [RFC PATCH v3 00/24] ARM: Add Xen NUMA support Julien Grall
2017-07-19 6:31 ` Vijay Kilari
2017-07-19 7:18 ` Julien Grall
[not found] ` <CALicx6svuo3JXik=8bYuciFzWDu6qmwVi1VXdBgjLp_f_YUhqQ@mail.gmail.com>
2017-10-06 17:09 ` vkilari
2017-10-06 17:30 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=904b5f95-f3de-066b-f0c6-40906a0960b5@arm.com \
--to=julien.grall@arm.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=Vijaya.Kumar@cavium.com \
--cc=andrew.cooper3@citrix.com \
--cc=dario.faggioli@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=kevin.tian@intel.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=vijay.kilari@gmail.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).