* [PATCH] x86, acpi: map hotadded cpu to correct node. [not found] ` <20100203220328.GG7510@basil.fritz.box> @ 2010-02-04 11:06 ` Haicheng Li 2010-02-08 2:48 ` Haicheng Li 2010-02-10 19:39 ` [tip:x86/numa] x86, acpi: Map " tip-bot for Haicheng Li 0 siblings, 2 replies; 4+ messages in thread From: Haicheng Li @ 2010-02-04 11:06 UTC (permalink / raw) To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar Cc: Andi Kleen, Suresh.b.siddha, lenb, trenn, Zheng, Shaohui, linux-kernel, Chen, Gong, Lv, Jane x86: map hotadded cpu to correct node. When hotadd new cpu to system, if its affinitive node is online, should map the cpu to its own node. otherwise, let kernel select one online node for the new cpu later. Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com> --- arch/x86/kernel/acpi/boot.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 67e929b..92a4861 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -49,6 +49,7 @@ EXPORT_SYMBOL(acpi_disabled); #ifdef CONFIG_X86_64 # include <asm/proto.h> +# include <asm/numa_64.h> #endif /* X86 */ #define BAD_MADT_ENTRY(entry, end) ( \ @@ -482,6 +483,25 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) */ #ifdef CONFIG_ACPI_HOTPLUG_CPU +static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) +{ +#ifdef CONFIG_ACPI_NUMA + int nid; + + nid = acpi_get_node(handle); + if (!node_online(nid)) + return; +#ifdef CONFIG_X86_64 + apicid_to_node[physid] = nid; + numa_set_node(cpu, nid); +#else /* CONFIG_X86_32 */ + apicid_2_node[physid] = nid; + cpu_to_node_map[cpu] = nid; +#endif + +#endif +} + static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -540,6 +560,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu) } cpu = cpumask_first(new_map); + acpi_map_cpu2node(handle, cpu, physid); *pcpu = cpu; retval = 0; -- 1.6.0.rc1 -haicheng ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, acpi: map hotadded cpu to correct node. 2010-02-04 11:06 ` [PATCH] x86, acpi: map hotadded cpu to correct node Haicheng Li @ 2010-02-08 2:48 ` Haicheng Li 2010-02-10 15:40 ` Thomas Renninger 2010-02-10 19:39 ` [tip:x86/numa] x86, acpi: Map " tip-bot for Haicheng Li 1 sibling, 1 reply; 4+ messages in thread From: Haicheng Li @ 2010-02-08 2:48 UTC (permalink / raw) To: Haicheng Li Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, Andi Kleen, Suresh.b.siddha, lenb, trenn, Zheng, Shaohui, linux-kernel, Chen, Gong, Lv, Jane, Li, Haicheng hello, any comments on this patch? in fact, it's a straightforward bug fix: with existing CPU hotadd code, new added CPUs won't be mapped to its own node. especially for hotadding a new node with CPU and MEM, new added memories can be mapped to this new node, but new added CPUs are always mapped to old nodes. This patch is to fix this obvious bug. thanks. -haicheng Haicheng Li wrote: > x86: map hotadded cpu to correct node. > > When hotadd new cpu to system, if its affinitive node is online, should > map the cpu to its own node. otherwise, let kernel select one online > node for the new cpu later. > > Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com> > --- > arch/x86/kernel/acpi/boot.c | 21 +++++++++++++++++++++ > 1 files changed, 21 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c > index 67e929b..92a4861 100644 > --- a/arch/x86/kernel/acpi/boot.c > +++ b/arch/x86/kernel/acpi/boot.c > @@ -49,6 +49,7 @@ EXPORT_SYMBOL(acpi_disabled); > > #ifdef CONFIG_X86_64 > # include <asm/proto.h> > +# include <asm/numa_64.h> > #endif /* X86 */ > > #define BAD_MADT_ENTRY(entry, end) ( \ > @@ -482,6 +483,25 @@ int acpi_register_gsi(struct device *dev, u32 gsi, > int trigger, int polarity) > */ > #ifdef CONFIG_ACPI_HOTPLUG_CPU > > +static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) > +{ > +#ifdef CONFIG_ACPI_NUMA > + int nid; > + > + nid = acpi_get_node(handle); > + if (!node_online(nid)) > + return; > +#ifdef CONFIG_X86_64 > + apicid_to_node[physid] = nid; > + numa_set_node(cpu, nid); > +#else /* CONFIG_X86_32 */ > + apicid_2_node[physid] = nid; > + cpu_to_node_map[cpu] = nid; > +#endif > + > +#endif > +} > + > static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu) > { > struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; > @@ -540,6 +560,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle > handle, int *pcpu) > } > > cpu = cpumask_first(new_map); > + acpi_map_cpu2node(handle, cpu, physid); > > *pcpu = cpu; > retval = 0; ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, acpi: map hotadded cpu to correct node. 2010-02-08 2:48 ` Haicheng Li @ 2010-02-10 15:40 ` Thomas Renninger 0 siblings, 0 replies; 4+ messages in thread From: Thomas Renninger @ 2010-02-10 15:40 UTC (permalink / raw) To: Haicheng Li Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, Andi Kleen, Suresh.b.siddha, lenb, Zheng, Shaohui, linux-kernel, Chen, Gong, Lv, Jane, Li, Haicheng On Monday 08 February 2010 03:48:06 Haicheng Li wrote: > hello, > > any comments on this patch? in fact, it's a straightforward bug fix: with existing > CPU hotadd code, new added CPUs won't be mapped to its own node. especially for hotadding > a new node with CPU and MEM, new added memories can be mapped to this new node, but new added > CPUs are always mapped to old nodes. This patch is to fix this obvious bug. thanks. > I can confirm that this patch works as expected: Tested-by: Thomas Renninger <trenn@suse.de> While the cores previously showed up on the wrong, already existing node, they are now added to the correct one. Be aware that there seem to be other issues (Andi posted some slab memory hot plug fixes recently). Find one "nit pick" below: > -haicheng > > Haicheng Li wrote: > > x86: map hotadded cpu to correct node. > > > > When hotadd new cpu to system, if its affinitive node is online, should > > map the cpu to its own node. otherwise, let kernel select one online > > node for the new cpu later. > > > > Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com> > > --- > > arch/x86/kernel/acpi/boot.c | 21 +++++++++++++++++++++ > > 1 files changed, 21 insertions(+), 0 deletions(-) > > > > diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c > > index 67e929b..92a4861 100644 > > --- a/arch/x86/kernel/acpi/boot.c > > +++ b/arch/x86/kernel/acpi/boot.c > > @@ -49,6 +49,7 @@ EXPORT_SYMBOL(acpi_disabled); > > > > #ifdef CONFIG_X86_64 > > # include <asm/proto.h> > > +# include <asm/numa_64.h> > > #endif /* X86 */ > > > > #define BAD_MADT_ENTRY(entry, end) ( \ > > @@ -482,6 +483,25 @@ int acpi_register_gsi(struct device *dev, u32 gsi, > > int trigger, int polarity) > > */ > > #ifdef CONFIG_ACPI_HOTPLUG_CPU > > > > +static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) > > +{ > > +#ifdef CONFIG_ACPI_NUMA > > + int nid; > > + > > + nid = acpi_get_node(handle); > > + if (!node_online(nid)) if (nid == -1 || !node_online(nid)) would avoid passing an invalid param to node_online(..) node_online() probably already can handle this... A maintainer eventually could fiddle this into the patch/line without the need of re-posting. I am not that familiar with numa node handling, but went the code and spec up and down a bit. Also assigning a node no. is rather straight forward, thus I can give this a: Reviewed-by: Thomas Renninger <trenn@suse.de> Thanks, Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:x86/numa] x86, acpi: Map hotadded cpu to correct node. 2010-02-04 11:06 ` [PATCH] x86, acpi: map hotadded cpu to correct node Haicheng Li 2010-02-08 2:48 ` Haicheng Li @ 2010-02-10 19:39 ` tip-bot for Haicheng Li 1 sibling, 0 replies; 4+ messages in thread From: tip-bot for Haicheng Li @ 2010-02-10 19:39 UTC (permalink / raw) To: linux-tip-commits; +Cc: linux-kernel, haicheng.li, hpa, mingo, trenn, tglx Commit-ID: 0271f91003d3703675be13b8865618359a6caa1f Gitweb: http://git.kernel.org/tip/0271f91003d3703675be13b8865618359a6caa1f Author: Haicheng Li <haicheng.li@linux.intel.com> AuthorDate: Thu, 4 Feb 2010 19:06:33 +0800 Committer: H. Peter Anvin <hpa@zytor.com> CommitDate: Wed, 10 Feb 2010 11:00:43 -0800 x86, acpi: Map hotadded cpu to correct node. When hotadd new cpu to system, if its affinitive node is online, should map the cpu to its own node. Otherwise, let kernel select one online node for the new cpu later. Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com> LKML-Reference: <4B6AAA39.6000300@linux.intel.com> Tested-by: Thomas Renninger <trenn@suse.de> Signed-off-by: H. Peter Anvin <hpa@zytor.com> --- arch/x86/kernel/acpi/boot.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 036d28a..7db15e1 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -49,6 +49,7 @@ EXPORT_SYMBOL(acpi_disabled); #ifdef CONFIG_X86_64 # include <asm/proto.h> +# include <asm/numa_64.h> #endif /* X86 */ #define BAD_MADT_ENTRY(entry, end) ( \ @@ -482,6 +483,25 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) */ #ifdef CONFIG_ACPI_HOTPLUG_CPU +static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) +{ +#ifdef CONFIG_ACPI_NUMA + int nid; + + nid = acpi_get_node(handle); + if (nid == -1 || !node_online(nid)) + return; +#ifdef CONFIG_X86_64 + apicid_to_node[physid] = nid; + numa_set_node(cpu, nid); +#else /* CONFIG_X86_32 */ + apicid_2_node[physid] = nid; + cpu_to_node_map[cpu] = nid; +#endif + +#endif +} + static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -540,6 +560,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu) } cpu = cpumask_first(new_map); + acpi_map_cpu2node(handle, cpu, physid); *pcpu = cpu; retval = 0; ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-02-10 19:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <C8EDE645B81E5141A8C6B2F73FD9265117C58A3504@shzsmsx501.ccr.corp.intel.com>
[not found] ` <20100203220328.GG7510@basil.fritz.box>
2010-02-04 11:06 ` [PATCH] x86, acpi: map hotadded cpu to correct node Haicheng Li
2010-02-08 2:48 ` Haicheng Li
2010-02-10 15:40 ` Thomas Renninger
2010-02-10 19:39 ` [tip:x86/numa] x86, acpi: Map " tip-bot for Haicheng Li
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox