mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk
@ 2015-03-25 20:14 Denys Vlasenko
  2015-03-25 20:14 ` [PATCH 1/3] x86: move ARCH_LOCKDEP_SYS_EXIT[IRQ] defines closer to their users Denys Vlasenko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Denys Vlasenko @ 2015-03-25 20:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Denys Vlasenko, Linus Torvalds, Steven Rostedt, Borislav Petkov,
	H. Peter Anvin, Andy Lutomirski, Oleg Nesterov,
	Frederic Weisbecker, Alexei Starovoitov, Will Drewry, Kees Cook,
	x86, linux-kernel

Recent change to struct pt_regs handling in entry.S, among other things,
changed how callee-preserved registers are saved around call
to lockdep_sys_exit_thunk:

 #    define LOCKDEP_SYS_EXIT_IRQ \
        TRACE_IRQS_ON; \
        sti; \
        SAVE_EXTRA_REGS; \    <======= HERE
        LOCKDEP_SYS_EXIT; \
        RESTORE_EXTRA_REGS; \ <======= HERE

The change is in fact a bit fragile:
now we assume that LOCKDEP_SYS_EXIT_IRQ macro is used only
when there is a struct pt_regs on the stack.

So far this assumption is true, but it is probably a coincidence.

We can revert back to pushing registers, but this callee-preserved registers
saving appears bogus. It is not necessary: they _are_ callee-preserved,
and lockdep_sys_exit() does not touch them on the stack either.

First two patches clean up #define maze so that we can see
that LOCKDEP_SYS_EXIT macro call above is merely "call lockdep_sys_exit_thunk".

Last patch removes SAVE/RESTORE.

I tested this patch series and everything seems to run fine
on a lockdep-enabled kernel with these lines removed.

Denys Vlasenko (3):
  x86: move ARCH_LOCKDEP_SYS_EXIT[IRQ] defines closer to their users
  x86: fold ARCH_LOCKDEP_SYS_EXIT defines into their users
  x86: do not save callee-preserved registers around lockdep_sys_exit_thunk

 arch/x86/include/asm/irqflags.h | 45 +++++++++++++++++------------------------
 1 file changed, 19 insertions(+), 26 deletions(-)

CC: Linus Torvalds <torvalds@linux-foundation.org>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ingo Molnar <mingo@kernel.org>
CC: Borislav Petkov <bp@alien8.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Oleg Nesterov <oleg@redhat.com>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Alexei Starovoitov <ast@plumgrid.com>
CC: Will Drewry <wad@chromium.org>
CC: Kees Cook <keescook@chromium.org>
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org

-- 
1.8.1.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] x86: move ARCH_LOCKDEP_SYS_EXIT[IRQ] defines closer to their users
  2015-03-25 20:14 [PATCH 0/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk Denys Vlasenko
@ 2015-03-25 20:14 ` Denys Vlasenko
  2015-03-27 11:47   ` [tip:x86/asm] x86/irq/tracing: Move ARCH_LOCKDEP_SYS_EXIT " tip-bot for Denys Vlasenko
  2015-03-25 20:14 ` [PATCH 2/3] x86: fold ARCH_LOCKDEP_SYS_EXIT defines into " Denys Vlasenko
  2015-03-25 20:14 ` [PATCH 3/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk Denys Vlasenko
  2 siblings, 1 reply; 7+ messages in thread
From: Denys Vlasenko @ 2015-03-25 20:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Denys Vlasenko, Linus Torvalds, Steven Rostedt, Borislav Petkov,
	H. Peter Anvin, Andy Lutomirski, Oleg Nesterov,
	Frederic Weisbecker, Alexei Starovoitov, Will Drewry, Kees Cook,
	x86, linux-kernel

This change simply moves defines around (even if it's not obvious in a patch form).
Nothing is changed.

This is a preparation for folding ARCH_LOCKDEP_SYS_EXIT defines into their users.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: Linus Torvalds <torvalds@linux-foundation.org>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ingo Molnar <mingo@kernel.org>
CC: Borislav Petkov <bp@alien8.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Oleg Nesterov <oleg@redhat.com>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Alexei Starovoitov <ast@plumgrid.com>
CC: Will Drewry <wad@chromium.org>
CC: Kees Cook <keescook@chromium.org>
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org
---
 arch/x86/include/asm/irqflags.h | 37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 021bee9..55866c2 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -163,12 +163,20 @@ static inline int arch_irqs_disabled(void)
 
 	return arch_irqs_disabled_flags(flags);
 }
+#endif /* !__ASSEMBLY__ */
 
+#ifdef __ASSEMBLY__
+#ifdef CONFIG_TRACE_IRQFLAGS
+#  define TRACE_IRQS_ON		call trace_hardirqs_on_thunk;
+#  define TRACE_IRQS_OFF	call trace_hardirqs_off_thunk;
 #else
-
-#ifdef CONFIG_X86_64
-#define ARCH_LOCKDEP_SYS_EXIT		call lockdep_sys_exit_thunk
-#define ARCH_LOCKDEP_SYS_EXIT_IRQ	\
+#  define TRACE_IRQS_ON
+#  define TRACE_IRQS_OFF
+#endif
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#  ifdef CONFIG_X86_64
+#    define ARCH_LOCKDEP_SYS_EXIT	call lockdep_sys_exit_thunk
+#    define ARCH_LOCKDEP_SYS_EXIT_IRQ \
 	TRACE_IRQS_ON; \
 	sti; \
 	SAVE_EXTRA_REGS; \
@@ -176,9 +184,8 @@ static inline int arch_irqs_disabled(void)
 	RESTORE_EXTRA_REGS; \
 	cli; \
 	TRACE_IRQS_OFF;
-
-#else
-#define ARCH_LOCKDEP_SYS_EXIT			\
+#  else
+#    define ARCH_LOCKDEP_SYS_EXIT \
 	pushl %eax;				\
 	pushl %ecx;				\
 	pushl %edx;				\
@@ -186,24 +193,14 @@ static inline int arch_irqs_disabled(void)
 	popl %edx;				\
 	popl %ecx;				\
 	popl %eax;
-
-#define ARCH_LOCKDEP_SYS_EXIT_IRQ
-#endif
-
-#ifdef CONFIG_TRACE_IRQFLAGS
-#  define TRACE_IRQS_ON		call trace_hardirqs_on_thunk;
-#  define TRACE_IRQS_OFF	call trace_hardirqs_off_thunk;
-#else
-#  define TRACE_IRQS_ON
-#  define TRACE_IRQS_OFF
-#endif
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#    define ARCH_LOCKDEP_SYS_EXIT_IRQ
+#  endif
 #  define LOCKDEP_SYS_EXIT	ARCH_LOCKDEP_SYS_EXIT
 #  define LOCKDEP_SYS_EXIT_IRQ	ARCH_LOCKDEP_SYS_EXIT_IRQ
 # else
 #  define LOCKDEP_SYS_EXIT
 #  define LOCKDEP_SYS_EXIT_IRQ
 # endif
-
 #endif /* __ASSEMBLY__ */
+
 #endif
-- 
1.8.1.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] x86: fold ARCH_LOCKDEP_SYS_EXIT defines into their users
  2015-03-25 20:14 [PATCH 0/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk Denys Vlasenko
  2015-03-25 20:14 ` [PATCH 1/3] x86: move ARCH_LOCKDEP_SYS_EXIT[IRQ] defines closer to their users Denys Vlasenko
