linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: wyang1 <Wei.Yang@windriver.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	Robert Richter <robert.richter@amd.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	<linux-kernel@vger.kernel.org>,
	<oprofile-list@lists.sourceforge.net>
Subject: Re: [PATCH] x86, 32-bit: Fix invalid stack address while in softirq
Date: Fri, 7 Sep 2012 13:21:56 +0800	[thread overview]
Message-ID: <50498474.4000900@windriver.com> (raw)
In-Reply-To: <1346946887.1680.31.camel@gandalf.local.home>

On 09/06/2012 11:54 PM, Steven Rostedt wrote:
> On Thu, 2012-09-06 at 17:36 +0200, Robert Richter wrote:
>
>> I meant:
>>
>> unsigned long kernel_stack_pointer(struct pt_regs *regs)
>> {
>> 	unsigned long context = (unsigned long)regs&  ~(THREAD_SIZE - 1);
>> 	unsigned long sp = (unsigned long)&regs->sp;
>> 	struct thread_info *tinfo;
>>
>> 	if (context == (sp&  ~(THREAD_SIZE - 1)))
>> 		return sp;
>> 	
>> 	tinfo = (struct thread_info *)context;
>> 	if (tinfo->previous_esp)
>> 		return tinfo->previous_esp;
>>
>> 	return (unsigned long)regs;
>> }
>>
>> -Robert
>>
>>> Maybe this is even better.
>>>
>>>
Stevent & Robert,

Actually, we also can revert the following commit:

commit 7b6c6c77732ca1d2498eda7eabb64f9648896e96
Author: Masami Hiramatsu <mhiramat@redhat.com>
Date:   Mon May 11 17:03:00 2009 -0400

     x86, 32-bit: fix kernel_trap_sp()

     Use &regs->sp instead of regs for getting the top of stack in 
kernel mode.
     (on x86-64, regs->sp always points the top of stack)


I meant:

static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
{
     #ifdef CONFIG_X86_32
        return (unsigned long)regs;
     #else
        return regs->sp;
     #endif
}


What do you think of it?

Thanks
Wei

> Yeah, this is probably the safest.
>
> Thanks,
>
> -- Steve
>
>
>


  reply	other threads:[~2012-09-07  5:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-27  1:32 [PATCH 1/1] x86/oprofile: Fix the calltrace upon profiling some specified events with oprofile Wei.Yang
2012-08-28  9:17 ` Robert Richter
2012-09-03  5:28   ` wyang1
2012-09-04 10:24 ` Robert Richter
2012-09-06  1:30   ` wyang1
2012-09-06 10:04     ` [PATCH] x86, 32-bit: Fix invalid stack address while in softirq Robert Richter
2012-09-06 13:14       ` Steven Rostedt
2012-09-06 15:02         ` Robert Richter
2012-09-06 15:14           ` Steven Rostedt
2012-09-06 15:34             ` Robert Richter
2012-09-06 15:36               ` Robert Richter
2012-09-06 15:54                 ` Steven Rostedt
2012-09-07  5:21                   ` wyang1 [this message]
2012-09-12 13:50       ` [PATCH -v2] " Robert Richter
2012-09-12 14:04         ` Steven Rostedt
2012-10-01 12:21         ` Robert Richter
2012-11-01 21:34         ` [tip:x86/urgent] x86-32: " tip-bot for Robert Richter
2012-11-13 15:17           ` Ingo Molnar
2012-11-13 15:56             ` Robert Richter
2012-11-15 21:53         ` tip-bot for Robert Richter
2012-11-21  7:34         ` tip-bot for Robert Richter
2012-11-21  7:35         ` [tip:x86/urgent] x86-32: Export kernel_stack_pointer() for modules tip-bot for 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=50498474.4000900@windriver.com \
    --to=wei.yang@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oprofile-list@lists.sourceforge.net \
    --cc=peterz@infradead.org \
    --cc=robert.richter@amd.com \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.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).