linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@kernel.org>
To: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled
Date: Wed, 29 Nov 2017 10:12:02 -0800	[thread overview]
Message-ID: <CALCETrXaCtrzu7xyR+wHvSQhMoP4onUg0hfHHoxd72QSCqgkmw@mail.gmail.com> (raw)
In-Reply-To: <CALCETrXwM7syieKz8CcFE8qHL6r_yA0jP49A1EJsw5UNWz+UNA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

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?

[-- Attachment #2: gsindex.patch --]
[-- Type: text/x-patch, Size: 840 bytes --]

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();

  parent reply	other threads:[~2017-11-29 18:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 14:35 Suspend-to-ram/resume regression with commit ca37e57bbe0c Jarkko Nikula
2017-11-29  7:09 ` [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled Ingo Molnar
2017-11-29  9:25   ` Jarkko Nikula
2017-11-29  9:28     ` Thomas Gleixner
2017-11-29 12:39       ` Jarkko Nikula
2017-11-29 12:47   ` Peter Zijlstra
2017-11-29 14:33     ` Andy Lutomirski
2017-11-29 14:56       ` David Laight
2017-11-29 16:22         ` Andy Lutomirski
2017-11-29 16:51           ` David Laight
2017-11-29 20:48             ` Linus Torvalds
2017-11-29 16:51           ` Andy Lutomirski
2017-11-29 17:57   ` Andy Lutomirski
2017-11-29 18:08     ` Peter Zijlstra
2017-11-29 18:12     ` Andy Lutomirski [this message]
2017-11-29 20:58       ` Linus Torvalds
2017-11-29 21:25         ` Andy Lutomirski
2017-11-29 21:41           ` Andy Lutomirski
2017-11-29 21:57             ` Andy Lutomirski
2017-11-30  8:42       ` Jarkko Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALCETrXaCtrzu7xyR+wHvSQhMoP4onUg0hfHHoxd72QSCqgkmw@mail.gmail.com \
    --to=luto@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=bp@alien8.de \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).