Greeting, FYI, we noticed the following commit (built with gcc-9): commit: 3928ba024a93a8556532c3c53e651169be83c061 ("[PATCH-next v3] mm/memcg: Properly handle memcg_stock access for PREEMPT_RT") url: https://github.com/0day-ci/linux/commits/Waiman-Long/mm-memcg-Properly-handle-memcg_stock-access-for-PREEMPT_RT/20211214-224558 patch link: https://lore.kernel.org/lkml/20211214144412.447035-1-longman@redhat.com in testcase: boot on test machine: qemu-system-x86_64 -enable-kvm -cpu Icelake-Server -smp 4 -m 16G caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace): If you fix the issue, kindly add following tag Reported-by: kernel test robot [ 9.553151][ C0] WARNING: possible recursive locking detected [ 9.553540][ C0] 5.16.0-rc5-00001-g3928ba024a93 #1 Not tainted [ 9.553934][ C0] -------------------------------------------- [ 9.554331][ C0] ksoftirqd/0/12 is trying to acquire lock: [ 9.554690][ C0] ffffffffad262940 (&stock->lock){..-.}-{2:2}, at: local_lock_acquire (include/linux/local_lock_internal.h:28) [ 9.555355][ C0] [ 9.555355][ C0] but task is already holding lock: [ 9.555804][ C0] ffffffffad262940 (&stock->lock){..-.}-{2:2}, at: local_lock_acquire (include/linux/local_lock_internal.h:28) [ 9.556418][ C0] [ 9.556418][ C0] other info that might help us debug this: [ 9.556917][ C0] Possible unsafe locking scenario: [ 9.556917][ C0] [ 9.557370][ C0] CPU0 [ 9.557570][ C0] ---- [ 9.557771][ C0] lock(&stock->lock); [ 9.558026][ C0] lock(&stock->lock); [ 9.558280][ C0] [ 9.558280][ C0] *** DEADLOCK *** [ 9.558280][ C0] [ 9.558780][ C0] May be due to missing lock nesting notation [ 9.558780][ C0] [ 9.559305][ C0] 2 locks held by ksoftirqd/0/12: [ 9.559611][ C0] #0: ffffffffad221580 (rcu_callback){....}-{0:0}, at: rcu_process_callbacks (kernel/rcu/tiny.c:129) [ 9.560212][ C0] #1: ffffffffad262940 (&stock->lock){..-.}-{2:2}, at: local_lock_acquire (include/linux/local_lock_internal.h:28) [ 9.560848][ C0] [ 9.560848][ C0] stack backtrace: [ 9.561207][ C0] CPU: 0 PID: 12 Comm: ksoftirqd/0 Not tainted 5.16.0-rc5-00001-g3928ba024a93 #1 [ 9.561764][ C0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 [ 9.562329][ C0] Call Trace: [ 9.562553][ C0] [ 9.562736][ C0] validate_chain (kernel/locking/lockdep.c:3790) [ 9.563035][ C0] __lock_acquire (kernel/locking/lockdep.c:5027) [ 9.563325][ C0] lock_acquire (kernel/locking/lockdep.c:438 kernel/locking/lockdep.c:5639) [ 9.563604][ C0] ? put_obj_stock (include/linux/local_lock_internal.h:29) [ 9.563889][ C0] ? find_held_lock (kernel/locking/lockdep.c:5130) [ 9.564181][ C0] ? get_obj_stock (include/linux/rcupdate.h:273 include/linux/rcupdate.h:721) [ 9.564466][ C0] local_lock_acquire (include/linux/local_lock_internal.h:30) [ 9.564830][ C0] ? put_obj_stock (include/linux/local_lock_internal.h:29) [ 9.565115][ C0] refill_stock (mm/memcontrol.c:2215 (discriminator 3)) [ 9.565383][ C0] obj_cgroup_uncharge_pages (mm/memcontrol.c:2996) [ 9.565719][ C0] drain_obj_stock (arch/x86/include/asm/atomic.h:53 include/linux/atomic/atomic-instrumented.h:56 mm/memcontrol.c:3173) [ 9.566005][ C0] refill_obj_stock (include/linux/percpu-refcount.h:222 include/linux/memcontrol.h:825 mm/memcontrol.c:3228) [ 9.566297][ C0] memcg_slab_free_hook (mm/slab.h:207 mm/slab.h:365) [ 9.566608][ C0] ? rcu_process_callbacks (include/linux/rcupdate.h:273 kernel/rcu/tiny.c:102 kernel/rcu/tiny.c:133) [ 9.566952][ C0] kmem_cache_free (mm/slub.c:3446 mm/slub.c:3514 mm/slub.c:3530) [ 9.567250][ C0] ? free_inode_nonrcu (fs/inode.c:221) [ 9.567556][ C0] rcu_process_callbacks (include/linux/rcupdate.h:273 kernel/rcu/tiny.c:102 kernel/rcu/tiny.c:133) [ 9.567880][ C0] __do_softirq (arch/x86/include/asm/jump_label.h:27 include/linux/jump_label.h:212 include/trace/events/irq.h:142 kernel/softirq.c:559) [ 9.568158][ C0] ? sort_range (kernel/smpboot.c:107) [ 9.568426][ C0] run_ksoftirqd (kernel/softirq.c:412 kernel/softirq.c:922) [ 9.568700][ C0] smpboot_thread_fn (kernel/smpboot.c:164 (discriminator 4)) [ 9.569003][ C0] kthread (kernel/kthread.c:329) [ 9.569252][ C0] ? set_kthread_struct (kernel/kthread.c:272) [ 9.569562][ C0] ret_from_fork (arch/x86/entry/entry_64.S:301) [ 9.569838][ C0] [ OK ] Started Create Static Device Nodes in /dev. [ OK ] Reached target Local File Systems (Pre). [ OK ] Reached target Local File Systems. Starting Create Volatile Files and Directories... Starting Preprocess NFS configuration... Starting udev Kernel Device Manager... [ OK ] Started Create Volatile Files and Directories. [ OK ] Started Preprocess NFS configuration. [ OK ] Reached target NFS client services. Starting RPC bind portmap service... Starting Network Time Synchronization... Starting Update UTMP about System Boot/Shutdown... [ OK ] Started udev Kernel Device Manager. [ OK ] Started RPC bind portmap service. [ OK ] Started udev Coldplug all Devices. Starting Helper to synchronize boot up for ifupdown... [ OK ] Reached target Remote File Systems (Pre). [ OK ] Reached target Remote File Systems. [ OK ] Reached target RPC Port Mapper. [ OK ] Started Helper to synchronize boot up for ifupdown. [FAILED] Failed to start Update UTMP about System Boot/Shutdown. See 'systemctl status systemd-update-utmp.service' for details. Starting Raise network interfaces... [ OK ] Started Raise network interfaces. [ OK ] Reached target Network. [ OK ] Started Network Time Synchronization. [ OK ] Reached target System Time Synchronized. [ OK ] Reached target System Initialization. [ OK ] Started Daily apt download activities. [ OK ] Started Daily Cleanup of Temporary Directories. [ OK ] Started Daily rotation of log files. [ OK ] Listening on D-Bus System Message Bus Socket. [ OK ] Reached target Sockets. [ OK ] Reached target Basic System. [ OK ] Started Regular background program processing daemon. Starting LKP bootstrap... [ 9.728013][ C0] random: fast init done Starting System Logging Service... Starting LSB: OpenIPMI Driver init script... Starting Login Service... Starting OpenBSD Secure Shell server... [ OK ] Started D-Bus System Message Bus. [ 9.776118][ T219] random: dbus-daemon: uninitialized urandom read (12 bytes read) [ 9.778254][ T219] random: dbus-daemon: uninitialized urandom read (12 bytes read) Starting Permit User Sessions... Starting /etc/rc.local Compatibility... To reproduce: # build kernel cd linux cp config-5.16.0-rc5-00001-g3928ba024a93 .config make HOSTCC=gcc-9 CC=gcc-9 ARCH=x86_64 olddefconfig prepare modules_prepare bzImage modules make HOSTCC=gcc-9 CC=gcc-9 ARCH=x86_64 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. --- 0DAY/LKP+ Test Infrastructure Open Source Technology Center https://lists.01.org/hyperkitty/list/lkp@lists.01.org Intel Corporation Thanks, Oliver Sang