Re: [RFC PATCH v2 2/3] thread_local_abi: wire up x86 32/64 system call
flat view
From: Josh Triplett <hidden>
Date: 2015-12-24 03:42:36
Also in:
lkml
On December 22, 2015 10:02:12 AM PST, Mathieu Desnoyers [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Wire up the thread local ABI on x86 32/64. Call the thread_local_abi_handle_notify_resume() function on return to userspace if TIF_NOTIFY_RESUME thread flag is set. This provides an ABI improving the speed of a getcpu operation on x86 by removing the need to perform a function call, "lsl" instruction, or system call on the fast path. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org> CC: Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org> CC: Catalin Marinas <redacted> CC: Will Deacon <redacted> CC: Thomas Gleixner <redacted> CC: Paul Turner <redacted> CC: Andrew Hunter <redacted> CC: Peter Zijlstra <redacted> CC: Andy Lutomirski <redacted> CC: Andi Kleen <andi-Vw/NltI1exuRpAAqCnN02g@public.gmane.org> CC: Dave Watson <redacted> CC: Chris Lameter <redacted> CC: Ingo Molnar <redacted> CC: Ben Maurer <redacted> CC: Steven Rostedt <redacted> CC: "Paul E. McKenney" <redacted> CC: Josh Triplett <redacted> CC: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> CC: Thomas Gleixner <redacted> CC: linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org --- arch/x86/entry/common.c | 2 ++ arch/x86/entry/syscalls/syscall_32.tbl | 1 + arch/x86/entry/syscalls/syscall_64.tbl | 1 + 3 files changed, 4 insertions(+)diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index a89fdbc..222cacf 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c@@ -249,6 +249,8 @@ static void exit_to_usermode_loop(struct pt_regs*regs, u32 cached_flags) if (cached_flags & _TIF_NOTIFY_RESUME) { clear_thread_flag(TIF_NOTIFY_RESUME); tracehook_notify_resume(regs); + if (thread_local_abi_active(current)) + thread_local_abi_handle_notify_resume(current);
Every caller seems likely to duplicate this pattern; why not make the call itself a static inline containing this check and call (or no-op if compiled out)?