@ 2015-03-25 20:14 ` Denys Vlasenko
  2015-03-27 11:47   ` [tip:x86/asm] x86/irq/tracing: Fold " tip-bot for Denys Vlasenko
  2015-03-25 20:14 ` [PATCH 3/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk Denys Vlasenko
  2 siblings, 1 reply; 7+ messages in thread
From: Denys Vlasenko @ 2015-03-25 20:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Denys Vlasenko, Linus Torvalds, Steven Rostedt, Borislav Petkov,
	H. Peter Anvin, Andy Lutomirski, Oleg Nesterov,
	Frederic Weisbecker, Alexei Starovoitov, Will Drewry, Kees Cook,
	x86, linux-kernel

There is no need to have an extra level of macro indirection here.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: Linus Torvalds <torvalds@linux-foundation.org>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ingo Molnar <mingo@kernel.org>
CC: Borislav Petkov <bp@alien8.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Oleg Nesterov <oleg@redhat.com>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Alexei Starovoitov <ast@plumgrid.com>
CC: Will Drewry <wad@chromium.org>
CC: Kees Cook <keescook@chromium.org>
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org
---
 arch/x86/include/asm/irqflags.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 55866c2..19355f3 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -175,17 +175,17 @@ static inline int arch_irqs_disabled(void)
 #endif
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 #  ifdef CONFIG_X86_64
-#    define ARCH_LOCKDEP_SYS_EXIT	call lockdep_sys_exit_thunk
-#    define ARCH_LOCKDEP_SYS_EXIT_IRQ \
+#    define LOCKDEP_SYS_EXIT		call lockdep_sys_exit_thunk
+#    define LOCKDEP_SYS_EXIT_IRQ \
 	TRACE_IRQS_ON; \
 	sti; \
 	SAVE_EXTRA_REGS; \
-	LOCKDEP_SYS_EXIT; \
+	call lockdep_sys_exit_thunk; \
 	RESTORE_EXTRA_REGS; \
 	cli; \
 	TRACE_IRQS_OFF;
 #  else
-#    define ARCH_LOCKDEP_SYS_EXIT \
+#    define LOCKDEP_SYS_EXIT \
 	pushl %eax;				\
 	pushl %ecx;				\
 	pushl %edx;				\
@@ -193,14 +193,12 @@ static inline int arch_irqs_disabled(void)
 	popl %edx;				\
 	popl %ecx;				\
 	popl %eax;
-#    define ARCH_LOCKDEP_SYS_EXIT_IRQ
+#    define LOCKDEP_SYS_EXIT_IRQ
 #  endif
-#  define LOCKDEP_SYS_EXIT	ARCH_LOCKDEP_SYS_EXIT
-#  define LOCKDEP_SYS_EXIT_IRQ	ARCH_LOCKDEP_SYS_EXIT_IRQ
-# else
+#else
 #  define LOCKDEP_SYS_EXIT
 #  define LOCKDEP_SYS_EXIT_IRQ
-# endif
+#endif
 #endif /* __ASSEMBLY__ */
 
 #endif
-- 
1.8.1.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk
  2015-03-25 20:14 [PATCH 0/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk Denys Vlasenko
  2015-03-25 20:14 ` [PATCH 1/3] x86: move ARCH_LOCKDEP_SYS_EXIT[IRQ] defines closer to their users Denys Vlasenko
  2015-03-25 20:14 ` [PATCH 2/3] x86: fold ARCH_LOCKDEP_SYS_EXIT defines into " Denys Vlasenko
@ 2015-03-25 20:14 ` Denys Vlasenko
  2015-03-27 11:47   ` [tip:x86/asm] x86/irq/tracing: Do " tip-bot for Denys Vlasenko
  2 siblings, 1 reply; 7+ messages in thread
From: Denys Vlasenko @ 2015-03-25 20:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Denys Vlasenko, Linus Torvalds, Steven Rostedt, Borislav Petkov,
	H. Peter Anvin, Andy Lutomirski, Oleg Nesterov,
	Frederic Weisbecker, Alexei Starovoitov, Will Drewry, Kees Cook,
	x86, linux-kernel

Internally, lockdep_sys_exit_thunk saves callee-clobbered registers,
and calls a C function, lockdep_sys_exit. Thus, callee-preserved registers
won't be mangled, there is no need to save them.

Patch was run-tested.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: Linus Torvalds <torvalds@linux-foundation.org>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ingo Molnar <mingo@kernel.org>
CC: Borislav Petkov <bp@alien8.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Oleg Nesterov <oleg@redhat.com>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Alexei Starovoitov <ast@plumgrid.com>
CC: Will Drewry <wad@chromium.org>
CC: Kees Cook <keescook@chromium.org>
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org
---
 arch/x86/include/asm/irqflags.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 19355f3..9a63eae 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -179,9 +179,7 @@ static inline int arch_irqs_disabled(void)
 #    define LOCKDEP_SYS_EXIT_IRQ \
 	TRACE_IRQS_ON; \
 	sti; \
-	SAVE_EXTRA_REGS; \
 	call lockdep_sys_exit_thunk; \
-	RESTORE_EXTRA_REGS; \
 	cli; \
 	TRACE_IRQS_OFF;
 #  else
-- 
1.8.1.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip:x86/asm] x86/irq/tracing: Move ARCH_LOCKDEP_SYS_EXIT defines closer to their users
  2015-03-25 20:14 ` [PATCH 1/3] x86: move ARCH_LOCKDEP_SYS_EXIT[IRQ] defines closer to their users Denys Vlasenko
