linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: tracing: Optimize the implementation

To: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH] MIPS: tracing: Optimize the implementation
From: Wu Zhangjin <wuzhangjin@gmail.com>
Date: Fri, 12 Mar 2010 22:57:08 +0800
Cc: Ralf Baechle <ralf@linux-mips.org>, Steven Rostedt <srostedt@redhat.com>, linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:reply-to:to:cc :in-reply-to:references:content-type:organization:date:message-id :mime-version:x-mailer:content-transfer-encoding; bh=7DRRm1y41sEgGyKsYWpW4b4Cv34B6XM69lXsKM6TCpQ=; b=PXxmf9m82nf8ijFsHmjQ6E9cDa7hkUsn/+YcLNLkZYOAzl+RMsx3zqWFFnz7x7MWMA LPZ5bBZxe7NxBy3oW4i1ye8S2wESZszI15FjM7cvo8xMtISJ3MB0AZ808ssjZMaEmTeO ZuoVHRBRLzHsptBmNZ7nEmT/WRTt0tsivYnaw=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:reply-to:to:cc:in-reply-to:references:content-type :organization:date:message-id:mime-version:x-mailer :content-transfer-encoding; b=xUboVqciTDBBzi7Bt7p+KzOuLOke5DSTxBng1r6YE0AtQYdX/znRvkdZ1lctEuSIRz TT73IFrICsafvoasESvsUvIjvbEHiQEurJs/jYnSdAzYNUnoPi7yplgGz+US5VxtIAeV bWJF+1RF3AG4iUEMZTL3kufBDa4U5SCJGa/Ec=
In-reply-to: <1268394209.6447.94.camel@falcon>
Organization: DSLab, Lanzhou University, China
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <8b93c417fefa4d446f801abfd718ba94fdcb1821.1268330348.git.wuzhangjin@gmail.com> <4B993B32.7000006@caviumnetworks.com> <1268394209.6447.94.camel@falcon>
Reply-to: wuzhangjin@gmail.com
Sender: linux-mips-bounce@linux-mips.org
On Fri, 2010-03-12 at 19:43 +0800, Wu Zhangjin wrote:
[...]
> Right, then, we can search the JAL or JALR, for kernel, will get it
> immediatly, for module, will only several instructions, we can do this
> searching in ftrace_make_nop and ftrace_make_call at run-time, but just
> found we can use the following function to do it in ftrace_init(), looks
> good.
> 
> static inline int is_call_mcount(unsigned int insn)
> {
>       return ((insn & JAL) == JAL) || (insn == JALR_V1);
> }
> 
> static inline unsinged long mcount_callsite(unsigned long addr)
> {
>       unsigned int insn;
> 
>       insn = *(unsigned int *)addr; /*need safe_load_code*/
>       if (is_call_mcount(insn))
>               return addr;
> 
>       do {
>               addr += 4;      /* what about big endian? */
>               insn = *(unsigned int *)addr; /*need safe_load_code*/
>       } while (!is_call_mcount(insn));
> 

This is not possible for modules, for currently, the modules are not
loaded yet.

Regards,
        Wu Zhangjin


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