Re: [PATCH] x86/MCE/AMD: fix warning about sleep-in-atomic at early boot
From: Borislav Petkov
Date: Tue Dec 17 2019 - 02:54:06 EST
On Thu, Nov 07, 2019 at 11:53:10AM +0100, Borislav Petkov wrote:
> On Fri, Nov 01, 2019 at 04:39:17PM +0300, Konstantin Khlebnikov wrote:
> > I tried 5.4 once but there was no warning.
> > Code in 4.19 and in mainline almost the same.
>
> Yes, but early boot code has changed a lot since 4.19. If you can't
> trigger it on 5.4, then I'll drop the BUG splat from your commit message
> and change it to talk about replacing the IPI-sending function, which is
> a good cleanup in itself.
Ok, I was able to trigger it myself:
[ 0.822602] BUG: sleeping function called from invalid context at kernel/sched/completion.c:99
[ 0.822602] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
[ 0.822602] no locks held by swapper/1/0.
[ 0.822602] irq event stamp: 0
[ 0.822602] hardirqs last enabled at (0): [<0000000000000000>] 0x0
[ 0.822602] hardirqs last disabled at (0): [<ffffffff8106dda9>] copy_process+0x8b9/0x1ca0
[ 0.822602] softirqs last enabled at (0): [<ffffffff8106dda9>] copy_process+0x8b9/0x1ca0
[ 0.822602] softirqs last disabled at (0): [<0000000000000000>] 0x0
[ 0.822602] Preemption disabled at:
[ 0.822602] [<ffffffff8104703b>] start_secondary+0x3b/0x190
[ 0.822602] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.5.0-rc2+ #1
[ 0.822602] Hardware name: GIGABYTE MZ01-CE1-00/MZ01-CE1-00, BIOS F02 08/29/2018
[ 0.822602] Call Trace:
[ 0.822602] dump_stack+0x71/0xa0
[ 0.822602] ___might_sleep.cold.92+0xf7/0x11f
[ 0.822602] wait_for_completion+0x3c/0x180
[ 0.822602] ? generic_exec_single+0xca/0x100
[ 0.822602] rdmsr_safe_on_cpu+0xe8/0x100
[ 0.822602] ? wrmsr_on_cpus+0x20/0x20
[ 0.822602] mce_amd_feature_init+0x2ab/0x590
[ 0.822602] mcheck_cpu_init+0x17a/0x4d0
[ 0.822602] identify_cpu+0x3f0/0x750
[ 0.822602] identify_secondary_cpu+0x13/0x80
[ 0.822602] smp_store_cpu_info+0x45/0x50
[ 0.822602] start_secondary+0x50/0x190
[ 0.822602] secondary_startup_64+0xa4/0xb0
Rerouting patch...
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette