linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathias Krause <minipli@googlemail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Mathias Krause <minipli@googlemail.com>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Brian Gerst <brgerst@gmail.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
	Andi Kleen <ak@linux.intel.com>,
	"H. Peter Anvin" <hpa@linux.intel.com>
Subject: [PATCH] x86: redo "x86: Use inline assembler to get sp"
Date: Fri,  7 Mar 2014 08:52:32 +0100	[thread overview]
Message-ID: <1394178752-18047-1-git-send-email-minipli@googlemail.com> (raw)
In-Reply-To: <tip-198d208df4371734ac4728f69cb585c284d20a15@git.kernel.org>

This patch restores the changes of commit dff38e3e93 "x86: Use inline
assembler instead of global register variable to get sp". They got lost
in commit 198d208df4 "x86: Keep thread_info on thread stack in x86_32"
while moving the code to arch/x86/kernel/irq_32.c.

Quoting Andi from commit dff38e3e93:

"""
LTO in gcc 4.6/47. has trouble with global register variables. They were
used to read the stack pointer. Use a simple inline assembler statement
with a mov instead.

This also helps LLVM/clang, which does not support global register
variables.
"""

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---

If it's not obvious, this patch should be applied to tip.git on top of
tip/x86/threadinfo.

 arch/x86/kernel/irq_32.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 988dc8bcae..63ce838e5a 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -70,7 +70,11 @@ static void call_on_stack(void *func, void *stack)
 }
 
 /* how to get the current stack pointer from C */
-register unsigned long current_stack_pointer asm("esp") __used;
+#define current_stack_pointer ({		\
+	unsigned long sp;			\
+	asm("mov %%esp,%0" : "=g" (sp));	\
+	sp;					\
+})
 
 static inline void *current_stack(void)
 {
-- 
1.7.10.4


  parent reply	other threads:[~2014-03-07  7:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 14:41 [PATCH 0/5] [GIT PULL] x86: Consolidate 32 and 64 bit thead_info (again) Steven Rostedt
2014-02-06 14:41 ` [PATCH 1/5] x86: Nuke the supervisor_stack field in i386 thread_info Steven Rostedt
2014-03-07  1:00   ` [tip:x86/threadinfo] " tip-bot for Steven Rostedt
2014-02-06 14:41 ` [PATCH 2/5] x86: Nuke GET_THREAD_INFO_WITH_ESP() macro for i386 Steven Rostedt
2014-03-07  1:00   ` [tip:x86/threadinfo] " tip-bot for Steven Rostedt (Red Hat)
2014-02-06 14:41 ` [PATCH 3/5] x86: Prepare removal of previous_esp from i386 thread_info structure Steven Rostedt
2014-03-07  1:01   ` [tip:x86/threadinfo] " tip-bot for Steven Rostedt
2014-02-06 14:41 ` [PATCH 4/5] x86: Keep thread_info on thread stack in x86_32 Steven Rostedt
2014-03-07  1:01   ` [tip:x86/threadinfo] " tip-bot for Steven Rostedt
2014-03-07  7:52   ` Mathias Krause [this message]
2014-03-11  0:36     ` [tip:x86/threadinfo] x86, threadinfo: Redo "x86: Use inline assembler to get sp" tip-bot for Mathias Krause
2014-02-06 14:41 ` [PATCH 5/5] x86: Clean up dumpstack_64.c code Steven Rostedt
2014-03-07  1:01   ` [tip:x86/threadinfo] " tip-bot for Steven Rostedt
2014-02-28 13:52 ` [PATCH 0/5] [GIT PULL] x86: Consolidate 32 and 64 bit thead_info (again) Steven Rostedt
  -- strict thread matches above, loose matches on Subject: below --
2011-08-06  1:11 [PATCH 0/4 v2] [GIT PULL][v3.2] x86: Consolidate 32 and 64 bit thread_info Steven Rostedt
2011-08-06  1:11 ` [PATCH 1/4 v2] x86: Nuke the supervisor_stack field in i386 thread_info Steven Rostedt
2011-08-06  1:11 ` [PATCH 2/4 v2] x86: Remove previous_esp from i386 thread_info structure Steven Rostedt
2011-08-06  1:11 ` [PATCH 3/4 v2] x86: Keep thread_info on thread stack in x86_32 Steven Rostedt
2011-08-06  1:11 ` [PATCH 4/4 v2] x86: Clean up dumpstack_64.c code Steven Rostedt
2011-08-06  2:04 ` [PATCH 0/4 v2] [GIT PULL][v3.2] x86: Consolidate 32 and 64 bit thread_info H. Peter Anvin
2011-08-08 21:23   ` Steven Rostedt
2011-08-19  2:01   ` Steven Rostedt
2011-08-19  5:17     ` H. Peter Anvin

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=1394178752-18047-1-git-send-email-minipli@googlemail.com \
    --to=minipli@googlemail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=brgerst@gmail.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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).