* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-24 17:19 ` Lameter, Christopher
0 siblings, 0 replies; 24+ messages in thread
From: Lameter, Christopher @ 2024-01-24 17:19 UTC (permalink / raw)
To: Huang Shijie
Cc: gregkh, patches, rafael, paul.walmsley, palmer, aou, yury.norov,
kuba, vschneid, mingo, akpm, vbabka, rppt, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
On Tue, 23 Jan 2024, Huang Shijie wrote:
> During the kernel booting, the generic cpu_to_node() is called too early in
> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>
> For arm64/powerpc/riscv, there are at least four places in the common code
> where the generic cpu_to_node() is called before it is initialized:
> 1.) early_trace_init() in kernel/trace/trace.c
> 2.) sched_init() in kernel/sched/core.c
> 3.) init_sched_fair_class() in kernel/sched/fair.c
> 4.) workqueue_init_early() in kernel/workqueue.c
>
> In order to fix the bug, the patch changes generic cpu_to_node to
> function pointer, and export it for kernel modules.
> Introduce smp_prepare_boot_cpu_start() to wrap the original
> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> and set the cpu_to_node to formal _cpu_to_node().
Would you please fix this cleanly without a function pointer?
What I think needs to be done is a patch series.
1. Instrument cpu_to_node so that some warning is issued if it is used too
early. Preloading the array with NUMA_NO_NODE would allow us to do that.
2. Implement early_cpu_to_node on platforms that currently do not have it.
3. A series of patches that fix each place where cpu_to_node is used too
early.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-24 17:19 ` Lameter, Christopher
0 siblings, 0 replies; 24+ messages in thread
From: Lameter, Christopher @ 2024-01-24 17:19 UTC (permalink / raw)
To: Huang Shijie
Cc: mark.rutland, rafael, catalin.marinas, jiaxun.yang, mikelley,
linux-riscv, will, mingo, vschneid, arnd, chenhuacai, vbabka,
kuba, patches, linux-mips, aou, yury.norov, paul.walmsley, tglx,
jpoimboe, linux-arm-kernel, gregkh, ndesaulniers, linux-kernel,
palmer, mhiramat, akpm, linuxppc-dev, rppt
On Tue, 23 Jan 2024, Huang Shijie wrote:
> During the kernel booting, the generic cpu_to_node() is called too early in
> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>
> For arm64/powerpc/riscv, there are at least four places in the common code
> where the generic cpu_to_node() is called before it is initialized:
> 1.) early_trace_init() in kernel/trace/trace.c
> 2.) sched_init() in kernel/sched/core.c
> 3.) init_sched_fair_class() in kernel/sched/fair.c
> 4.) workqueue_init_early() in kernel/workqueue.c
>
> In order to fix the bug, the patch changes generic cpu_to_node to
> function pointer, and export it for kernel modules.
> Introduce smp_prepare_boot_cpu_start() to wrap the original
> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> and set the cpu_to_node to formal _cpu_to_node().
Would you please fix this cleanly without a function pointer?
What I think needs to be done is a patch series.
1. Instrument cpu_to_node so that some warning is issued if it is used too
early. Preloading the array with NUMA_NO_NODE would allow us to do that.
2. Implement early_cpu_to_node on platforms that currently do not have it.
3. A series of patches that fix each place where cpu_to_node is used too
early.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-24 17:19 ` Lameter, Christopher
0 siblings, 0 replies; 24+ messages in thread
From: Lameter, Christopher @ 2024-01-24 17:19 UTC (permalink / raw)
To: Huang Shijie
Cc: gregkh, patches, rafael, paul.walmsley, palmer, aou, yury.norov,
kuba, vschneid, mingo, akpm, vbabka, rppt, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
On Tue, 23 Jan 2024, Huang Shijie wrote:
> During the kernel booting, the generic cpu_to_node() is called too early in
> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>
> For arm64/powerpc/riscv, there are at least four places in the common code
> where the generic cpu_to_node() is called before it is initialized:
> 1.) early_trace_init() in kernel/trace/trace.c
> 2.) sched_init() in kernel/sched/core.c
> 3.) init_sched_fair_class() in kernel/sched/fair.c
> 4.) workqueue_init_early() in kernel/workqueue.c
>
> In order to fix the bug, the patch changes generic cpu_to_node to
> function pointer, and export it for kernel modules.
> Introduce smp_prepare_boot_cpu_start() to wrap the original
> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> and set the cpu_to_node to formal _cpu_to_node().
Would you please fix this cleanly without a function pointer?
What I think needs to be done is a patch series.
1. Instrument cpu_to_node so that some warning is issued if it is used too
early. Preloading the array with NUMA_NO_NODE would allow us to do that.
2. Implement early_cpu_to_node on platforms that currently do not have it.
3. A series of patches that fix each place where cpu_to_node is used too
early.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
2024-01-24 17:19 ` Lameter, Christopher
(?)
(?)
@ 2024-01-24 17:41 ` Yury Norov
-1 siblings, 0 replies; 24+ messages in thread
From: Yury Norov @ 2024-01-24 17:41 UTC (permalink / raw)
To: Lameter, Christopher
Cc: Huang Shijie, gregkh, patches, rafael, paul.walmsley, palmer, aou,
kuba, vschneid, mingo, akpm, vbabka, rppt, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
> > During the kernel booting, the generic cpu_to_node() is called too early in
> > arm64, powerpc and riscv when CONFIG_NUMA is enabled.
> >
> > For arm64/powerpc/riscv, there are at least four places in the common code
> > where the generic cpu_to_node() is called before it is initialized:
> > 1.) early_trace_init() in kernel/trace/trace.c
> > 2.) sched_init() in kernel/sched/core.c
> > 3.) init_sched_fair_class() in kernel/sched/fair.c
> > 4.) workqueue_init_early() in kernel/workqueue.c
> >
> > In order to fix the bug, the patch changes generic cpu_to_node to
> > function pointer, and export it for kernel modules.
> > Introduce smp_prepare_boot_cpu_start() to wrap the original
> > smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> > Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> > and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used too
> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
By preloading do you mean compile-time initialization?
> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>
> 3. A series of patches that fix each place where cpu_to_node is used too
> early.
Agree. This is the right way to go. And pretty well all of it was discussed
in v1, isn't?
Thanks,
Yury
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-24 17:41 ` Yury Norov
0 siblings, 0 replies; 24+ messages in thread
From: Yury Norov @ 2024-01-24 17:41 UTC (permalink / raw)
To: Lameter, Christopher
Cc: Huang Shijie, gregkh, patches, rafael, paul.walmsley, palmer, aou,
kuba, vschneid, mingo, akpm, vbabka, rppt, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
> > During the kernel booting, the generic cpu_to_node() is called too early in
> > arm64, powerpc and riscv when CONFIG_NUMA is enabled.
> >
> > For arm64/powerpc/riscv, there are at least four places in the common code
> > where the generic cpu_to_node() is called before it is initialized:
> > 1.) early_trace_init() in kernel/trace/trace.c
> > 2.) sched_init() in kernel/sched/core.c
> > 3.) init_sched_fair_class() in kernel/sched/fair.c
> > 4.) workqueue_init_early() in kernel/workqueue.c
> >
> > In order to fix the bug, the patch changes generic cpu_to_node to
> > function pointer, and export it for kernel modules.
> > Introduce smp_prepare_boot_cpu_start() to wrap the original
> > smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> > Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> > and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used too
> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
By preloading do you mean compile-time initialization?
> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>
> 3. A series of patches that fix each place where cpu_to_node is used too
> early.
Agree. This is the right way to go. And pretty well all of it was discussed
in v1, isn't?
Thanks,
Yury
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-24 17:41 ` Yury Norov
0 siblings, 0 replies; 24+ messages in thread
From: Yury Norov @ 2024-01-24 17:41 UTC (permalink / raw)
To: Lameter, Christopher
Cc: mark.rutland, rafael, catalin.marinas, jiaxun.yang, mikelley,
linux-riscv, will, mingo, vschneid, chenhuacai, vbabka, kuba,
patches, linux-mips, aou, arnd, paul.walmsley, tglx, jpoimboe,
linux-arm-kernel, Huang Shijie, gregkh, ndesaulniers,
linux-kernel, palmer, mhiramat, akpm, linuxppc-dev, rppt
On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
> > During the kernel booting, the generic cpu_to_node() is called too early in
> > arm64, powerpc and riscv when CONFIG_NUMA is enabled.
> >
> > For arm64/powerpc/riscv, there are at least four places in the common code
> > where the generic cpu_to_node() is called before it is initialized:
> > 1.) early_trace_init() in kernel/trace/trace.c
> > 2.) sched_init() in kernel/sched/core.c
> > 3.) init_sched_fair_class() in kernel/sched/fair.c
> > 4.) workqueue_init_early() in kernel/workqueue.c
> >
> > In order to fix the bug, the patch changes generic cpu_to_node to
> > function pointer, and export it for kernel modules.
> > Introduce smp_prepare_boot_cpu_start() to wrap the original
> > smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> > Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> > and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used too
> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
By preloading do you mean compile-time initialization?
> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>
> 3. A series of patches that fix each place where cpu_to_node is used too
> early.
Agree. This is the right way to go. And pretty well all of it was discussed
in v1, isn't?
Thanks,
Yury
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-24 17:41 ` Yury Norov
0 siblings, 0 replies; 24+ messages in thread
From: Yury Norov @ 2024-01-24 17:41 UTC (permalink / raw)
To: Lameter, Christopher
Cc: Huang Shijie, gregkh, patches, rafael, paul.walmsley, palmer, aou,
kuba, vschneid, mingo, akpm, vbabka, rppt, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
> > During the kernel booting, the generic cpu_to_node() is called too early in
> > arm64, powerpc and riscv when CONFIG_NUMA is enabled.
> >
> > For arm64/powerpc/riscv, there are at least four places in the common code
> > where the generic cpu_to_node() is called before it is initialized:
> > 1.) early_trace_init() in kernel/trace/trace.c
> > 2.) sched_init() in kernel/sched/core.c
> > 3.) init_sched_fair_class() in kernel/sched/fair.c
> > 4.) workqueue_init_early() in kernel/workqueue.c
> >
> > In order to fix the bug, the patch changes generic cpu_to_node to
> > function pointer, and export it for kernel modules.
> > Introduce smp_prepare_boot_cpu_start() to wrap the original
> > smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> > Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> > and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used too
> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
By preloading do you mean compile-time initialization?
> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>
> 3. A series of patches that fix each place where cpu_to_node is used too
> early.
Agree. This is the right way to go. And pretty well all of it was discussed
in v1, isn't?
Thanks,
Yury
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
2024-01-24 17:19 ` Lameter, Christopher
(?)
(?)
@ 2024-01-25 2:42 ` Shijie Huang
-1 siblings, 0 replies; 24+ messages in thread
From: Shijie Huang @ 2024-01-25 2:42 UTC (permalink / raw)
To: Lameter, Christopher, Huang Shijie
Cc: gregkh, patches, rafael, paul.walmsley, palmer, aou, yury.norov,
kuba, vschneid, mingo, akpm, vbabka, rppt, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
在 2024/1/25 1:19, Lameter, Christopher 写道:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
>> During the kernel booting, the generic cpu_to_node() is called too
>> early in
>> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>>
>> For arm64/powerpc/riscv, there are at least four places in the common
>> code
>> where the generic cpu_to_node() is called before it is initialized:
>> 1.) early_trace_init() in kernel/trace/trace.c
>> 2.) sched_init() in kernel/sched/core.c
>> 3.) init_sched_fair_class() in kernel/sched/fair.c
>> 4.) workqueue_init_early() in kernel/workqueue.c
>>
>> In order to fix the bug, the patch changes generic cpu_to_node to
>> function pointer, and export it for kernel modules.
>> Introduce smp_prepare_boot_cpu_start() to wrap the original
>> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
>> Introduce smp_prepare_cpus_done() to wrap the original
>> smp_prepare_cpus(),
>> and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used
> too early. Preloading the array with NUMA_NO_NODE would allow us to do
> that.
>
> 2. Implement early_cpu_to_node on platforms that currently do not have
> it.
>
> 3. A series of patches that fix each place where cpu_to_node is used
> too early.
okay, I will try to do it.
Thanks
Huang Shijie
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-25 2:42 ` Shijie Huang
0 siblings, 0 replies; 24+ messages in thread
From: Shijie Huang @ 2024-01-25 2:42 UTC (permalink / raw)
To: Lameter, Christopher, Huang Shijie
Cc: gregkh, patches, rafael, paul.walmsley, palmer, aou, yury.norov,
kuba, vschneid, mingo, akpm, vbabka, rppt, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
在 2024/1/25 1:19, Lameter, Christopher 写道:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
>> During the kernel booting, the generic cpu_to_node() is called too
>> early in
>> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>>
>> For arm64/powerpc/riscv, there are at least four places in the common
>> code
>> where the generic cpu_to_node() is called before it is initialized:
>> 1.) early_trace_init() in kernel/trace/trace.c
>> 2.) sched_init() in kernel/sched/core.c
>> 3.) init_sched_fair_class() in kernel/sched/fair.c
>> 4.) workqueue_init_early() in kernel/workqueue.c
>>
>> In order to fix the bug, the patch changes generic cpu_to_node to
>> function pointer, and export it for kernel modules.
>> Introduce smp_prepare_boot_cpu_start() to wrap the original
>> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
>> Introduce smp_prepare_cpus_done() to wrap the original
>> smp_prepare_cpus(),
>> and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used
> too early. Preloading the array with NUMA_NO_NODE would allow us to do
> that.
>
> 2. Implement early_cpu_to_node on platforms that currently do not have
> it.
>
> 3. A series of patches that fix each place where cpu_to_node is used
> too early.
okay, I will try to do it.
Thanks
Huang Shijie
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-25 2:42 ` Shijie Huang
0 siblings, 0 replies; 24+ messages in thread
From: Shijie Huang @ 2024-01-25 2:42 UTC (permalink / raw)
To: Lameter, Christopher, Huang Shijie
Cc: mark.rutland, rafael, catalin.marinas, jiaxun.yang, mikelley,
linux-riscv, will, mingo, vschneid, arnd, chenhuacai, vbabka,
kuba, patches, linux-mips, aou, yury.norov, paul.walmsley, tglx,
jpoimboe, linux-arm-kernel, gregkh, ndesaulniers, linux-kernel,
palmer, mhiramat, akpm, linuxppc-dev, rppt
在 2024/1/25 1:19, Lameter, Christopher 写道:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
>> During the kernel booting, the generic cpu_to_node() is called too
>> early in
>> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>>
>> For arm64/powerpc/riscv, there are at least four places in the common
>> code
>> where the generic cpu_to_node() is called before it is initialized:
>> 1.) early_trace_init() in kernel/trace/trace.c
>> 2.) sched_init() in kernel/sched/core.c
>> 3.) init_sched_fair_class() in kernel/sched/fair.c
>> 4.) workqueue_init_early() in kernel/workqueue.c
>>
>> In order to fix the bug, the patch changes generic cpu_to_node to
>> function pointer, and export it for kernel modules.
>> Introduce smp_prepare_boot_cpu_start() to wrap the original
>> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
>> Introduce smp_prepare_cpus_done() to wrap the original
>> smp_prepare_cpus(),
>> and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used
> too early. Preloading the array with NUMA_NO_NODE would allow us to do
> that.
>
> 2. Implement early_cpu_to_node on platforms that currently do not have
> it.
>
> 3. A series of patches that fix each place where cpu_to_node is used
> too early.
okay, I will try to do it.
Thanks
Huang Shijie
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-25 2:42 ` Shijie Huang
0 siblings, 0 replies; 24+ messages in thread
From: Shijie Huang @ 2024-01-25 2:42 UTC (permalink / raw)
To: Lameter, Christopher, Huang Shijie
Cc: gregkh, patches, rafael, paul.walmsley, palmer, aou, yury.norov,
kuba, vschneid, mingo, akpm, vbabka, rppt, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
在 2024/1/25 1:19, Lameter, Christopher 写道:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
>> During the kernel booting, the generic cpu_to_node() is called too
>> early in
>> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>>
>> For arm64/powerpc/riscv, there are at least four places in the common
>> code
>> where the generic cpu_to_node() is called before it is initialized:
>> 1.) early_trace_init() in kernel/trace/trace.c
>> 2.) sched_init() in kernel/sched/core.c
>> 3.) init_sched_fair_class() in kernel/sched/fair.c
>> 4.) workqueue_init_early() in kernel/workqueue.c
>>
>> In order to fix the bug, the patch changes generic cpu_to_node to
>> function pointer, and export it for kernel modules.
>> Introduce smp_prepare_boot_cpu_start() to wrap the original
>> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
>> Introduce smp_prepare_cpus_done() to wrap the original
>> smp_prepare_cpus(),
>> and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used
> too early. Preloading the array with NUMA_NO_NODE would allow us to do
> that.
>
> 2. Implement early_cpu_to_node on platforms that currently do not have
> it.
>
> 3. A series of patches that fix each place where cpu_to_node is used
> too early.
okay, I will try to do it.
Thanks
Huang Shijie
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
2024-01-24 17:19 ` Lameter, Christopher
(?)
(?)
@ 2024-01-25 7:31 ` Mike Rapoport
-1 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2024-01-25 7:31 UTC (permalink / raw)
To: Lameter, Christopher
Cc: Huang Shijie, gregkh, patches, rafael, paul.walmsley, palmer, aou,
yury.norov, kuba, vschneid, mingo, akpm, vbabka, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
> > During the kernel booting, the generic cpu_to_node() is called too early in
> > arm64, powerpc and riscv when CONFIG_NUMA is enabled.
> >
> > For arm64/powerpc/riscv, there are at least four places in the common code
> > where the generic cpu_to_node() is called before it is initialized:
> > 1.) early_trace_init() in kernel/trace/trace.c
> > 2.) sched_init() in kernel/sched/core.c
> > 3.) init_sched_fair_class() in kernel/sched/fair.c
> > 4.) workqueue_init_early() in kernel/workqueue.c
> >
> > In order to fix the bug, the patch changes generic cpu_to_node to
> > function pointer, and export it for kernel modules.
> > Introduce smp_prepare_boot_cpu_start() to wrap the original
> > smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> > Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> > and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used too
> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
>
> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>
> 3. A series of patches that fix each place where cpu_to_node is used too
> early.
I think step 3 can be simplified with a generic function that sets
per_cpu(numa_node) using early_cpu_to_node(). It can be called right after
setup_per_cpu_areas().
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-25 7:31 ` Mike Rapoport
0 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2024-01-25 7:31 UTC (permalink / raw)
To: Lameter, Christopher
Cc: Huang Shijie, gregkh, patches, rafael, paul.walmsley, palmer, aou,
yury.norov, kuba, vschneid, mingo, akpm, vbabka, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
> > During the kernel booting, the generic cpu_to_node() is called too early in
> > arm64, powerpc and riscv when CONFIG_NUMA is enabled.
> >
> > For arm64/powerpc/riscv, there are at least four places in the common code
> > where the generic cpu_to_node() is called before it is initialized:
> > 1.) early_trace_init() in kernel/trace/trace.c
> > 2.) sched_init() in kernel/sched/core.c
> > 3.) init_sched_fair_class() in kernel/sched/fair.c
> > 4.) workqueue_init_early() in kernel/workqueue.c
> >
> > In order to fix the bug, the patch changes generic cpu_to_node to
> > function pointer, and export it for kernel modules.
> > Introduce smp_prepare_boot_cpu_start() to wrap the original
> > smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> > Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> > and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used too
> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
>
> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>
> 3. A series of patches that fix each place where cpu_to_node is used too
> early.
I think step 3 can be simplified with a generic function that sets
per_cpu(numa_node) using early_cpu_to_node(). It can be called right after
setup_per_cpu_areas().
--
Sincerely yours,
Mike.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-25 7:31 ` Mike Rapoport
0 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2024-01-25 7:31 UTC (permalink / raw)
To: Lameter, Christopher
Cc: mark.rutland, rafael, catalin.marinas, jiaxun.yang, mikelley,
linux-riscv, will, mingo, vschneid, arnd, chenhuacai,
linux-arm-kernel, kuba, patches, linux-mips, aou, yury.norov,
paul.walmsley, tglx, jpoimboe, vbabka, Huang Shijie, gregkh,
ndesaulniers, linux-kernel, palmer, mhiramat, akpm, linuxppc-dev
On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
> > During the kernel booting, the generic cpu_to_node() is called too early in
> > arm64, powerpc and riscv when CONFIG_NUMA is enabled.
> >
> > For arm64/powerpc/riscv, there are at least four places in the common code
> > where the generic cpu_to_node() is called before it is initialized:
> > 1.) early_trace_init() in kernel/trace/trace.c
> > 2.) sched_init() in kernel/sched/core.c
> > 3.) init_sched_fair_class() in kernel/sched/fair.c
> > 4.) workqueue_init_early() in kernel/workqueue.c
> >
> > In order to fix the bug, the patch changes generic cpu_to_node to
> > function pointer, and export it for kernel modules.
> > Introduce smp_prepare_boot_cpu_start() to wrap the original
> > smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> > Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> > and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used too
> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
>
> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>
> 3. A series of patches that fix each place where cpu_to_node is used too
> early.
I think step 3 can be simplified with a generic function that sets
per_cpu(numa_node) using early_cpu_to_node(). It can be called right after
setup_per_cpu_areas().
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-25 7:31 ` Mike Rapoport
0 siblings, 0 replies; 24+ messages in thread
From: Mike Rapoport @ 2024-01-25 7:31 UTC (permalink / raw)
To: Lameter, Christopher
Cc: Huang Shijie, gregkh, patches, rafael, paul.walmsley, palmer, aou,
yury.norov, kuba, vschneid, mingo, akpm, vbabka, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
> On Tue, 23 Jan 2024, Huang Shijie wrote:
>
> > During the kernel booting, the generic cpu_to_node() is called too early in
> > arm64, powerpc and riscv when CONFIG_NUMA is enabled.
> >
> > For arm64/powerpc/riscv, there are at least four places in the common code
> > where the generic cpu_to_node() is called before it is initialized:
> > 1.) early_trace_init() in kernel/trace/trace.c
> > 2.) sched_init() in kernel/sched/core.c
> > 3.) init_sched_fair_class() in kernel/sched/fair.c
> > 4.) workqueue_init_early() in kernel/workqueue.c
> >
> > In order to fix the bug, the patch changes generic cpu_to_node to
> > function pointer, and export it for kernel modules.
> > Introduce smp_prepare_boot_cpu_start() to wrap the original
> > smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
> > Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
> > and set the cpu_to_node to formal _cpu_to_node().
>
> Would you please fix this cleanly without a function pointer?
>
> What I think needs to be done is a patch series.
>
> 1. Instrument cpu_to_node so that some warning is issued if it is used too
> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
>
> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>
> 3. A series of patches that fix each place where cpu_to_node is used too
> early.
I think step 3 can be simplified with a generic function that sets
per_cpu(numa_node) using early_cpu_to_node(). It can be called right after
setup_per_cpu_areas().
--
Sincerely yours,
Mike.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
2024-01-25 7:31 ` Mike Rapoport
(?)
(?)
@ 2024-01-25 9:15 ` Shijie Huang
-1 siblings, 0 replies; 24+ messages in thread
From: Shijie Huang @ 2024-01-25 9:15 UTC (permalink / raw)
To: Mike Rapoport, Lameter, Christopher
Cc: Huang Shijie, gregkh, patches, rafael, paul.walmsley, palmer, aou,
yury.norov, kuba, vschneid, mingo, akpm, vbabka, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
在 2024/1/25 15:31, Mike Rapoport 写道:
> On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
>> On Tue, 23 Jan 2024, Huang Shijie wrote:
>>
>>> During the kernel booting, the generic cpu_to_node() is called too early in
>>> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>>>
>>> For arm64/powerpc/riscv, there are at least four places in the common code
>>> where the generic cpu_to_node() is called before it is initialized:
>>> 1.) early_trace_init() in kernel/trace/trace.c
>>> 2.) sched_init() in kernel/sched/core.c
>>> 3.) init_sched_fair_class() in kernel/sched/fair.c
>>> 4.) workqueue_init_early() in kernel/workqueue.c
>>>
>>> In order to fix the bug, the patch changes generic cpu_to_node to
>>> function pointer, and export it for kernel modules.
>>> Introduce smp_prepare_boot_cpu_start() to wrap the original
>>> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
>>> Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
>>> and set the cpu_to_node to formal _cpu_to_node().
>> Would you please fix this cleanly without a function pointer?
>>
>> What I think needs to be done is a patch series.
>>
>> 1. Instrument cpu_to_node so that some warning is issued if it is used too
>> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
>>
>> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>>
>> 3. A series of patches that fix each place where cpu_to_node is used too
>> early.
For step 3, I find it it hard to change the cpu_to_node() to
early_cpu_to_node() for early_trace_init().
In early_trace_init(), the __ring_buffer_alloc() calls the cpu_to_node().
In order to fix the bug, we should use early_cpu_to_node() for
__ring_buffer_alloc().
But __ring_buffer_alloc() is also used by the kernel after the booting
finished.
After the booting finishes, we should use the cpu_to_node(), not the
early_cpu_to_node().
> I think step 3 can be simplified with a generic function that sets
> per_cpu(numa_node) using early_cpu_to_node(). It can be called right after
> setup_per_cpu_areas().
I think this method maybe better..
I will try this too.
Thanks
Huang Shijie
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-25 9:15 ` Shijie Huang
0 siblings, 0 replies; 24+ messages in thread
From: Shijie Huang @ 2024-01-25 9:15 UTC (permalink / raw)
To: Mike Rapoport, Lameter, Christopher
Cc: Huang Shijie, gregkh, patches, rafael, paul.walmsley, palmer, aou,
yury.norov, kuba, vschneid, mingo, akpm, vbabka, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
在 2024/1/25 15:31, Mike Rapoport 写道:
> On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
>> On Tue, 23 Jan 2024, Huang Shijie wrote:
>>
>>> During the kernel booting, the generic cpu_to_node() is called too early in
>>> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>>>
>>> For arm64/powerpc/riscv, there are at least four places in the common code
>>> where the generic cpu_to_node() is called before it is initialized:
>>> 1.) early_trace_init() in kernel/trace/trace.c
>>> 2.) sched_init() in kernel/sched/core.c
>>> 3.) init_sched_fair_class() in kernel/sched/fair.c
>>> 4.) workqueue_init_early() in kernel/workqueue.c
>>>
>>> In order to fix the bug, the patch changes generic cpu_to_node to
>>> function pointer, and export it for kernel modules.
>>> Introduce smp_prepare_boot_cpu_start() to wrap the original
>>> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
>>> Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
>>> and set the cpu_to_node to formal _cpu_to_node().
>> Would you please fix this cleanly without a function pointer?
>>
>> What I think needs to be done is a patch series.
>>
>> 1. Instrument cpu_to_node so that some warning is issued if it is used too
>> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
>>
>> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>>
>> 3. A series of patches that fix each place where cpu_to_node is used too
>> early.
For step 3, I find it it hard to change the cpu_to_node() to
early_cpu_to_node() for early_trace_init().
In early_trace_init(), the __ring_buffer_alloc() calls the cpu_to_node().
In order to fix the bug, we should use early_cpu_to_node() for
__ring_buffer_alloc().
But __ring_buffer_alloc() is also used by the kernel after the booting
finished.
After the booting finishes, we should use the cpu_to_node(), not the
early_cpu_to_node().
> I think step 3 can be simplified with a generic function that sets
> per_cpu(numa_node) using early_cpu_to_node(). It can be called right after
> setup_per_cpu_areas().
I think this method maybe better..
I will try this too.
Thanks
Huang Shijie
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-25 9:15 ` Shijie Huang
0 siblings, 0 replies; 24+ messages in thread
From: Shijie Huang @ 2024-01-25 9:15 UTC (permalink / raw)
To: Mike Rapoport, Lameter, Christopher
Cc: mark.rutland, rafael, catalin.marinas, jiaxun.yang, mikelley,
linux-riscv, will, mingo, vschneid, arnd, chenhuacai,
linux-arm-kernel, kuba, patches, linux-mips, aou, yury.norov,
paul.walmsley, tglx, jpoimboe, vbabka, Huang Shijie, gregkh,
ndesaulniers, linux-kernel, palmer, mhiramat, akpm, linuxppc-dev
在 2024/1/25 15:31, Mike Rapoport 写道:
> On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
>> On Tue, 23 Jan 2024, Huang Shijie wrote:
>>
>>> During the kernel booting, the generic cpu_to_node() is called too early in
>>> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>>>
>>> For arm64/powerpc/riscv, there are at least four places in the common code
>>> where the generic cpu_to_node() is called before it is initialized:
>>> 1.) early_trace_init() in kernel/trace/trace.c
>>> 2.) sched_init() in kernel/sched/core.c
>>> 3.) init_sched_fair_class() in kernel/sched/fair.c
>>> 4.) workqueue_init_early() in kernel/workqueue.c
>>>
>>> In order to fix the bug, the patch changes generic cpu_to_node to
>>> function pointer, and export it for kernel modules.
>>> Introduce smp_prepare_boot_cpu_start() to wrap the original
>>> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
>>> Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
>>> and set the cpu_to_node to formal _cpu_to_node().
>> Would you please fix this cleanly without a function pointer?
>>
>> What I think needs to be done is a patch series.
>>
>> 1. Instrument cpu_to_node so that some warning is issued if it is used too
>> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
>>
>> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>>
>> 3. A series of patches that fix each place where cpu_to_node is used too
>> early.
For step 3, I find it it hard to change the cpu_to_node() to
early_cpu_to_node() for early_trace_init().
In early_trace_init(), the __ring_buffer_alloc() calls the cpu_to_node().
In order to fix the bug, we should use early_cpu_to_node() for
__ring_buffer_alloc().
But __ring_buffer_alloc() is also used by the kernel after the booting
finished.
After the booting finishes, we should use the cpu_to_node(), not the
early_cpu_to_node().
> I think step 3 can be simplified with a generic function that sets
> per_cpu(numa_node) using early_cpu_to_node(). It can be called right after
> setup_per_cpu_areas().
I think this method maybe better..
I will try this too.
Thanks
Huang Shijie
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2] NUMA: Early use of cpu_to_node() returns 0 instead of the correct node id
@ 2024-01-25 9:15 ` Shijie Huang
0 siblings, 0 replies; 24+ messages in thread
From: Shijie Huang @ 2024-01-25 9:15 UTC (permalink / raw)
To: Mike Rapoport, Lameter, Christopher
Cc: Huang Shijie, gregkh, patches, rafael, paul.walmsley, palmer, aou,
yury.norov, kuba, vschneid, mingo, akpm, vbabka, tglx, jpoimboe,
ndesaulniers, mikelley, mhiramat, arnd, linux-kernel, linux-riscv,
linux-arm-kernel, catalin.marinas, will, mark.rutland, mpe,
linuxppc-dev, chenhuacai, jiaxun.yang, linux-mips
在 2024/1/25 15:31, Mike Rapoport 写道:
> On Wed, Jan 24, 2024 at 09:19:00AM -0800, Lameter, Christopher wrote:
>> On Tue, 23 Jan 2024, Huang Shijie wrote:
>>
>>> During the kernel booting, the generic cpu_to_node() is called too early in
>>> arm64, powerpc and riscv when CONFIG_NUMA is enabled.
>>>
>>> For arm64/powerpc/riscv, there are at least four places in the common code
>>> where the generic cpu_to_node() is called before it is initialized:
>>> 1.) early_trace_init() in kernel/trace/trace.c
>>> 2.) sched_init() in kernel/sched/core.c
>>> 3.) init_sched_fair_class() in kernel/sched/fair.c
>>> 4.) workqueue_init_early() in kernel/workqueue.c
>>>
>>> In order to fix the bug, the patch changes generic cpu_to_node to
>>> function pointer, and export it for kernel modules.
>>> Introduce smp_prepare_boot_cpu_start() to wrap the original
>>> smp_prepare_boot_cpu(), and set cpu_to_node with early_cpu_to_node.
>>> Introduce smp_prepare_cpus_done() to wrap the original smp_prepare_cpus(),
>>> and set the cpu_to_node to formal _cpu_to_node().
>> Would you please fix this cleanly without a function pointer?
>>
>> What I think needs to be done is a patch series.
>>
>> 1. Instrument cpu_to_node so that some warning is issued if it is used too
>> early. Preloading the array with NUMA_NO_NODE would allow us to do that.
>>
>> 2. Implement early_cpu_to_node on platforms that currently do not have it.
>>
>> 3. A series of patches that fix each place where cpu_to_node is used too
>> early.
For step 3, I find it it hard to change the cpu_to_node() to
early_cpu_to_node() for early_trace_init().
In early_trace_init(), the __ring_buffer_alloc() calls the cpu_to_node().
In order to fix the bug, we should use early_cpu_to_node() for
__ring_buffer_alloc().
But __ring_buffer_alloc() is also used by the kernel after the booting
finished.
After the booting finishes, we should use the cpu_to_node(), not the
early_cpu_to_node().
> I think step 3 can be simplified with a generic function that sets
> per_cpu(numa_node) using early_cpu_to_node(). It can be called right after
> setup_per_cpu_areas().
I think this method maybe better..
I will try this too.
Thanks
Huang Shijie
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread