Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-30 Thread Jarkko Nikula
On 11/29/2017 08:12 PM, Andy Lutomirski wrote: On Wed, Nov 29, 2017 at 9:57 AM, Andy Lutomirski wrote: On Tue, Nov 28, 2017 at 11:09 PM, Ingo Molnar wrote: * Jarkko Nikula wrote: Hi Suspend-to-ram and resume stopped working on v4.15-rc1 and I bisected it to commit ca37e57bbe0c ("x86/entr

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Andy Lutomirski
On Wed, Nov 29, 2017 at 1:41 PM, Andy Lutomirski wrote: > On Wed, Nov 29, 2017 at 1:25 PM, Andy Lutomirski wrote: >> >> >>> On Nov 29, 2017, at 12:58 PM, Linus Torvalds >>> wrote: >>> On Wed, Nov 29, 2017 at 10:12 AM, Andy Lutomirski wrote: Jarkko, can you try the attached patch

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Andy Lutomirski
On Wed, Nov 29, 2017 at 1:25 PM, Andy Lutomirski wrote: > > >> On Nov 29, 2017, at 12:58 PM, Linus Torvalds >> wrote: >> >>> On Wed, Nov 29, 2017 at 10:12 AM, Andy Lutomirski wrote: >>> >>> Jarkko, can you try the attached patch? If it survives resume, can >>> you see if the log contains anyth

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Andy Lutomirski
> On Nov 29, 2017, at 12:58 PM, Linus Torvalds > wrote: > >> On Wed, Nov 29, 2017 at 10:12 AM, Andy Lutomirski wrote: >> >> Jarkko, can you try the attached patch? If it survives resume, can >> you see if the log contains anything interesting? > > I'm not Jarkko, but I'm not a huge fan of

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Linus Torvalds
On Wed, Nov 29, 2017 at 10:12 AM, Andy Lutomirski wrote: > > Jarkko, can you try the attached patch? If it survives resume, can > you see if the log contains anything interesting? I'm not Jarkko, but I'm not a huge fan of that patch. If this was the cause of the problem (and it looks likely), w

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Linus Torvalds
On Wed, Nov 29, 2017 at 8:51 AM, David Laight wrote: > > SWAPGS is a PITA. The hardware designers should have tried to write > all the interrupt handling code. That's actually my biggest beef with x86-64. The kernel entry/exit is completely misdesigned. That was actually better in the original i

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Andy Lutomirski
On Wed, Nov 29, 2017 at 9:57 AM, Andy Lutomirski wrote: > On Tue, Nov 28, 2017 at 11:09 PM, Ingo Molnar wrote: >> >> * Jarkko Nikula 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 t

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Peter Zijlstra
On Wed, Nov 29, 2017 at 09:57:43AM -0800, Andy Lutomirski wrote: > On Tue, Nov 28, 2017 at 11:09 PM, Ingo Molnar wrote: > > On a related note, we should definitely extend the 'intended GS state' > > annotation > > comments I did in this patch to all SWAPGS instances - this way code review > > h

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Andy Lutomirski
On Tue, Nov 28, 2017 at 11:09 PM, Ingo Molnar wrote: > > * Jarkko Nikula 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()"). >> >> I noticed it on Intel

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Andy Lutomirski
On Wed, Nov 29, 2017 at 8:22 AM, Andy Lutomirski wrote: > On Wed, Nov 29, 2017 at 6:56 AM, David Laight wrote: >> From: Andy Lutomirski >>> Sent: 29 November 2017 14:34 >>> > On Nov 29, 2017, at 4:47 AM, Peter Zijlstra wrote: >>> > >>> >> On Wed, Nov 29, 2017 at 08:09:51AM +0100, Ingo Molnar wro

RE: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread David Laight
From: Andy Lutomirski > Sent: 29 November 2017 16:23 > > I can't remember what happens when swapgs itself faults. ... > SWAPGS never faults. Ah yes, I remember, it only restores the offset. For 32bit processes you need to do a 'pop %gs' to recover the segment register itself - and that can fault.

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Andy Lutomirski
On Wed, Nov 29, 2017 at 6:56 AM, David Laight wrote: > From: Andy Lutomirski >> Sent: 29 November 2017 14:34 >> > On Nov 29, 2017, at 4:47 AM, Peter Zijlstra wrote: >> > >> >> On Wed, Nov 29, 2017 at 08:09:51AM +0100, Ingo Molnar wrote: >> >> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entr

RE: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread David Laight
From: Andy Lutomirski > Sent: 29 November 2017 14:34 > > On Nov 29, 2017, at 4:47 AM, Peter Zijlstra wrote: > > > >> On Wed, Nov 29, 2017 at 08:09:51AM +0100, Ingo Molnar wrote: > >> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S > >> index f81d50d7ceac..c0b52df8ee4f 100644 > >

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Andy Lutomirski
> On Nov 29, 2017, at 4:47 AM, Peter Zijlstra wrote: > >> On Wed, Nov 29, 2017 at 08:09:51AM +0100, Ingo Molnar wrote: >> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S >> index f81d50d7ceac..c0b52df8ee4f 100644 >> --- a/arch/x86/entry/entry_64.S >> +++ b/arch/x86/entry/entr

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Peter Zijlstra
On Wed, Nov 29, 2017 at 08:09:51AM +0100, Ingo Molnar wrote: > diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S > index f81d50d7ceac..c0b52df8ee4f 100644 > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -945,16 +945,16 @@ idtentry simd_coprocessor_error

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Jarkko Nikula
On 11/29/2017 11:28 AM, Thomas Gleixner wrote: On Wed, 29 Nov 2017, Jarkko Nikula wrote: On 11/29/2017 09:09 AM, Ingo Molnar wrote: Hm, that commit looks broken with irq-tracing enabled. Does the patch below fix it? No, it makes the machine not to boot at all :-( Log below when I used my co

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Thomas Gleixner
On Wed, 29 Nov 2017, Jarkko Nikula wrote: > On 11/29/2017 09:09 AM, Ingo Molnar wrote: > > > > * Jarkko Nikula 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 >

Re: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-29 Thread Jarkko Nikula
On 11/29/2017 09:09 AM, Ingo Molnar wrote: * Jarkko Nikula 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()"). I noticed it on Intel Kabylake (core) and Apollol

[PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled

2017-11-28 Thread Ingo Molnar
Nov 2017 07:43:27 +0100 Subject: [PATCH] x86/entry/64: Fix native_load_gs_index() SWAPGS handling with IRQ state tracing enabled Jarkko Nikula reported a S2R resume hang regression and bisected it back to: ca37e57bbe0c ("x86/entry/64: Add missing irqflags tracing to native_load_gs_index