Messages in this thread Patch in this message | | | From | Andy Lutomirski <> | Date | Wed, 29 Nov 2017 10:12:02 -0800 | Subject | Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled |
| |
On Wed, Nov 29, 2017 at 9:57 AM, Andy Lutomirski <luto@kernel.org> wrote: > On Tue, Nov 28, 2017 at 11:09 PM, Ingo Molnar <mingo@kernel.org> wrote: >> >> * Jarkko Nikula <jarkko.nikula@linux.intel.com> wrote: >> >>> Hi >>> >>> Suspend-to-ram and resume stopped working on v4.15-rc1 and I bisected it to >>> commit ca37e57bbe0c ("x86/entry/64: Add missing irqflags tracing to >>> native_load_gs_index()"). >>>
Jarkko, can you try the attached patch? If it survives resume, can you see if the log contains anything interesting? diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c index 78c61c8ecfa8..ca5d978b86a0 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu.c @@ -245,14 +245,17 @@ static void notrace __restore_processor_state(struct saved_context *ctxt) asm volatile ("movw %0, %%ds" :: "r" (ctxt->ds)); asm volatile ("movw %0, %%es" :: "r" (ctxt->es)); asm volatile ("movw %0, %%fs" :: "r" (ctxt->fs)); - load_gs_index(0xffff); - WARN_ON(1); - load_gs_index(ctxt->gs); asm volatile ("movw %0, %%ss" :: "r" (ctxt->ss)); wrmsrl(MSR_FS_BASE, ctxt->fs_base); wrmsrl(MSR_GS_BASE, ctxt->gs_base); wrmsrl(MSR_KERNEL_GS_BASE, ctxt->gs_kernel_base); + + /* + * load_gs_index() potentially calls normal C code (irqflag tracing), + * so it needs GSBASE restored first. + */ + load_gs_index(ctxt->gs); #endif fix_processor_context(); | |