@ 2015-03-27 11:47   ` tip-bot for Denys Vlasenko
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Denys Vlasenko @ 2015-03-27 11:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, oleg, wad, tglx, fweisbec, ast, torvalds, bp,
	linux-kernel, rostedt, dvlasenk, keescook, hpa, luto

Commit-ID:  40e2ec657dcb0ae328db1abc8e37df4caa893391
Gitweb:     http://git.kernel.org/tip/40e2ec657dcb0ae328db1abc8e37df4caa893391
Author:     Denys Vlasenko <dvlasenk@redhat.com>
AuthorDate: Wed, 25 Mar 2015 21:14:26 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 27 Mar 2015 10:01:48 +0100

x86/irq/tracing: Move ARCH_LOCKDEP_SYS_EXIT defines closer to their users

This change simply moves defines around (even if it's not
obvious in a patch form). Nothing is changed.

This is a preparation for folding ARCH_LOCKDEP_SYS_EXIT defines
into their users.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/1427314468-12763-2-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/irqflags.h | 37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 021bee9..55866c2 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -163,12 +163,20 @@ static inline int arch_irqs_disabled(void)
 
 	return arch_irqs_disabled_flags(flags);
 }
+#endif /* !__ASSEMBLY__ */
 
+#ifdef __ASSEMBLY__
+#ifdef CONFIG_TRACE_IRQFLAGS
+#  define TRACE_IRQS_ON		call trace_hardirqs_on_thunk;
+#  define TRACE_IRQS_OFF	call trace_hardirqs_off_thunk;
 #else
-
-#ifdef CONFIG_X86_64
-#define ARCH_LOCKDEP_SYS_EXIT		call lockdep_sys_exit_thunk
-#define ARCH_LOCKDEP_SYS_EXIT_IRQ	\
+#  define TRACE_IRQS_ON
+#  define TRACE_IRQS_OFF
+#endif
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#  ifdef CONFIG_X86_64
+#    define ARCH_LOCKDEP_SYS_EXIT	call lockdep_sys_exit_thunk
+#    define ARCH_LOCKDEP_SYS_EXIT_IRQ \
 	TRACE_IRQS_ON; \
 	sti; \
 	SAVE_EXTRA_REGS; \
@@ -176,9 +184,8 @@ static inline int arch_irqs_disabled(void)
 	RESTORE_EXTRA_REGS; \
 	cli; \
 	TRACE_IRQS_OFF;
-
-#else
-#define ARCH_LOCKDEP_SYS_EXIT			\
+#  else
+#    define ARCH_LOCKDEP_SYS_EXIT \
 	pushl %eax;				\
 	pushl %ecx;				\
 	pushl %edx;				\
@@ -186,24 +193,14 @@ static inline int arch_irqs_disabled(void)
 	popl %edx;				\
 	popl %ecx;				\
 	popl %eax;
-
-#define ARCH_LOCKDEP_SYS_EXIT_IRQ
-#endif
-
-#ifdef CONFIG_TRACE_IRQFLAGS
-#  define TRACE_IRQS_ON		call trace_hardirqs_on_thunk;
-#  define TRACE_IRQS_OFF	call trace_hardirqs_off_thunk;
-#else
-#  define TRACE_IRQS_ON
-#  define TRACE_IRQS_OFF
-#endif
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#    define ARCH_LOCKDEP_SYS_EXIT_IRQ
+#  endif
 #  define LOCKDEP_SYS_EXIT	ARCH_LOCKDEP_SYS_EXIT
 #  define LOCKDEP_SYS_EXIT_IRQ	ARCH_LOCKDEP_SYS_EXIT_IRQ
 # else
 #  define LOCKDEP_SYS_EXIT
 #  define LOCKDEP_SYS_EXIT_IRQ
 # endif
-
 #endif /* __ASSEMBLY__ */
+
 #endif

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip:x86/asm] x86/irq/tracing: Fold ARCH_LOCKDEP_SYS_EXIT defines into their users
  2015-03-25 20:14 ` [PATCH 2/3] x86: fold ARCH_LOCKDEP_SYS_EXIT defines into " Denys Vlasenko
