Mathieu Desnoyers
10bcc80e9d
membarrier/x86: Provide core serializing command
There are two places where core serialization is needed by membarrier:
1) When returning from the membarrier IPI,
2) After scheduler updates curr to a thread with a different mm, before
going back to user-space, since the curr->mm is used by membarrier to
check whether it needs to send an IPI to that CPU.
x86-32 uses IRET as return from interrupt, and both IRET and SYSEXIT to go
back to user-space. The IRET instruction is core serializing, but not
SYSEXIT.
x86-64 uses IRET as return from interrupt, which takes care of the IPI.
However, it can return to user-space through either SYSRETL (compat
code), SYSRETQ, or IRET. Given that SYSRET{L,Q} is not core serializing,
we rely instead on write_cr3() performed by switch_mm() to provide core
serialization after changing the current mm, and deal with the special
case of kthread -> uthread (temporarily keeping current mm into
active_mm) by adding a sync_core() in that specific case.
Use the new sync_core_before_usermode() to guarantee this.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrea Parri <parri.andrea@gmail.com>
Cc: Andrew Hunter <ahh@google.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Avi Kivity <avi@scylladb.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Dave Watson <davejwatson@fb.com>
Cc: David Sehr <sehr@google.com>
Cc: Greg Hackmann <ghackmann@google.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Maged Michael <maged.michael@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-api@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Link: http://lkml.kernel.org/r/20180129202020.8515-10-mathieu.desnoyers@efficios.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-02-05 21:35:11 +01:00
..
2017-11-02 11:10:55 +01:00
2017-12-23 21:13:00 +01:00
2017-12-23 21:13:01 +01:00
2018-01-04 23:04:57 +01:00
2018-01-14 20:04:16 +01:00
2018-01-26 15:56:23 +01:00
2016-07-14 13:04:20 +02:00
2017-11-16 11:43:11 +01:00
2017-11-02 11:10:55 +01:00
2017-12-22 20:13:05 +01:00
2017-11-15 18:21:07 -08:00
2018-01-05 12:23:57 -08:00
2016-07-14 13:04:20 +02:00
2017-12-11 15:35:18 +01:00
2018-01-15 00:32:35 +01:00
2018-01-05 00:39:57 +01:00
2017-12-11 15:35:18 +01:00
2017-12-29 17:02:49 -08:00
2018-01-16 01:50:59 +01:00
2018-01-20 17:22:54 -08:00
2017-11-02 11:10:55 +01:00
2017-11-16 12:49:48 +01:00
2017-01-28 09:31:13 +01:00
2017-11-08 10:55:48 +01:00
2017-05-09 08:12:27 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-04-11 08:56:05 +02:00
2017-11-02 11:10:55 +01:00
2017-11-15 18:21:04 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-07-18 11:38:05 +02:00
2016-07-14 13:04:20 +02:00
2008-05-24 11:25:37 +02:00
2017-12-22 20:13:05 +01:00
2017-12-29 17:02:49 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-09-26 09:43:36 +02:00
2018-01-08 17:42:13 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-04-04 16:54:21 +01:00
2018-02-05 21:35:11 +01:00