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


Groups > linux.kernel > #1523029

Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop

From Ard Biesheuvel <ard.biesheuvel@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop
Date 2016-11-15 20:30 +0100
Message-ID <sDRAC-EA-29@gated-at.bofh.it> (permalink)
References <stMiR-Mt-13@gated-at.bofh.it> <sDMUh-65N-23@gated-at.bofh.it> <sDRqW-Br-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 15 November 2016 at 19:18, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 11/15, Ard Biesheuvel wrote:
>> On 19 October 2016 at 00:42, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> > In similar spirit to x86 and arm64 support, add a make_nop_arm()
>> > to replace calls to mcount with a nop in sections that aren't
>> > traced.
>> >
>> > Cc: Russell King <linux@arm.linux.org.uk>
>> > Acked-by: Rabin Vincent <rabin@rab.in>
>> > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
>> > ---
>> >  scripts/recordmcount.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++
>> >  1 file changed, 65 insertions(+)
>> >
>> > diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
>> > index 5423a58d1b06..aeb34223167c 100644
>> > --- a/scripts/recordmcount.c
>> > +++ b/scripts/recordmcount.c
>> > @@ -213,6 +213,59 @@ static int make_nop_x86(void *map, size_t const offset)
>> >         return 0;
>> >  }
>> >
>> > +static unsigned char ideal_nop4_arm_le[4] = { 0x00, 0x00, 0xa0, 0xe1 }; /* mov r0, r0 */
>> > +static unsigned char ideal_nop4_arm_be[4] = { 0xe1, 0xa0, 0x00, 0x00 }; /* mov r0, r0 */
>>
>> Shouldn't you be taking the difference between BE8 and BE32 into
>> account here? IIRC, BE8 uses little endian encoding for instructions.
>
> I admit I haven't tested on a pre-armv6 CPU so I haven't come
> across the case of a BE32 CPU. But from what I can tell that
> doesn't matter.
>
> According to scripts/Makefile.build, cmd_record_mcount only runs
> the recordmcount program if CONFIG_FTRACE_MCOUNT_RECORD=y. That
> config is defined as:
>
>         config FTRACE_MCOUNT_RECORD
>                 def_bool y
>                 depends on DYNAMIC_FTRACE
>                 depends on HAVE_FTRACE_MCOUNT_RECORD
>
>
> And in arch/arm/Kconfig we see that DYNAMIC_FTRACE is selected:
>
>         select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL) && !CPU_ENDIAN_BE32 && MMU
>
> which means that FTRACE_MCOUNT_RECORD can't be set when
> CPU_ENDIAN_BE32 is set.
>
> Do you agree that BE32 is not a concern here?
>

Yes. But that implies then that you should not be using big-endian
instruction encodings at all, and simply use the _le variants for both
LE and BE8

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


Thread

Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-15 15:30 +0100
  Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop Steven Rostedt <rostedt@goodmis.org> - 2016-11-15 16:30 +0100
  Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop Stephen Boyd <sboyd@codeaurora.org> - 2016-11-15 20:20 +0100
    Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-15 20:30 +0100
      Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop Stephen Boyd <sboyd@codeaurora.org> - 2016-11-16 01:00 +0100
        Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-16 12:50 +0100
          Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop Steven Rostedt <rostedt@goodmis.org> - 2016-11-16 15:10 +0100
            Re: [PATCH/RESEND] recordmcount: arm: Implement make_nop Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-11-16 16:30 +0100

csiph-web