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


Groups > linux.kernel > #1343178

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

From Torsten Duwe <duwe@lst.de>
Newsgroups linux.kernel
Subject Re: [PATCH 04/12] powerpc/ftrace: Prepare for -mprofile-kernel
Date 2016-02-25 15:00 +0100
Message-ID <r64Cw-4Cd-25@gated-at.bofh.it> (permalink)
References <r5IBX-5Pl-7@gated-at.bofh.it> <r5IBX-5Pl-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Feb 25, 2016 at 01:28:27AM +1100, Michael Ellerman wrote:
> @@ -450,17 +448,44 @@ static unsigned long stub_for_addr(const Elf64_Shdr *sechdrs,
>  	return (unsigned long)&stubs[i];
>  }
>  
> +#ifdef CC_USING_MPROFILE_KERNEL
> +static int is_early_mcount_callsite(u32 *instruction)
> +{
> +	/* -mprofile-kernel sequence starting with
> +	 * mflr r0 and maybe std r0, LRSAVE(r1).
> +	 */
> +	if ((instruction[-3] == PPC_INST_MFLR &&
> +	     instruction[-2] == PPC_INST_STD_LR) ||
> +	    instruction[-2] == PPC_INST_MFLR) {
> +		/* Nothing to be done here, it's an _mcount
> +		 * call location and r2 will have to be
> +		 * restored in the _mcount function.
> +		 */
> +		return 1;
> +	}
> +	return 0;
> +}
> +#else

*You* said this might page fault :)

Did we agree yet whether we insist on a streamlined compiler?
(GCC commit e95d0248dace required)?

If not:
if (instruction[-2] == PPC_INST_STD_LR)
  {
    if (instruction[-3] == PPC_INST_MFLR)
      return 1;
  }
else if (instruction[-2] == PPC_INST_MFLR)
    return 1;
return 0;

leaves less freedom for the compiler to "optimise".

Signed-off-by: Torsten Duwe <duwe@suse.de>

	Torsten

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