[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a0ejxNueA7dDBV103yY2j7QiLfzG96pc163miD3hKE6qA@mail.gmail.com>
Date: Wed, 8 Jan 2020 15:22:33 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will@...nel.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Masami Hiramatsu <mhiramat@...nel.org>, bristot@...hat.com,
Jason Baron <jbaron@...mai.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, namit@...are.com,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Jessica Yu <jeyu@...nel.org>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Mark Rutland <mark.rutland@....com>,
James Morse <james.morse@....com>,
Russell King <rmk+kernel@...linux.org.uk>,
Rabin Vincent <rabin@....in>, Nicolas Pitre <nico@...xnic.net>
Subject: Re: [PATCH -v5mkII 13/17] arm/ftrace: Use __patch_text()
On Wed, Jan 8, 2020 at 3:16 PM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Wed, 8 Jan 2020 13:22:52 +0100
> Arnd Bergmann <arnd@...db.de> wrote:
>
> > The problem is that we don't have a BE32 definition of
> > __opcode_to_mem_thumb32, mostly because no hardware
> > supports that.
> >
> > One possible workaround is a big ugly:
> >
> > diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c
> > index d0a05a3bdb96..1067fd122897 100644
> > --- a/arch/arm/kernel/patch.c
> > +++ b/arch/arm/kernel/patch.c
> > @@ -90,9 +90,11 @@ void __kprobes __patch_text_real(void *addr,
> > unsigned int insn, bool remap)
> >
> > size = sizeof(u32);
> > } else {
> > +#ifdef CONFIG_THUMB2_KERNEL
> > if (thumb2)
>
> If we change the above to:
>
> if (IS_ENABLED(CONFIG_THUMB2_KERNEL) && thumb2)
>
> Would the compiler optmize out __opcode_to_mem_thumb32(). We would need
> to add a declaration for it, but wont need to define it. At least we
> wont have nasty #ifdef logic in the code.
If we add a declaration for it, I think no change to patch.c is needed,
as 'thumb2' already has compile-time constant value equal to
IS_ENABLED(CONFIG_THUMB2_KERNEL).
I'll try it out.
Arnd
Powered by blists - more mailing lists