From: Paul Mackerras <paulus@samba.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Rusty Russell <rusty@rustcorp.com.au>, Pekka Paalanen <pq@iki.fi>,
linux-kernel@vger.kernel.org, David Miller <davem@davemloft.net>,
linuxppc-dev@ozlabs.org, Steven Rostedt <srostedt@redhat.com>,
Paul Mundt <lethal@linux-sh.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 2/7] ftrace, ppc: convert to new dynamic ftrace arch API
Date: Mon, 17 Nov 2008 14:57:51 +1100 [thread overview]
Message-ID: <18720.60351.611649.125429@drongo.ozlabs.ibm.com> (raw)
In-Reply-To: <20081116212515.331278109@goodmis.org>
Steven Rostedt writes:
> +static int test_24bit_addr(unsigned long ip, unsigned long addr)
> +{
> + unsigned long diff;
> +
> + /* can we get to addr from ip in 24 bits? */
> + diff = ip > addr ? ip - addr : addr - ip;
> +
> + return !(diff & ((unsigned long)-1 << 24));
Since a branch instruction can reach +/- 32MB, the 24 needs to be 25.
It's 25 not 26 since you have effectively accounted for one bit by
taking the absolute value of the offset. Also, this will say that an
offset of -0x2000000 is out of range whereas it is just in range.
That probably doesn't matter unless you're relying on this to give
exactly the same answer in all cases as tests done elsewhere (e.g. in
module_64.c).
Note that the address difference being too large isn't the only reason
for a procedure call to go via a trampoline on ppc64. A trampoline is
also needed when the called function uses a different TOC from the
caller. The most obvious example of this is when the caller is in a
module and the callee is in the main kernel or another module.
Currently all functions in the main kernel use the same TOC, but the
linker is capable of dividing up a large executable into groups of
functions and assigning a different TOC to each group, in order to
avoid any of the TOCs getting too large (a TOC is limited to 64kB).
If the linker does that, it automatically inserts trampolines to
handle the TOC change.
Paul.
next prev parent reply other threads:[~2008-11-17 3:57 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-16 21:24 [PATCH 0/7] Porting dynmaic ftrace to PowerPC Steven Rostedt
2008-11-16 21:24 ` [PATCH 1/7] ftrace, PPC: do not latency trace idle Steven Rostedt
2008-11-17 3:43 ` Paul Mackerras
2008-11-17 15:43 ` Steven Rostedt
2008-11-16 21:24 ` [PATCH 2/7] ftrace, ppc: convert to new dynamic ftrace arch API Steven Rostedt
2008-11-17 3:57 ` Paul Mackerras [this message]
2008-11-17 15:47 ` Steven Rostedt
2008-11-16 21:24 ` [PATCH 3/7] ftrace: powerpc mcount record port Steven Rostedt
2008-11-16 21:24 ` [PATCH 4/7] ftrace, PPC: use probe_kernel API to modify code Steven Rostedt
2008-11-17 4:44 ` Paul Mackerras
2008-11-17 15:51 ` Steven Rostedt
2008-11-16 21:24 ` [PATCH 5/7] ftrace, PPC64: handle module trampolines for dyn ftrace Steven Rostedt
2008-11-17 5:00 ` Paul Mackerras
2008-11-17 16:02 ` Steven Rostedt
2008-11-17 16:18 ` Steven Rostedt
2008-11-16 21:24 ` [PATCH 6/7] ftrace,ppc32: enabled dynamic ftrace Steven Rostedt
2008-11-16 21:24 ` [PATCH 7/7] ftrace,ppc32: dynamic ftrace to handle modules Steven Rostedt
2008-11-16 22:55 ` [PATCH 0/7] Porting dynmaic ftrace to PowerPC Paul Mackerras
2008-11-17 15:42 ` Steven Rostedt
2008-11-17 20:03 ` Steven Rostedt
2008-11-18 13:56 ` Steven Rostedt
2008-11-19 2:38 ` Paul Mackerras
2008-11-19 3:04 ` Steven Rostedt
2008-11-19 9:27 ` Ingo Molnar
2008-11-19 10:38 ` Paul Mackerras
2008-11-19 10:57 ` Ingo Molnar
2008-11-19 11:35 ` Paul Mackerras
2008-11-19 12:10 ` Steven Rostedt
2008-11-19 12:15 ` Steven Rostedt
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=18720.60351.611649.125429@drongo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=fweisbec@gmail.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=pq@iki.fi \
--cc=rostedt@goodmis.org \
--cc=rusty@rustcorp.com.au \
--cc=srostedt@redhat.com \
--cc=tglx@linutronix.de \
/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).