* [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC
@ 2009-02-08 6:22 Steven Rostedt
2009-02-09 9:40 ` Ingo Molnar
2009-02-09 20:16 ` Geoff Levand
0 siblings, 2 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-02-08 6:22 UTC (permalink / raw)
To: LKML, linuxppc-dev
Cc: Arnd Bergmann, Paul Mackerras, Remis Lima Baima, Ingo Molnar
Paul,
I found the bug that was causing large modules to fail in setting
up dynamic ftrace. It wound up being a simple math error. To calculate
the offset in the TOC, I had used an OR, but the bottom half was
a signed extended short, and it should have been an addition.
The fix is in my tree below, as well as posted here.
-- Steve
The following patch is in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: ppc/ftrace
Steven Rostedt (1):
ftrace, powerpc64: fix math to calculate offset in TOC
----
arch/powerpc/kernel/ftrace.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---------------------------
commit 60e611577d908119bb515ead908a46b025a4c9f9
Author: Steven Rostedt <srostedt@redhat.com>
Date: Sat Feb 7 22:00:26 2009 -0800
ftrace, powerpc64: fix math to calculate offset in TOC
Impact: fix dynamic ftrace with large modules in PPC64
The math to calculate the offset into the TOC that is taken from reading
the trampoline is incorrect. The bottom half of the offset is a signed
extended short. The current code was using an OR to create the offset
when it should have been using an addition.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 88c641d..4112175 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -191,8 +191,9 @@ __ftrace_make_nop(struct module *mod,
return -EINVAL;
}
- offset = (unsigned)((unsigned short)jmp[0]) << 16 |
- (unsigned)((unsigned short)jmp[1]);
+ /* The bottom half is signed extended */
+ offset = ((unsigned)((unsigned short)jmp[0]) << 16) +
+ (int)((short)jmp[1]);
pr_debug(" %x ", offset);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC
2009-02-08 6:22 [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC Steven Rostedt
@ 2009-02-09 9:40 ` Ingo Molnar
2009-02-09 13:08 ` Remis Lima Baima
` (2 more replies)
2009-02-09 20:16 ` Geoff Levand
1 sibling, 3 replies; 7+ messages in thread
From: Ingo Molnar @ 2009-02-09 9:40 UTC (permalink / raw)
To: Steven Rostedt
Cc: Arnd Bergmann, LKML, linuxppc-dev, Paul Mackerras,
Remis Lima Baima
* Steven Rostedt <rostedt@goodmis.org> wrote:
>
> Paul,
>
> I found the bug that was causing large modules to fail in setting
> up dynamic ftrace. It wound up being a simple math error. To calculate
> the offset in the TOC, I had used an OR, but the bottom half was
> a signed extended short, and it should have been an addition.
> The fix is in my tree below, as well as posted here.
Looks like a .29 candidate?
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC
2009-02-09 9:40 ` Ingo Molnar
@ 2009-02-09 13:08 ` Remis Lima Baima
2009-02-09 15:02 ` Steven Rostedt
2009-02-09 22:21 ` Benjamin Herrenschmidt
2 siblings, 0 replies; 7+ messages in thread
From: Remis Lima Baima @ 2009-02-09 13:08 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnd Bergmann, LKML, Steven Rostedt, linuxppc-dev, Paul Mackerras
I have just tried the patch here and everything worked great!
Very well done.
On Mon, Feb 9, 2009 at 10:40 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Steven Rostedt <rostedt@goodmis.org> wrote:
>
>>
>> Paul,
>>
>> I found the bug that was causing large modules to fail in setting
>> up dynamic ftrace. It wound up being a simple math error. To calculate
>> the offset in the TOC, I had used an OR, but the bottom half was
>> a signed extended short, and it should have been an addition.
>> The fix is in my tree below, as well as posted here.
>
> Looks like a .29 candidate?
>
> Ingo
I agree. A functional ("out-of-the-box") dynamic-ftrace helps quite a lot ;-)
Regards,
Remis
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC
2009-02-09 9:40 ` Ingo Molnar
2009-02-09 13:08 ` Remis Lima Baima
@ 2009-02-09 15:02 ` Steven Rostedt
2009-02-09 15:24 ` Ingo Molnar
2009-02-09 22:21 ` Benjamin Herrenschmidt
2 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2009-02-09 15:02 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnd Bergmann, LKML, linuxppc-dev, Paul Mackerras,
Remis Lima Baima
On Mon, 9 Feb 2009, Ingo Molnar wrote:
>
> * Steven Rostedt <rostedt@goodmis.org> wrote:
>
> >
> > Paul,
> >
> > I found the bug that was causing large modules to fail in setting
> > up dynamic ftrace. It wound up being a simple math error. To calculate
> > the offset in the TOC, I had used an OR, but the bottom half was
> > a signed extended short, and it should have been an addition.
> > The fix is in my tree below, as well as posted here.
>
> Looks like a .29 candidate?
Ingo,
I think Ben pulled them into their tree. The changes are specific to ppc,
and will probably get better user testing there. Unless you feel that we
have a bit of ppc testers using tip.
-- Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC
2009-02-09 15:02 ` Steven Rostedt
@ 2009-02-09 15:24 ` Ingo Molnar
0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2009-02-09 15:24 UTC (permalink / raw)
To: Steven Rostedt
Cc: Arnd Bergmann, LKML, linuxppc-dev, Paul Mackerras,
Remis Lima Baima
* Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Mon, 9 Feb 2009, Ingo Molnar wrote:
>
> >
> > * Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > >
> > > Paul,
> > >
> > > I found the bug that was causing large modules to fail in setting
> > > up dynamic ftrace. It wound up being a simple math error. To calculate
> > > the offset in the TOC, I had used an OR, but the bottom half was
> > > a signed extended short, and it should have been an addition.
> > > The fix is in my tree below, as well as posted here.
> >
> > Looks like a .29 candidate?
>
> Ingo,
>
> I think Ben pulled them into their tree. The changes are specific to ppc,
> and will probably get better user testing there. Unless you feel that we
> have a bit of ppc testers using tip.
no, that's fine - just wanted to make sure it goes upstream via some method.
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC
2009-02-08 6:22 [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC Steven Rostedt
2009-02-09 9:40 ` Ingo Molnar
@ 2009-02-09 20:16 ` Geoff Levand
1 sibling, 0 replies; 7+ messages in thread
From: Geoff Levand @ 2009-02-09 20:16 UTC (permalink / raw)
To: Steven Rostedt
Cc: Arnd Bergmann, LKML, linuxppc-dev, Paul Mackerras,
Remis Lima Baima, Ingo Molnar
Steven Rostedt wrote:
> I found the bug that was causing large modules to fail in setting
> up dynamic ftrace. It wound up being a simple math error. To calculate
> the offset in the TOC, I had used an OR, but the bottom half was
> a signed extended short, and it should have been an addition.
> The fix is in my tree below, as well as posted here.
> ----
> arch/powerpc/kernel/ftrace.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
I tested this on PS3 with CONFIG_FTRACE_SELFTEST=y and
CONFIG_FTRACE_SELFTEST=y, and all modules now load and
the system seems to work properly. I did not run any
tracer specific tests though.
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC
2009-02-09 9:40 ` Ingo Molnar
2009-02-09 13:08 ` Remis Lima Baima
2009-02-09 15:02 ` Steven Rostedt
@ 2009-02-09 22:21 ` Benjamin Herrenschmidt
2 siblings, 0 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2009-02-09 22:21 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnd Bergmann, LKML, Steven Rostedt, linuxppc-dev, Paul Mackerras,
Remis Lima Baima
On Mon, 2009-02-09 at 10:40 +0100, Ingo Molnar wrote:
> * Steven Rostedt <rostedt@goodmis.org> wrote:
>
> >
> > Paul,
> >
> > I found the bug that was causing large modules to fail in setting
> > up dynamic ftrace. It wound up being a simple math error. To calculate
> > the offset in the TOC, I had used an OR, but the bottom half was
> > a signed extended short, and it should have been an addition.
> > The fix is in my tree below, as well as posted here.
>
> Looks like a .29 candidate?
Yup, I was planning to send it to Linus along with a handful of other
powerpc fixes today, unless you prefer taking it yourself.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-02-09 22:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-08 6:22 [PATCH] ftrace, powerpc64: fix math to calculate offset in TOC Steven Rostedt
2009-02-09 9:40 ` Ingo Molnar
2009-02-09 13:08 ` Remis Lima Baima
2009-02-09 15:02 ` Steven Rostedt
2009-02-09 15:24 ` Ingo Molnar
2009-02-09 22:21 ` Benjamin Herrenschmidt
2009-02-09 20:16 ` Geoff Levand
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).