Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WARNING: CPU: 0 PID: 0 at mm/memblock.c:789 __next_free_mem_range()

6 views
Skip to first unread message

Fengguang Wu

unread,
Jan 6, 2014, 8:40:01 AM1/6/14
to
Greetings,

I got the below dmesg and the error is exposed by

commit 68abcdf54742a06de9ec52cbb05b6bdd27e6bdab
Author: Grygorii Strashko <grygorii...@ti.com>
AuthorDate: Fri Jan 3 14:09:57 2014 +1100
Commit: Stephen Rothwell <s...@canb.auug.org.au>
CommitDate: Fri Jan 3 14:09:57 2014 +1100

mm/memblock: use WARN_ONCE when MAX_NUMNODES passed as input parameter

Check nid parameter and produce warning if it has deprecated MAX_NUMNODES
value. Also re-assign NUMA_NO_NODE value to the nid parameter in this
case.

These will help to identify the wrong API usage (the caller) and make code
simpler.

Signed-off-by: Grygorii Strashko <grygorii...@ti.com>
Signed-off-by: Santosh Shilimkar <santosh....@ti.com>
Cc: Yinghai Lu <yin...@kernel.org>
Cc: Tejun Heo <t...@kernel.org>
Signed-off-by: Andrew Morton <ak...@linux-foundation.org>


