From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shaohua Li Date: Thu, 25 Dec 2008 01:08:29 +0000 Subject: Re: [PATCH 5/5] IA64 dynamic ftrace support Message-Id: <20081225010829.GA17283@sli10-desk.sh.intel.com> List-Id: References: <1230012500.10933.102.camel@sli10-desk.sh.intel.com> In-Reply-To: <1230012500.10933.102.camel@sli10-desk.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-ia64@vger.kernel.org On Thu, Dec 25, 2008 at 05:50:50AM +0800, Keith Owens wrote: > On Wed, 24 Dec 2008 08:29:05 -0500, > Steven Rostedt wrote: > >Yes I understand that the module and kernel code is set up differently, > >PPC is pretty much the same in this aspect. I'm asking if it is easy to > >change a call from the module to kernel core to another function in > >kernel core? > > > >Question: if I have a call from the module to _mcount, how much has to > >change in the set up of the registers to make it call ftrace_call > >instead? Perhaps we could link in a call to ftrace_call via the tricks > >in recordmcount.pl to get the info needed to make that change? > > The IA64 kernel uses the same gp register throughout, it is compiled > with -mconstant-gp. So changing the target address from one kernel > function to another only requires changing the destination address in > the PLT stub, no other registers are affected. yes, for kernel, this is simple. Just changing the target address is ok, and the change is atomic, as it's a 64-bit write. For module, it's not simple. Module has different gp register against kernel. In a module, _mcount must save its gp first and then jump to kernel. That's why we can't directly use a jump. I'm considering link some code to ftrace_call in recordmcount.pl, but recordmocunt.pl is called for each file. If a module has multiple files, there will be some duplicate code. Another issue how can we find the code's address when ftrace to convert code to nop. Thanks, Shaohua