Re: [PATCH v4] x86/power: Fix 'nosmt' vs. hibernation triple fault during resume
From: Jiri Kosina
Date: Fri May 31 2019 - 10:55:13 EST
On Fri, 31 May 2019, Josh Poimboeuf wrote:
> > I personally am quite frequently using differnet combinations of
> > resumer/resumee kernels, and I've never been biten by it so far. I'd guess
> > I am not the only one.
> > Fixmap sort of breaks that invariant.
>
> Right now there is no backwards compatibility because nosmt resume is
> already broken.
>
> For "future" backwards compatibility we could just define a hard-coded
> reserved fixmap page address, adjacent to the vsyscall reserved address.
>
> Something like this (not yet tested)? Maybe we could also remove the
> resume_play_dead() hack?
Looking into SDM:
=====
A store to the address range armed by the MONITOR instruction, an
interrupt, an NMI or SMI, a debug exception, a machine check exception,
the BINIT# signal, the INIT# signal, or the RESET# signal will exit the
implementation-dependent-optimized state.
=====
And mwait doesn't have the 'auto-restart on SMM exit' like hlt does. So I
guess that's why I am seeing the triple faults even with your (fixed, see
below) patch as well.
So I don't think we can safely use this aproach.
>
> diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
> index 9da8cccdf3fb..1c328624162c 100644
> --- a/arch/x86/include/asm/fixmap.h
> +++ b/arch/x86/include/asm/fixmap.h
> @@ -80,6 +80,7 @@ enum fixed_addresses {
> #ifdef CONFIG_X86_VSYSCALL_EMULATION
> VSYSCALL_PAGE = (FIXADDR_TOP - VSYSCALL_ADDR) >> PAGE_SHIFT,
> #endif
> + FIX_MWAIT = (FIXADDR_TOP - VSYSCALL_ADDR - 1) >> PAGE_SHIFT,
> #endif
> FIX_DBGP_BASE,
> FIX_EARLYCON_MEM_BASE,
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 73e69aaaa117..9804fbe25d03 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -108,6 +108,8 @@ int __read_mostly __max_smt_threads = 1;
> /* Flag to indicate if a complete sched domain rebuild is required */
> bool x86_topology_update;
>
> +static char __mwait_page[PAGE_SIZE];
This needs to be __align(PAGE_SIZE) in order for the fixmap to work
properly.
--
Jiri Kosina
SUSE Labs