Re: [PATCH -next v2] mm/hotplug: fix a null-ptr-deref during NUMA boot

From: Pingfan Liu
Date: Mon Jun 24 2019 - 04:42:34 EST


Hi Michal,

What about dropping the change of the online definition of your patch,
just do the following?
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index e6dad60..9c087c3 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -749,13 +749,12 @@ static void __init init_memory_less_node(int nid)
*/
void __init init_cpu_to_node(void)
{
- int cpu;
+ int cpu, node;
u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);

BUG_ON(cpu_to_apicid == NULL);

- for_each_possible_cpu(cpu) {
- int node = numa_cpu_node(cpu);
+ for_each_node_mask(node, numa_nodes_parsed) {

if (node == NUMA_NO_NODE)
continue;
@@ -765,6 +764,10 @@ void __init init_cpu_to_node(void)

numa_set_node(cpu, node);
}
+ for_each_possible_cpu(cpu) {
+ int node = numa_cpu_node(cpu);
+ numa_set_node(cpu, node);
+ }
}

Thanks,
Pingfan

On Fri, Jun 21, 2019 at 9:55 PM Michal Hocko <mhocko@xxxxxxxxxx> wrote:
>
> On Fri 21-06-19 09:17:58, Qian Cai wrote:
> > Sigh...
> >
> > I don't see any benefit to keep the broken commit,
> >
> > "x86, numa: always initialize all possible nodes"
> >
> > for so long in linux-next that just prevent x86 NUMA machines with any memory-
> > less node from booting.
> >
> > Andrew, maybe it is time to drop this patch until Michal found some time to fix
> > it properly.
>
> Yes, please drop the patch for now, Andrew. I thought I could get to
> this but time is just scarce.
> --
> Michal Hocko
> SUSE Labs