[ 0.000000] ACPI: Local APIC address 0xfee00000
[ 0.000000] mapped APIC to ffffffffff57b000 ( fee00000)
[ 0.000000] ------------[ cut here ]------------
[ 0.000000] WARNING: CPU: 0 PID: 0 at mm/memblock.c:789 __next_free_mem_range+0xc7/0x29c()
[ 0.000000] Usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE instead
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.13.0-rc7-next-20140106-07462-gb4a839b #455
[ 0.000000] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 0.000000] 0000000000000009 ffffffff82201d70 ffffffff81986d81 ffffffff82201db8
[ 0.000000] ffffffff82201da8 ffffffff810da9a8 0000000000000000 0000000000000001
[ 0.000000] 0000000000000001 0000000000000001 0000000000000001 ffffffff82201e08
[ 0.000000] Call Trace:
[ 0.000000] [<ffffffff81986d81>] dump_stack+0x85/0xba
[ 0.000000] [<ffffffff810da9a8>] warn_slowpath_common+0xa8/0xe0
[ 0.000000] [<ffffffff810daa7c>] warn_slowpath_fmt+0x5c/0x70
[ 0.000000] [<ffffffff8115b745>] ? vprintk_emit+0x465/0x950
[ 0.000000] [<ffffffff827139cd>] __next_free_mem_range+0xc7/0x29c
[ 0.000000] [<ffffffff826ab120>] ? early_idt_handlers+0x120/0x120
[ 0.000000] [<ffffffff826ab120>] ? early_idt_handlers+0x120/0x120
[ 0.000000] [<ffffffff826b3da3>] memblock_find_dma_reserve+0xca/0x163
[ 0.000000] [<ffffffff826b09c9>] setup_arch+0x1086/0x11f9
[ 0.000000] [<ffffffff826ab120>] ? early_idt_handlers+0x120/0x120
[ 0.000000] [<ffffffff826ab120>] ? early_idt_handlers+0x120/0x120
[ 0.000000] [<ffffffff826abeb7>] start_kernel+0xe4/0x6fc
[ 0.000000] [<ffffffff826ab120>] ? early_idt_handlers+0x120/0x120
[ 0.000000] [<ffffffff826ab637>] x86_64_start_reservations+0x46/0x4f
[ 0.000000] [<ffffffff826ab7c9>] x86_64_start_kernel+0x189/0x19f
[ 0.000000] ---[ end trace 8fe5782a70405023 ]---
[ 0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00

Thanks,
Fengguang
dmesg-yocto-xgwo-5:20140106180919:x86_64-randconfig-c0-0106:3.13.0-rc7-next-20140106-07462-gb4a839b:455
config-3.13.0-rc7-next-20140106-07462-gb4a839b

Fengguang Wu

unread,
Jan 6, 2014, 9:30:02 PM1/6/14
to
Hi all,

Here is another call trace triggered by debug patch 68abcdf547
("mm/memblock: use WARN_ONCE when MAX_NUMNODES passed as input
parameter"):

[ 0.000000] found SMP MP-table at [mem 0x000fdab0-0x000fdabf] mapped at [c00fdab0]
[ 0.000000] mpc: fdac0-fdbe4
[ 0.000000] ------------[ cut here ]------------
[ 0.000000] WARNING: CPU: 0 PID: 0 at mm/memblock.c:789 __next_free_mem_range+0x82/0x261()
[ 0.000000] Usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE instead
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.13.0-rc7-next-20140106-07462-gb4a839b #4
[ 0.000000] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 0.000000] c1b8fea0 c1b8fea0 c1b8fe60 c180425f c1b8fe90 c103af65 c1ab8db8 c1b8febc
[ 0.000000] 00000000 c1ab8d54 00000315 c1e51e3d c1e51e3d 00000000 00000001 00000001
[ 0.000000] c1b8fea8 c103afd3 00000009 c1b8fea0 c1ab8db8 c1b8febc c1b8ff08 c1e51e3d
[ 0.000000] Call Trace:
[ 0.000000] [<c180425f>] dump_stack+0x16/0x18
[ 0.000000] [<c103af65>] warn_slowpath_common+0x75/0x90
[ 0.000000] [<c1e51e3d>] ? __next_free_mem_range+0x82/0x261
[ 0.000000] [<c1e51e3d>] ? __next_free_mem_range+0x82/0x261
[ 0.000000] [<c103afd3>] warn_slowpath_fmt+0x33/0x40
[ 0.000000] [<c1e51e3d>] __next_free_mem_range+0x82/0x261
[ 0.000000] [<c1e023f5>] setup_bios_corruption_check+0x78/0x1ee
[ 0.000000] [<c1df7bad>] ? memblock_x86_fill+0x5f/0x74
[ 0.000000] [<c1df5792>] setup_arch+0x703/0xbef
[ 0.000000] [<c1df2771>] start_kernel+0x75/0x447
[ 0.000000] [<c1df23be>] ? reserve_ebda_region+0x63/0x68
[ 0.000000] [<c1df2358>] i386_start_kernel+0x12e/0x131
[ 0.000000] ---[ end trace ee1eeac2e47ba743 ]---
[ 0.000000] Scanning 1 areas for low memory corruption

Full dmesg and kconfig attached.

Thanks,
Fengguang
dmesg-yocto-waimea-8:20140107090354:i386-randconfig-nh1-01070835:3.13.0-rc7-next-20140106-07462-gb4a839b:4
config-3.13.0-rc7-next-20140106-07462-gb4a839b

Grygorii Strashko

unread,
Jan 8, 2014, 10:30:02 AM1/8/14
to
Update X86 code to use NUMA_NO_NODE instead of MAX_NUMNODES while
calling memblock APIs, because memblock API is changed to use NUMA_NO_NODE and
will produce warning during boot otherwise.

See:
https://lkml.org/lkml/2013/12/9/898

Cc: Santosh Shilimkar <santosh....@ti.com>
Cc: Andrew Morton <ak...@linux-foundation.org>
Cc: Stephen Rothwell <s...@canb.auug.org.au>
Cc: Tejun Heo <t...@kernel.org>
Cc: Yinghai Lu <yin...@kernel.org>
Cc: David Rientjes <rien...@google.com>
Cc: Thomas Gleixner <tg...@linutronix.de>
Cc: Ingo Molnar <mi...@redhat.com>
Cc: "H. Peter Anvin" <h...@zytor.com>

Signed-off-by: Grygorii Strashko <grygorii...@ti.com>
---
Hi Fengguang,

This patch should fix these warnings.

Regards,
-grygorii

arch/x86/kernel/check.c | 2 +-
arch/x86/kernel/e820.c | 2 +-
arch/x86/mm/memtest.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/check.c b/arch/x86/kernel/check.c
index e2dbcb7..83a7995 100644
--- a/arch/x86/kernel/check.c
+++ b/arch/x86/kernel/check.c
@@ -91,7 +91,7 @@ void __init setup_bios_corruption_check(void)

corruption_check_size = round_up(corruption_check_size, PAGE_SIZE);

- for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL) {
+ for_each_free_mem_range(i, NUMA_NO_NODE, &start, &end, NULL) {
start = clamp_t(phys_addr_t, round_up(start, PAGE_SIZE),
PAGE_SIZE, corruption_check_size);
end = clamp_t(phys_addr_t, round_down(end, PAGE_SIZE),
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 174da5f..988c00a 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -1120,7 +1120,7 @@ void __init memblock_find_dma_reserve(void)
nr_pages += end_pfn - start_pfn;
}

- for_each_free_mem_range(u, MAX_NUMNODES, &start, &end, NULL) {
+ for_each_free_mem_range(u, NUMA_NO_NODE, &start, &end, NULL) {
start_pfn = min_t(unsigned long, PFN_UP(start), MAX_DMA_PFN);
end_pfn = min_t(unsigned long, PFN_DOWN(end), MAX_DMA_PFN);
if (start_pfn < end_pfn)
diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c
index 8dabbed..1e9da79 100644
--- a/arch/x86/mm/memtest.c
+++ b/arch/x86/mm/memtest.c
@@ -74,7 +74,7 @@ static void __init do_one_pass(u64 pattern, u64 start, u64 end)
u64 i;
phys_addr_t this_start, this_end;

- for_each_free_mem_range(i, MAX_NUMNODES, &this_start, &this_end, NULL) {
+ for_each_free_mem_range(i, NUMA_NO_NODE, &this_start, &this_end, NULL) {
this_start = clamp_t(phys_addr_t, this_start, start, end);
this_end = clamp_t(phys_addr_t, this_end, start, end);
if (this_start < this_end) {
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Grygorii Strashko

unread,
Jan 8, 2014, 11:40:02 AM1/8/14
to
Hi,

On 01/08/2014 06:23 PM, Grygorii Strashko wrote:
> Update X86 code to use NUMA_NO_NODE instead of MAX_NUMNODES while
> calling memblock APIs, because memblock API is changed to use NUMA_NO_NODE and
> will produce warning during boot otherwise.
>
> See:
> https://lkml.org/lkml/2013/12/9/898
>
[...]

or, there are other 3 patches from Sergey Senozhatsky, which actually fix the same warnings:
https://lkml.org/lkml/2014/1/6/277 - [PATCH -next] x86 memtest: use NUMA_NO_NODE in do_one_pass()
https://lkml.org/lkml/2014/1/6/280 - [PATCH -next] e820: use NUMA_NO_NODE in memblock_find_dma_reserve()
http://comments.gmane.org/gmane.linux.kernel/1623429 - [PATCH -next] check: use NUMA_NO_NODE in setup_bios_corruption_check()

Regards,
- grygorii

Santosh Shilimkar

unread,
Jan 8, 2014, 1:10:01 PM1/8/14
to
On Wednesday 08 January 2014 12:27 PM, Grygorii Strashko wrote:
> Hi,
>
> On 01/08/2014 06:23 PM, Grygorii Strashko wrote:
>> Update X86 code to use NUMA_NO_NODE instead of MAX_NUMNODES while
>> calling memblock APIs, because memblock API is changed to use NUMA_NO_NODE and
>> will produce warning during boot otherwise.
>>
>> See:
>> https://lkml.org/lkml/2013/12/9/898
>>
> [...]
>
> or, there are other 3 patches from Sergey Senozhatsky, which actually fix the same warnings:
> https://lkml.org/lkml/2014/1/6/277 - [PATCH -next] x86 memtest: use NUMA_NO_NODE in do_one_pass()
> https://lkml.org/lkml/2014/1/6/280 - [PATCH -next] e820: use NUMA_NO_NODE in memblock_find_dma_reserve()
> http://comments.gmane.org/gmane.linux.kernel/1623429 - [PATCH -next] check: use NUMA_NO_NODE in setup_bios_corruption_check()
>
Either one should be fine though $subject patch would be my personal preference.

Andrew,
This should kill at least 3 known memblock users with MAX_NUMNODES. Feel
free to pick the patch(s) as per your preference.

Regards,
Santosh

David Rientjes

unread,
Jan 14, 2014, 8:30:02 PM1/14/14
to
On Wed, 8 Jan 2014, Grygorii Strashko wrote:

> Update X86 code to use NUMA_NO_NODE instead of MAX_NUMNODES while
> calling memblock APIs, because memblock API is changed to use NUMA_NO_NODE and
> will produce warning during boot otherwise.
>
> See:
> https://lkml.org/lkml/2013/12/9/898
>
> Cc: Santosh Shilimkar <santosh....@ti.com>
> Cc: Andrew Morton <ak...@linux-foundation.org>
> Cc: Stephen Rothwell <s...@canb.auug.org.au>
> Cc: Tejun Heo <t...@kernel.org>
> Cc: Yinghai Lu <yin...@kernel.org>
> Cc: David Rientjes <rien...@google.com>
> Cc: Thomas Gleixner <tg...@linutronix.de>
> Cc: Ingo Molnar <mi...@redhat.com>
> Cc: "H. Peter Anvin" <h...@zytor.com>
>
> Signed-off-by: Grygorii Strashko <grygorii...@ti.com>

Acked-by: David Rientjes <rien...@google.com>

Thanks for following through with this, Grygorii!
0 new messages