Re: [PATCH v3 11/11] powerpc/64: use interrupt restart table to speed up return from interrupt
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2021-06-15 13:46:00
Nicholas Piggin [off-list ref] writes:
quoted hunk ↗ jump to hunk
diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c index fe26f2fa0f3f..fbe94e2d5011 100644 --- a/arch/powerpc/lib/feature-fixups.c +++ b/arch/powerpc/lib/feature-fixups.c@@ -412,12 +430,19 @@ void do_entry_flush_fixups(enum l1d_flush_type types) stop_machine(__do_entry_flush_fixups, &types, NULL); } -void do_rfi_flush_fixups(enum l1d_flush_type types) +static int __do_rfi_flush_fixups(void *data) { + enum l1d_flush_type types = *(enum l1d_flush_type *)data; unsigned int instrs[3], *dest; long *start, *end; int i; + if (types & L1D_FLUSH_FALLBACK) + rfi_exit_not_reentrant = true; + else + rfi_exit_not_reentrant = false; + update_interrupt_exit();
This is not happy:
[ 0.000000][ T0] ============================================
[ 0.000000][ T0] WARNING: possible recursive locking detected
[ 0.000000][ T0] 5.13.0-rc2-00118-gca433a3a44e3 #1 Not tainted
[ 0.000000][ T0] --------------------------------------------
[ 0.000000][ T0] swapper/0 is trying to acquire lock:
[ 0.000000][ T0] c00000000252fa10 (cpu_hotplug_lock){....}-{0:0}, at: static_key_enable+0x24/0x50
[ 0.000000][ T0]
[ 0.000000][ T0] but task is already holding lock:
[ 0.000000][ T0] c00000000252fa10 (cpu_hotplug_lock){....}-{0:0}, at: stop_machine+0x2c/0x60
[ 0.000000][ T0]
[ 0.000000][ T0] other info that might help us debug this:
[ 0.000000][ T0] Possible unsafe locking scenario:
[ 0.000000][ T0]
[ 0.000000][ T0] CPU0
[ 0.000000][ T0] ----
[ 0.000000][ T0] lock(cpu_hotplug_lock);
[ 0.000000][ T0] lock(cpu_hotplug_lock);
[ 0.000000][ T0]
[ 0.000000][ T0] *** DEADLOCK ***
[ 0.000000][ T0]
[ 0.000000][ T0] May be due to missing lock nesting notation
[ 0.000000][ T0]
[ 0.000000][ T0] 1 lock held by swapper/0:
[ 0.000000][ T0] #0: c00000000252fa10 (cpu_hotplug_lock){....}-{0:0}, at: stop_machine+0x2c/0x60
[ 0.000000][ T0]
[ 0.000000][ T0] stack backtrace:
[ 0.000000][ T0] CPU: 0 PID: 0 Comm: swapper Not tainted 5.13.0-rc2-00118-gca433a3a44e3 #1
[ 0.000000][ T0] Call Trace:
[ 0.000000][ T0] [c0000000027db8f0] [c00000000093dd28] dump_stack+0xec/0x144 (unreliable)
[ 0.000000][ T0] [c0000000027db940] [c0000000001ed5b4] __lock_acquire+0x1744/0x28b0
[ 0.000000][ T0] [c0000000027dba70] [c0000000001ef338] lock_acquire+0x128/0x600
[ 0.000000][ T0] [c0000000027dbb70] [c00000000015035c] cpus_read_lock+0x4c/0x170
[ 0.000000][ T0] [c0000000027dbba0] [c0000000003c2594] static_key_enable+0x24/0x50
[ 0.000000][ T0] [c0000000027dbbd0] [c0000000000ae87c] __do_rfi_flush_fixups+0x7c/0x300
[ 0.000000][ T0] [c0000000027dbc80] [c0000000002ab7e4] stop_machine_cpuslocked+0xe4/0x200
[ 0.000000][ T0] [c0000000027dbcf0] [c0000000002ab940] stop_machine+0x40/0x60
[ 0.000000][ T0] [c0000000027dbd30] [c0000000000aef30] do_rfi_flush_fixups+0x30/0x50
[ 0.000000][ T0] [c0000000027dbd60] [c000000000040890] setup_rfi_flush+0xa0/0x140
[ 0.000000][ T0] [c0000000027dbdd0] [c00000000201c6c4] pnv_setup_arch+0x304/0x4ac
[ 0.000000][ T0] [c0000000027dbe60] [c00000000200a31c] setup_arch+0x374/0x3c4
[ 0.000000][ T0] [c0000000027dbee0] [c000000002003d08] start_kernel+0xb0/0x790
[ 0.000000][ T0] [c0000000027dbf90] [c00000000000d79c] start_here_common+0x1c/0x600
[ 0.000000][ T0] rfi-flush: patched 12 locations (fallback displacement flush)
cheers