Greeting, FYI, we noticed the following commit (built with gcc-11): commit: 0662227fdfe7b22c8a88e4ef64eedf549770cb59 ("[RFC PATCH] mm: sort kmemleak object via backtrace") url: https://github.com/intel-lab-lkp/linux/commits/zhaoyang-huang/mm-sort-kmemleak-object-via-backtrace/20220927-154444 base: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git a1375562c0a87f0fa2eaf3e8ce15824696d4170a patch link: https://lore.kernel.org/linux-mm/1664264570-3716-1-git-send-email-zhaoyang.huang@unisoc.com in testcase: boot on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace): [ 0.016452][ T0] WARNING: possible recursive locking detected [ 0.017183][ T0] 6.0.0-rc7-00035-g0662227fdfe7 #1 Not tainted [ 0.017895][ T0] -------------------------------------------- [ 0.018581][ T0] swapper/0 is trying to acquire lock: [ 0.019237][ T0] 82d83e70 (kmemleak_lock){....}-{2:2}, at: __create_object+0x2de/0x630 [ 0.020339][ T0] [ 0.020339][ T0] but task is already holding lock: [ 0.021223][ T0] 82d83e70 (kmemleak_lock){....}-{2:2}, at: __create_object+0x1db/0x630 [ 0.022321][ T0] [ 0.022321][ T0] other info that might help us debug this: [ 0.023277][ T0] Possible unsafe locking scenario: [ 0.023277][ T0] [ 0.024129][ T0] CPU0 [ 0.024496][ T0] ---- [ 0.024866][ T0] lock(kmemleak_lock); [ 0.025390][ T0] lock(kmemleak_lock); [ 0.025887][ T0] [ 0.025887][ T0] *** DEADLOCK *** [ 0.025887][ T0] [ 0.026877][ T0] May be due to missing lock nesting notation [ 0.026877][ T0] [ 0.027818][ T0] 1 lock held by swapper/0: [ 0.028327][ T0] #0: 82d83e70 (kmemleak_lock){....}-{2:2}, at: __create_object+0x1db/0x630 [ 0.029455][ T0] [ 0.029455][ T0] stack backtrace: [ 0.030161][ T0] CPU: 0 PID: 0 Comm: swapper Not tainted 6.0.0-rc7-00035-g0662227fdfe7 #1 ce0142f1816d214291543120a71fbfb037192f5b [ 0.031630][ T0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-4 04/01/2014 [ 0.032866][ T0] Call Trace: [ 0.033238][ T0] dump_stack_lvl (lib/dump_stack.c:107 (discriminator 4)) [ 0.033766][ T0] dump_stack (lib/dump_stack.c:114) [ 0.034218][ T0] validate_chain.cold (kernel/locking/lockdep.c:2988 kernel/locking/lockdep.c:3031 kernel/locking/lockdep.c:3816) [ 0.034830][ T0] __lock_acquire (kernel/locking/lockdep.c:5053) [ 0.035418][ T0] lock_acquire (kernel/locking/lockdep.c:466 kernel/locking/lockdep.c:5668) [ 0.035940][ T0] ? __create_object+0x2de/0x630 [ 0.036607][ T0] ? startup_32_smp (arch/x86/kernel/head_32.S:329) [ 0.037188][ T0] _raw_spin_lock_irqsave (include/linux/spinlock_api_smp.h:111 kernel/locking/spinlock.c:162) [ 0.037845][ T0] ? __create_object+0x2de/0x630 [ 0.038508][ T0] __create_object+0x2de/0x630 [ 0.039147][ T0] kmemleak_alloc_phys (mm/kmemleak.c:808 mm/kmemleak.c:1285) [ 0.039728][ T0] memblock_alloc_range_nid (mm/memblock.c:1427) [ 0.040367][ T0] memblock_phys_alloc_range (mm/memblock.c:1451 (discriminator 3)) [ 0.040997][ T0] reserve_real_mode (arch/x86/realmode/init.c:58 (discriminator 3)) [ 0.041545][ T0] setup_arch (arch/x86/kernel/setup.c:1180) [ 0.042064][ T0] start_kernel (init/main.c:277 (discriminator 3) init/main.c:475 (discriminator 3) init/main.c:953 (discriminator 3)) [ 0.042588][ T0] i386_start_kernel (arch/x86/kernel/head32.c:57) [ 0.043158][ T0] startup_32_smp (arch/x86/kernel/head_32.S:329) BUG: kernel hang in boot stage If you fix the issue, kindly add following tag | Reported-by: kernel test robot | Link: https://lore.kernel.org/r/202210072108.2d1b9006-yujie.liu@intel.com To reproduce: # build kernel cd linux cp config-6.0.0-rc7-00035-g0662227fdfe7 .config make HOSTCC=gcc-11 CC=gcc-11 ARCH=i386 olddefconfig prepare modules_prepare bzImage modules make HOSTCC=gcc-11 CC=gcc-11 ARCH=i386 INSTALL_MOD_PATH= modules_install cd find lib/ | cpio -o -H newc --quiet | gzip > modules.cgz git clone https://github.com/intel/lkp-tests.git cd lkp-tests bin/lkp qemu -k -m modules.cgz job-script # job-script is attached in this email # if come across any failure that blocks the test, # please remove ~/.lkp and /lkp dir to run from a clean state. -- 0-DAY CI Kernel Test Service https://01.org/lkp