linux-mips
[Top] [All Lists]

Re: [PATCH 2/5] tracing, MIPS: Substitute in_kernel_space() for in_modul

To: Wu Zhangjin <wuzhangjin@gmail.com>
Subject: Re: [PATCH 2/5] tracing, MIPS: Substitute in_kernel_space() for in_module()
From: Ralf Baechle <ralf@linux-mips.org>
Date: Mon, 24 Jan 2011 14:57:13 +0100
Cc: Steven Rostedt <srostedt@redhat.com>, linux-mips@linux-mips.org
In-reply-to: <bce694a8e18c01fa0d2cc667561870b56a7d672f.1295464855.git.wuzhangjin@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <cover.1295464855.git.wuzhangjin@gmail.com> <bce694a8e18c01fa0d2cc667561870b56a7d672f.1295464855.git.wuzhangjin@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Jan 20, 2011 at 03:28:29AM +0800, Wu Zhangjin wrote:

> @@ -91,10 +91,16 @@ int ftrace_make_nop(struct module *mod,
>       unsigned long ip = rec->ip;
>  
>       /*
> -      * We have compiled module with -mlong-calls, but compiled the kernel
> -      * without it, we need to cope with them respectively.
> +      * If ip is in kernel space, no long call, otherwise, long call is
> +      * needed.
>        */

Or even better, just check if the destination is in the same 28-bit segment
of address space.  Something like:

        if ((src ^ dst) >> 28)  {
                /* out of range of simple R_MIPS_26 relocation */
        }

That way you no longer rely on a particular address layout - and there are
plans to change the address space layout eventually!

  Ralf

<Prev in Thread] Current Thread [Next in Thread>