Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1343094

Re: [PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel

From Michael Ellerman <mpe@ellerman.id.au>
Newsgroups linux.kernel
Subject Re: [PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel
Date 2016-02-25 11:40 +0100
Message-ID <r61uW-2sM-17@gated-at.bofh.it> (permalink)
References <r5IBX-5Pl-7@gated-at.bofh.it> <r5IBX-5Pl-5@gated-at.bofh.it> <r5RYC-44j-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2016-02-25 at 11:28 +1100, Balbir Singh wrote:
> On 25/02/16 01:28, Michael Ellerman wrote:
> > @@ -300,8 +298,34 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
> >  	 * The load offset is different depending on the ABI. For simplicity
> >  	 * just mask it out when doing the compare.
> >  	 */
> > -	if ((op[0] != 0x48000008) || ((op[1] & 0xffff0000) != 0xe8410000)) {
> > -		pr_err("Unexpected call sequence: %x %x\n", op[0], op[1]);
> > +	if ((op0 != 0x48000008) || ((op1 & 0xffff0000) != 0xe8410000))
> > +		return 0;
> > +	return 1;
> > +}
> > +#else
> > +static int
> > +expected_nop_sequence(void *ip, unsigned int op0, unsigned int op1)
> > +{
> > +	/* look for patched "NOP" on ppc64 with -mprofile-kernel */
> > +	if (op0 != PPC_INST_NOP)
> > +		return 0;
> > +	return 1;

> With the magic changes, do we care for this? I think it's a bit of an overkill

I don't particularly like it either. However this code doesn't actually use the
magic, it's the reverse case of turning a nop into a call to the stub. So the
magic in the stub doesn't actually make that any safer.

I think we do at least want to check there's a nop there. But without
mprofile-kernel it's not a nop, so we need some check and it does need to be
different between the profiling ABIs. So I think for now this is the
conservative approach.

cheers

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel Michael Ellerman <mpe@ellerman.id.au> - 2016-02-24 15:30 +0100
  Re: [PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel Balbir Singh <bsingharora@gmail.com> - 2016-02-25 01:30 +0100
    Re: [PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel Michael Ellerman <mpe@ellerman.id.au> - 2016-02-25 11:40 +0100
  Re: [PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel Torsten Duwe <duwe@lst.de> - 2016-02-25 15:00 +0100
    Re: [PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel Michael Ellerman <mpe@ellerman.id.au> - 2016-02-26 11:20 +0100

csiph-web