[PATCH] riscv: cpu-hotplug: clear cpu from numa map when teardown

Atish Patra atishp at atishpatra.org
Thu Feb 10 11:35:14 PST 2022


On Tue, Feb 8, 2022 at 5:13 PM Palmer Dabbelt <palmer at dabbelt.com> wrote:
>
> On Sun, 23 Jan 2022 04:13:52 PST (-0800), kernelfans at gmail.com wrote:
> > There is numa_add_cpu() when cpus online, accordingly, there should be
> > numa_remove_cpu() when cpus offline.
> >
> > Signed-off-by: Pingfan Liu <kernelfans at gmail.com>
> > Cc: Paul Walmsley <paul.walmsley at sifive.com>
> > Cc: Palmer Dabbelt <palmer at dabbelt.com>
> > Cc: Albert Ou <aou at eecs.berkeley.edu>
> > Cc: Jisheng Zhang <jszhang at kernel.org>
> > To: linux-riscv at lists.infradead.org
> > ---
> >  arch/riscv/kernel/cpu-hotplug.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/riscv/kernel/cpu-hotplug.c b/arch/riscv/kernel/cpu-hotplug.c
> > index be7f05b542bb..78d156a359ef 100644
> > --- a/arch/riscv/kernel/cpu-hotplug.c
> > +++ b/arch/riscv/kernel/cpu-hotplug.c
> > @@ -40,6 +40,7 @@ int __cpu_disable(void)
> >               return ret;
> >
> >       remove_cpu_topology(cpu);
> > +     numa_remove_cpu(cpu);
> >       set_cpu_online(cpu, false);
> >       irq_migrate_all_off_this_cpu();
>
> Thanks, this is on fixes.  I don't really have any NUMA-related test
> setups, but if someone has a QEMU-based config that's meaningful then
> I'm happy to add it.
>

lscpu/numactl already checks the online cpu list and prints correct output
without the fix which explains why I did not notice this earlier.

This is the correct thing to do anyways. Thanks for the fix.

Tested-by: Atish Patra <atishp at rivosinc.com>

Here is my qemu config
qemu-system-riscv64 -cpu rv64 -M virt -m 1G -smp 4 \
-objectmemory-backend-ram,size=512M,policy=bind,host-nodes=0,id=ram-node0
\
-numa node,memdev=ram-node0 \
-object memory-backend-ram,size=512M,policy=bind,host-nodes=0,id=ram-node1 \
-numa node,memdev=ram-node1

> _______________________________________________
> linux-riscv mailing list
> linux-riscv at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv



-- 
Regards,
Atish



More information about the linux-riscv mailing list