Message ID | 1474397195-16520-1-git-send-email-ddaney.cavm@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 20.09.16 11:46:35, David Daney wrote: > From: David Daney <david.daney@cavium.com> ... > Fix by moving call to numa_store_cpu_info() for all CPUs into > smp_prepare_cpus(), which happens before wq_numa_init(). Since > smp_store_cpu_info() now contains only a single function call, > simplify by removing the function and out-lining its contents. > > Suggested-by: Robert Richter <rric@kernel.org> > fixes: 1a2db300348b ("arm64, numa: Add NUMA support for arm64 platforms.") > Cc: <stable@vger.kernel.org> # 4.7.x- > Signed-off-by: David Daney <david.daney@cavium.com> > --- > arch/arm64/kernel/smp.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) Looks good, your version properly initializes the boot cpu that was missing in my version. Reviewed-by: Robert Richter <rrichter@cavium.com>
On 2016/9/21 2:46, David Daney wrote: > From: David Daney <david.daney@cavium.com> > > Fix by moving call to numa_store_cpu_info() for all CPUs into > smp_prepare_cpus(), which happens before wq_numa_init(). Since > smp_store_cpu_info() now contains only a single function call, > simplify by removing the function and out-lining its contents. > > Suggested-by: Robert Richter <rric@kernel.org> > fixes: 1a2db300348b ("arm64, numa: Add NUMA support for arm64 platforms.") > Cc: <stable@vger.kernel.org> # 4.7.x- > Signed-off-by: David Daney <david.daney@cavium.com> > --- Tested-by: Yisheng Xie <xieyisheng1@huawei.com> Thanks. > arch/arm64/kernel/smp.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c > index d93d433..3ff173e 100644 > --- a/arch/arm64/kernel/smp.c > +++ b/arch/arm64/kernel/smp.c > @@ -201,12 +201,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) > return ret; > } > > -static void smp_store_cpu_info(unsigned int cpuid) > -{ > - store_cpu_topology(cpuid); > - numa_store_cpu_info(cpuid); > -} > - > /* > * This is the secondary CPU boot entry. We're using this CPUs > * idle thread stack, but a set of temporary page tables. > @@ -254,7 +248,7 @@ asmlinkage void secondary_start_kernel(void) > */ > notify_cpu_starting(cpu); > > - smp_store_cpu_info(cpu); > + store_cpu_topology(cpu); > > /* > * OK, now it's safe to let the boot CPU continue. Wait for > @@ -689,10 +683,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) > { > int err; > unsigned int cpu; > + unsigned int this_cpu; > > init_cpu_topology(); > > - smp_store_cpu_info(smp_processor_id()); > + this_cpu = smp_processor_id(); > + store_cpu_topology(this_cpu); > + numa_store_cpu_info(this_cpu); > > /* > * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set > @@ -719,6 +716,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) > continue; > > set_cpu_present(cpu, true); > + numa_store_cpu_info(cpu); > } > } > >
On Tue, Sep 20, 2016 at 11:46:35AM -0700, David Daney wrote: > From: David Daney <david.daney@cavium.com> > > The wq_numa_init() function makes a private CPU to node map by calling > cpu_to_node() early in the boot process, before the non-boot CPUs are > brought online. Since the default implementation of cpu_to_node() > returns zero for CPUs that have never been brought online, the > workqueue system's view is that *all* CPUs are on node zero. > > When the unbound workqueue for a non-zero node is created, the > tsk_cpus_allowed() for the worker threads is the empty set because > there are, in the view of the workqueue system, no CPUs on non-zero > nodes. The code in try_to_wake_up() using this empty cpumask ends up > using the cpumask empty set value of NR_CPUS as an index into the > per-CPU area pointer array, and gets garbage as it is one past the end > of the array. This results in: Queued for 4.8. Thanks.
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index d93d433..3ff173e 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -201,12 +201,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) return ret; } -static void smp_store_cpu_info(unsigned int cpuid) -{ - store_cpu_topology(cpuid); - numa_store_cpu_info(cpuid); -} - /* * This is the secondary CPU boot entry. We're using this CPUs * idle thread stack, but a set of temporary page tables. @@ -254,7 +248,7 @@ asmlinkage void secondary_start_kernel(void) */ notify_cpu_starting(cpu); - smp_store_cpu_info(cpu); + store_cpu_topology(cpu); /* * OK, now it's safe to let the boot CPU continue. Wait for @@ -689,10 +683,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) { int err; unsigned int cpu; + unsigned int this_cpu; init_cpu_topology(); - smp_store_cpu_info(smp_processor_id()); + this_cpu = smp_processor_id(); + store_cpu_topology(this_cpu); + numa_store_cpu_info(this_cpu); /* * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set @@ -719,6 +716,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) continue; set_cpu_present(cpu, true); + numa_store_cpu_info(cpu); } }