FTrace on MPC8xx

Joakim Tjernlund joakim.tjernlund at transmode.se
Fri Apr 15 05:21:23 EST 2011


>
> Stefan Roese <ml at stefan-roese.de> wrote on 2011/04/14 17:59:30:
> >
> > Hi Joakim,
> >
> > On Wednesday 13 April 2011 17:38:03 Joakim Tjernlund wrote:
> > > > > How big was the size to copy_tofrom_user()? Did it mange to copy
> > > > > any bytes?
> > > >
> > > > The size in __copy_tofrom_user is 4. And its the first call in
> > > > ftrace_modify_code() that fails directly. This works just fine on a
> > > > PPC440EPx board.
> > >
> > > Since the size is only 4 it would not use dcbX anyway(I think).
> > > Then is is probably called with the wrong addresses?
> >
> > No, addresses seem to be correct. I checked a bit further (I'm quite new to
> > the MPC8xx MMU) and it seems that trying to modify the code (that's the
> > destination address) via __copy_tofrom_user() fails on MPC8xx. Still not sure
> > why this is the case. Perhaps an 8xx guru might chime in here. ;)
> >
> > BTW: I just noticed that enabling CONFIG_PIN_TLB seems to resolve this issue.
> > With this option enabled, the dynamic code modification works just fine.
> >
> > Joakim, Scott? Any ideas on this?
>
> hmm, I guess 8xx really maps kernel RO as RO :) Try
> changing in pte-8xx.h:
>  - #define _PAGE_KERNEL_RO   (_PAGE_SHARED)
>  + #define _PAGE_KERNEL_RO   (_PAGE_RW |_PAGE_SHARED)

hmm, I wonder if not this is the problem(in pte-common.h)
#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\
	defined(CONFIG_KPROBES)
#define PAGE_KERNEL_TEXT	PAGE_KERNEL_X
#else
#define PAGE_KERNEL_TEXT	PAGE_KERNEL_ROX
#endif

What is PAGE_KERNEL_TEXT for you?
I think it must be PAGE_KERNEL_X, otherwise kernel text will be readonly.

 Jocke



More information about the Linuxppc-dev mailing list