@ 2015-03-27 11:47   ` tip-bot for Denys Vlasenko
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Denys Vlasenko @ 2015-03-27 11:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: luto, oleg, rostedt, bp, dvlasenk, torvalds, hpa, ast, fweisbec,
	keescook, tglx, wad, mingo, linux-kernel

Commit-ID:  7dc7cc0780b04935f1127fa22ee23e9d6daf166a
Gitweb:     http://git.kernel.org/tip/7dc7cc0780b04935f1127fa22ee23e9d6daf166a
Author:     Denys Vlasenko <dvlasenk@redhat.com>
AuthorDate: Wed, 25 Mar 2015 21:14:27 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 27 Mar 2015 10:01:49 +0100

x86/irq/tracing: Fold ARCH_LOCKDEP_SYS_EXIT defines into their users

There is no need to have an extra level of macro indirection
here.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/1427314468-12763-3-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/irqflags.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 55866c2..19355f3 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -175,17 +175,17 @@ static inline int arch_irqs_disabled(void)
 #endif
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 #  ifdef CONFIG_X86_64
-#    define ARCH_LOCKDEP_SYS_EXIT	call lockdep_sys_exit_thunk
-#    define ARCH_LOCKDEP_SYS_EXIT_IRQ \
+#    define LOCKDEP_SYS_EXIT		call lockdep_sys_exit_thunk
+#    define LOCKDEP_SYS_EXIT_IRQ \
 	TRACE_IRQS_ON; \
 	sti; \
 	SAVE_EXTRA_REGS; \
-	LOCKDEP_SYS_EXIT; \
+	call lockdep_sys_exit_thunk; \
 	RESTORE_EXTRA_REGS; \
 	cli; \
 	TRACE_IRQS_OFF;
 #  else
-#    define ARCH_LOCKDEP_SYS_EXIT \
+#    define LOCKDEP_SYS_EXIT \
 	pushl %eax;				\
 	pushl %ecx;				\
 	pushl %edx;				\
@@ -193,14 +193,12 @@ static inline int arch_irqs_disabled(void)
 	popl %edx;				\
 	popl %ecx;				\
 	popl %eax;
-#    define ARCH_LOCKDEP_SYS_EXIT_IRQ
+#    define LOCKDEP_SYS_EXIT_IRQ
 #  endif
-#  define LOCKDEP_SYS_EXIT	ARCH_LOCKDEP_SYS_EXIT
-#  define LOCKDEP_SYS_EXIT_IRQ	ARCH_LOCKDEP_SYS_EXIT_IRQ
-# else
+#else
 #  define LOCKDEP_SYS_EXIT
 #  define LOCKDEP_SYS_EXIT_IRQ
-# endif
+#endif
 #endif /* __ASSEMBLY__ */
 
 #endif

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip:x86/asm] x86/irq/tracing: Do not save callee-preserved registers around lockdep_sys_exit_thunk
  2015-03-25 20:14 ` [PATCH 3/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk Denys Vlasenko
@ 2015-03-27 11:47   ` tip-bot for Denys Vlasenko
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Denys Vlasenko @ 2015-03-27 11:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, rostedt, wad, linux-kernel, fweisbec, hpa, dvlasenk, bp,
	luto, ast, keescook, oleg, tglx, torvalds

Commit-ID:  aa6d9a128b861fe7e9dc37bcc37179837674b739
Gitweb:     http://git.kernel.org/tip/aa6d9a128b861fe7e9dc37bcc37179837674b739
Author:     Denys Vlasenko <dvlasenk@redhat.com>
AuthorDate: Wed, 25 Mar 2015 21:14:28 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 27 Mar 2015 10:01:49 +0100

x86/irq/tracing: Do not save callee-preserved registers around lockdep_sys_exit_thunk

Internally, lockdep_sys_exit_thunk saves callee-clobbered
registers, and calls a C function, lockdep_sys_exit. Thus,
callee-preserved registers won't be mangled, there is no need to
save them.

Patch was run-tested.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/1427314468-12763-4-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/irqflags.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 19355f3..9a63eae 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -179,9 +179,7 @@ static inline int arch_irqs_disabled(void)
 #    define LOCKDEP_SYS_EXIT_IRQ \
 	TRACE_IRQS_ON; \
 	sti; \
-	SAVE_EXTRA_REGS; \
 	call lockdep_sys_exit_thunk; \
-	RESTORE_EXTRA_REGS; \
 	cli; \
 	TRACE_IRQS_OFF;
 #  else

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-27 11:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 20:14 [PATCH 0/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk Denys Vlasenko
2015-03-25 20:14 ` [PATCH 1/3] x86: move ARCH_LOCKDEP_SYS_EXIT[IRQ] defines closer to their users Denys Vlasenko
2015-03-27 11:47   ` [tip:x86/asm] x86/irq/tracing: Move ARCH_LOCKDEP_SYS_EXIT " tip-bot for Denys Vlasenko
2015-03-25 20:14 ` [PATCH 2/3] x86: fold ARCH_LOCKDEP_SYS_EXIT defines into " Denys Vlasenko
2015-03-27 11:47   ` [tip:x86/asm] x86/irq/tracing: Fold " tip-bot for Denys Vlasenko
2015-03-25 20:14 ` [PATCH 3/3] x86: do not save callee-preserved registers around lockdep_sys_exit_thunk Denys Vlasenko
2015-03-27 11:47   ` [tip:x86/asm] x86/irq/tracing: Do " tip-bot for Denys Vlasenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome