8a523d9e6f: BUG:sleeping_function_called_from_invalid_context_at_mm/mm_init.c
kernel test robot
build botHello,
kernel test robot noticed "BUG:sleeping_function_called_from_invalid_context_at_mm/mm_init.c" on:
commit: 8a523d9e6f30349ad2f8c34d850483db905e976b ("mm/mm_init: use deferred_init_memmap_chunk() in deferred_grow_zone()")
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
[test failed on linux-next/master 0f4c93f7eb861acab537dbe94441817a270537bf]
in testcase: blktests
version: blktests-x86_64-34a7fc4-1_20250824
with following parameters:
disk: 1SSD test: nvme-group-00
config: x86_64-rhel-9.4-func
compiler: gcc-12
test machine: 192 threads 2 sockets Intel(R) Xeon(R) 6740E CPU @ 2.4GHz (Sierra Forest) with 256G memory
(please refer to attached dmesg/kmsg for entire log/backtrace)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]
kern :err : [ 9.708923] BUG: sleeping function called from invalid context at mm/mm_init.c:2153 kern :err : [ 9.709485] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 1, name: swapper/0 kern :err : [ 9.709485] preempt_count: 1, expected: 0 kern :err : [ 9.709485] RCU nest depth: 0, expected: 0 kern :warn : [ 9.709485] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.0-rc1-00003-g8a523d9e6f30 #1 PREEMPT(voluntary) kern :warn : [ 9.709485] Hardware name: IEIT SYSTEMS NF5180-M8-A0-R0-00/NF5180-M8-A0-R0-00, BIOS 00.14.04 09/23/2024 kern :warn : [ 9.709485] Call Trace: kern :warn : [ 9.709485] <TASK> kern :warn : [ 9.709485] dump_stack_lvl (lib/dump_stack.c:123 (discriminator 1)) kern :warn : [ 9.709485] __might_resched (kernel/sched/core.c:8958) kern :warn : [ 9.709485] deferred_init_memmap_chunk (include/linux/sched.h:2070 mm/mm_init.c:2153) kern :warn : [ 9.709485] ? __pfx_deferred_init_memmap_chunk (mm/mm_init.c:2140) kern :warn : [ 9.709485] ? __pfx_try_to_claim_block (mm/page_alloc.c:2291) kern :warn : [ 9.709485] ? __pfx__raw_spin_lock_irqsave (kernel/locking/spinlock.c:161) kern :warn : [ 9.709485] ? _raw_spin_lock_irqsave (arch/x86/include/asm/atomic.h:107 include/linux/atomic/atomic-arch-fallback.h:2170 include/linux/atomic/atomic-instrumented.h:1302 include/asm-generic/qspinlock.h:111 include/linux/spinlock.h:187 include/linux/spinlock_api_smp.h:111 kernel/locking/spinlock.c:162) kern :warn : [ 9.709485] ? __pfx__raw_spin_lock_irqsave (kernel/locking/spinlock.c:161) kern :warn : [ 9.709485] ? rmqueue+0x8f7/0x29d0 kern :warn : [ 9.709485] deferred_grow_zone (mm/mm_init.c:2286) kern :warn : [ 9.709485] get_page_from_freelist (mm/page_alloc.c:3824) kern :warn : [ 9.709485] __alloc_frozen_pages_noprof (mm/page_alloc.c:5148) kern :warn : [ 9.709485] ? __pfx___alloc_frozen_pages_noprof (mm/page_alloc.c:5114) kern :warn : [ 9.709485] ? __pfx_smp_call_function_many_cond (kernel/smp.c:784) kern :warn : [ 9.709485] __alloc_pages_noprof (mm/page_alloc.c:5182) kern :warn : [ 9.709485] dsalloc_pages (arch/x86/events/intel/ds.c:611) kern :warn : [ 9.709485] ? __asan_memset (mm/kasan/shadow.c:84) kern :warn : [ 9.709485] reserve_ds_buffers (arch/x86/events/intel/ds.c:631 arch/x86/events/intel/ds.c:789) kern :warn : [ 9.709485] x86_reserve_hardware (arch/x86/events/core.c:420 arch/x86/events/core.c:409) kern :warn : [ 9.709485] x86_pmu_event_init (arch/x86/events/core.c:673 arch/x86/events/core.c:2475) kern :warn : [ 9.709485] ? kmem_cache_alloc_node_noprof (arch/x86/include/asm/jump_label.h:46 include/linux/memcontrol.h:1714 mm/slub.c:2210 mm/slub.c:4190 mm/slub.c:4229 mm/slub.c:4281) kern :warn : [ 9.709485] perf_try_init_event (kernel/events/core.c:12581) kern :warn : [ 9.709485] perf_event_alloc (kernel/events/core.c:12680 kernel/events/core.c:12954) kern :warn : [ 9.709485] ? __pfx_watchdog_overflow_callback (kernel/watchdog_perf.c:107) kern :warn : [ 9.709485] perf_event_create_kernel_counter (kernel/events/core.c:13779 (discriminator 1)) kern :warn : [ 9.709485] hardlockup_detector_event_create (kernel/watchdog_perf.c:133 (discriminator 3)) kern :warn : [ 9.709485] watchdog_hardlockup_probe (kernel/watchdog_perf.c:267) kern :warn : [ 9.709485] lockup_detector_init (kernel/watchdog.c:1312) kern :warn : [ 9.709485] kernel_init_freeable (init/main.c:1571) kern :warn : [ 9.709485] ? __pfx_kernel_init (init/main.c:1461) kern :warn : [ 9.709485] kernel_init (init/main.c:1471) kern :warn : [ 9.709485] ? calculate_sigpending (kernel/signal.c:194) kern :warn : [ 9.709485] ? __pfx_kernel_init (init/main.c:1461) kern :warn : [ 9.709485] ret_from_fork (arch/x86/kernel/process.c:148) kern :warn : [ 9.709485] ? __pfx_kernel_init (init/main.c:1461) kern :warn : [ 9.709485] ret_from_fork_asm (arch/x86/entry/entry_64.S:258)
kern :warn : [ 9.709485] </TASK>
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20250825/[email protected]
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Mike Rapoport
maintainerHi,
Quoted 14 lines · kernel test robot
Hello,
kernel test robot noticed "BUG:sleeping_function_called_from_invalid_context_at_mm/mm_init.c" on:
commit:
8a523d9e6f30349ad2f8c34d850483db905e976b("mm/mm_init: usedeferred_init_memmap_chunk()indeferred_grow_zone()")
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master[test failed on linux-next/master
0f4c93f7eb861acab537dbe94441817a270537bf]in testcase: blktests
version: blktests-x86_64-34a7fc4-1_20250824
with following parameters:
Quoted 6 lines
disk: 1SSD test: nvme-group-00config: x86_64-rhel-9.4-func
compiler: gcc-12
test machine: 192 threads 2 sockets Intel(R) Xeon(R) 6740E CPU @ 2.4GHz (Sierra Forest) with 256G memory
This patch should fix it:
mm/mm_init.c +4 -1
@@ -2085,7 +2085,10 @@ deferred_init_memmap_chunk(unsigned long start_pfn, unsigned long end_pfn,deferred_free_pages (spfn, chunk_end - spfn); spfn = chunk_end; -cond_resched (); +if (irqs_disabled ()) +touch_nmi_watchdog (); +else +cond_resched (); } }
Quoted 66 lines
(please refer to attached dmesg/kmsg for entire log/backtrace)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]kern :err : [ 9.708923] BUG: sleeping function called from invalid context at mm/mm_init.c:2153 kern :err : [ 9.709485] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 1, name: swapper/0 kern :err : [ 9.709485] preempt_count: 1, expected: 0 kern :err : [ 9.709485] RCU nest depth: 0, expected: 0 kern :warn : [ 9.709485] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.0-rc1-00003-g8a523d9e6f30 #1 PREEMPT(voluntary) kern :warn : [ 9.709485] Hardware name: IEIT SYSTEMS NF5180-M8-A0-R0-00/NF5180-M8-A0-R0-00, BIOS 00.14.04 09/23/2024 kern :warn : [ 9.709485] Call Trace: kern :warn : [ 9.709485] <TASK> kern :warn : [ 9.709485] dump_stack_lvl (lib/dump_stack.c:123 (discriminator 1)) kern :warn : [ 9.709485] __might_resched (kernel/sched/core.c:8958) kern :warn : [ 9.709485] deferred_init_memmap_chunk (include/linux/sched.h:2070 mm/mm_init.c:2153) kern :warn : [ 9.709485] ? __pfx_deferred_init_memmap_chunk (mm/mm_init.c:2140) kern :warn : [ 9.709485] ? __pfx_try_to_claim_block (mm/page_alloc.c:2291) kern :warn : [ 9.709485] ? __pfx__raw_spin_lock_irqsave (kernel/locking/spinlock.c:161) kern :warn : [ 9.709485] ? _raw_spin_lock_irqsave (arch/x86/include/asm/atomic.h:107 include/linux/atomic/atomic-arch-fallback.h:2170 include/linux/atomic/atomic-instrumented.h:1302 include/asm-generic/qspinlock.h:111 include/linux/spinlock.h:187 include/linux/spinlock_api_smp.h:111 kernel/locking/spinlock.c:162) kern :warn : [ 9.709485] ? __pfx__raw_spin_lock_irqsave (kernel/locking/spinlock.c:161) kern :warn : [ 9.709485] ? rmqueue+0x8f7/0x29d0 kern :warn : [ 9.709485] deferred_grow_zone (mm/mm_init.c:2286) kern :warn : [ 9.709485] get_page_from_freelist (mm/page_alloc.c:3824) kern :warn : [ 9.709485] __alloc_frozen_pages_noprof (mm/page_alloc.c:5148) kern :warn : [ 9.709485] ? __pfx___alloc_frozen_pages_noprof (mm/page_alloc.c:5114) kern :warn : [ 9.709485] ? __pfx_smp_call_function_many_cond (kernel/smp.c:784) kern :warn : [ 9.709485] __alloc_pages_noprof (mm/page_alloc.c:5182) kern :warn : [ 9.709485] dsalloc_pages (arch/x86/events/intel/ds.c:611) kern :warn : [ 9.709485] ? __asan_memset (mm/kasan/shadow.c:84) kern :warn : [ 9.709485] reserve_ds_buffers (arch/x86/events/intel/ds.c:631 arch/x86/events/intel/ds.c:789) kern :warn : [ 9.709485] x86_reserve_hardware (arch/x86/events/core.c:420 arch/x86/events/core.c:409) kern :warn : [ 9.709485] x86_pmu_event_init (arch/x86/events/core.c:673 arch/x86/events/core.c:2475) kern :warn : [ 9.709485] ? kmem_cache_alloc_node_noprof (arch/x86/include/asm/jump_label.h:46 include/linux/memcontrol.h:1714 mm/slub.c:2210 mm/slub.c:4190 mm/slub.c:4229 mm/slub.c:4281) kern :warn : [ 9.709485] perf_try_init_event (kernel/events/core.c:12581) kern :warn : [ 9.709485] perf_event_alloc (kernel/events/core.c:12680 kernel/events/core.c:12954) kern :warn : [ 9.709485] ? __pfx_watchdog_overflow_callback (kernel/watchdog_perf.c:107) kern :warn : [ 9.709485] perf_event_create_kernel_counter (kernel/events/core.c:13779 (discriminator 1)) kern :warn : [ 9.709485] hardlockup_detector_event_create (kernel/watchdog_perf.c:133 (discriminator 3)) kern :warn : [ 9.709485] watchdog_hardlockup_probe (kernel/watchdog_perf.c:267) kern :warn : [ 9.709485] lockup_detector_init (kernel/watchdog.c:1312) kern :warn : [ 9.709485] kernel_init_freeable (init/main.c:1571) kern :warn : [ 9.709485] ? __pfx_kernel_init (init/main.c:1461) kern :warn : [ 9.709485] kernel_init (init/main.c:1471) kern :warn : [ 9.709485] ? calculate_sigpending (kernel/signal.c:194) kern :warn : [ 9.709485] ? __pfx_kernel_init (init/main.c:1461) kern :warn : [ 9.709485] ret_from_fork (arch/x86/kernel/process.c:148) kern :warn : [ 9.709485] ? __pfx_kernel_init (init/main.c:1461) kern :warn : [ 9.709485] ret_from_fork_asm (arch/x86/entry/entry_64.S:258)kern :warn : [ 9.709485] </TASK>
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20250825/[email protected]Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Signature · 2 lines
Sincerely yours, Mike.