From: Masami Hiramatsu <mhiramat@redhat.com>
To: Harvey Harrison <harvey.harrison@gmail.com>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Jim Keniston <jkenisto@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] x86: kprobes remove fix_riprel #ifdef
Date: Sun, 30 Dec 2007 01:37:33 -0500 [thread overview]
Message-ID: <47773CAD.7050907@redhat.com> (raw)
In-Reply-To: <1198466917.6323.15.camel@brick>
Hello Harvey,
A similar idea was already nack-ed by Ananth.
http://sources.redhat.com/ml/systemtap/2007-q4/msg00468.html
And I agree his thought.
Especially, "riprel" does not exist on x86_32, so fix_riprel()
is meaningless on it.
Thus, I think it would better be ifdef'd in call-site.
Harvey Harrison wrote:
> Move #ifdef around function definiton into the function and
> unconditionally return on X86_32. Saves an ifdef from the
> one callsite.
>
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
> Ingo, Masami, final leftovers from some unsent kprobes unification work.
>
> Net reduction of one #ifdef section.
>
> arch/x86/kernel/kprobes.c | 11 +++++++----
> 1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
> index b1804e4..1ac532e 100644
> --- a/arch/x86/kernel/kprobes.c
> +++ b/arch/x86/kernel/kprobes.c
> @@ -263,15 +263,16 @@ static int __kprobes is_IF_modifier(kprobe_opcode_t *insn)
> return 0;
> }
>
> -#ifdef CONFIG_X86_64
> /*
> * Adjust the displacement if the instruction uses the %rip-relative
> * addressing mode.
> * If it does, Return the address of the 32-bit displacement word.
> * If not, return null.
> + * Only applicable to X86_64
> */
> static void __kprobes fix_riprel(struct kprobe *p)
> {
> +#ifdef CONFIG_X86_64
> u8 *insn = p->ainsn.insn;
> s64 disp;
> int need_modrm;
> @@ -335,15 +336,17 @@ static void __kprobes fix_riprel(struct kprobe *p)
> *(s32 *)insn = (s32) disp;
> }
> }
> -}
> +#else
> + return;
> #endif
> +}
>
> static void __kprobes arch_copy_kprobe(struct kprobe *p)
> {
> memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
> -#ifdef CONFIG_X86_64
> +
> fix_riprel(p);
> -#endif
> +
> if (can_boost(p->addr))
> p->ainsn.boostable = 0;
> else
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com, masami.hiramatsu.pt@hitachi.com
next prev parent reply other threads:[~2007-12-30 6:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-24 3:28 [PATCH] x86: kprobes remove fix_riprel #ifdef Harvey Harrison
2007-12-30 6:37 ` Masami Hiramatsu [this message]
2007-12-30 13:23 ` Ingo Molnar
2007-12-30 14:52 ` Masami Hiramatsu
2007-12-30 15:45 ` Ingo Molnar
2007-12-30 20:04 ` Masami Hiramatsu
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=47773CAD.7050907@redhat.com \
--to=mhiramat@redhat.com \
--cc=ananth@in.ibm.com \
--cc=harvey.harrison@gmail.com \
--cc=hpa@zytor.com \
--cc=jkenisto@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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