# git rev-parse -q --verify 41368abca78c7f4da59a94fbe523579c345045bc^{commit} 41368abca78c7f4da59a94fbe523579c345045bc already have revision, skipping fetch # git checkout -q -f -B kisskb 41368abca78c7f4da59a94fbe523579c345045bc # git clean -qxdf # < git log -1 # commit 41368abca78c7f4da59a94fbe523579c345045bc # Author: Michael Ellerman # Date: Wed Jan 25 14:01:36 2023 +1100 # # powerpc/imc-pmu: Revert nest_init_lock to being a mutex # # The recent commit 76d588dddc45 ("powerpc/imc-pmu: Fix use of mutex in # IRQs disabled section") fixed warnings (and possible deadlocks) in the # IMC PMU driver by converting the locking to use spinlocks. # # It also converted the init-time nest_init_lock to a spinlock, even # though it's not used at runtime in IRQ disabled sections or while # holding other spinlocks. # # This leads to warnings such as: # # BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:49 # in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0 # preempt_count: 1, expected: 0 # CPU: 7 PID: 1 Comm: swapper/0 Not tainted 6.2.0-rc2-14719-gf12cd06109f4-dirty #1 # Hardware name: Mambo,Simulated-System POWER9 0x4e1203 opal:v6.6.6 PowerNV # Call Trace: # dump_stack_lvl+0x74/0xa8 (unreliable) # __might_resched+0x178/0x1a0 # __cpuhp_setup_state+0x64/0x1e0 # init_imc_pmu+0xe48/0x1250 # opal_imc_counters_probe+0x30c/0x6a0 # platform_probe+0x78/0x110 # really_probe+0x104/0x420 # __driver_probe_device+0xb0/0x170 # driver_probe_device+0x58/0x180 # __driver_attach+0xd8/0x250 # bus_for_each_dev+0xb4/0x140 # driver_attach+0x34/0x50 # bus_add_driver+0x1e8/0x2d0 # driver_register+0xb4/0x1c0 # __platform_driver_register+0x38/0x50 # opal_imc_driver_init+0x2c/0x40 # do_one_initcall+0x80/0x360 # kernel_init_freeable+0x310/0x3b8 # kernel_init+0x30/0x1a0 # ret_from_kernel_thread+0x5c/0x64 # # Fix it by converting nest_init_lock back to a mutex, so that we can call # sleeping functions while holding it. There is no interaction between # nest_init_lock and the runtime spinlocks used by the actual PMU routines. # # Fixes: 76d588dddc45 ("powerpc/imc-pmu: Fix use of mutex in IRQs disabled section") # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld --version # < git log --format=%s --max-count=1 41368abca78c7f4da59a94fbe523579c345045bc # < make -s -j 160 ARCH=powerpc O=/kisskb/build/powerpc-fixes_83xx_mpc8313_rdb_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- 83xx/mpc8313_rdb_defconfig # < make -s -j 160 ARCH=powerpc O=/kisskb/build/powerpc-fixes_83xx_mpc8313_rdb_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- help # make -s -j 160 ARCH=powerpc O=/kisskb/build/powerpc-fixes_83xx_mpc8313_rdb_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- olddefconfig # make -s -j 160 ARCH=powerpc O=/kisskb/build/powerpc-fixes_83xx_mpc8313_rdb_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- Completed OK # rm -rf /kisskb/build/powerpc-fixes_83xx_mpc8313_rdb_defconfig_powerpc-gcc5 # Build took: 0:00:36.761796