[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKv+Gu-Uoj6sboXOhwme5dgQpmJ=cECu==5Pn0HNHTw2VxNz5g@mail.gmail.com>
Date: Fri, 18 Aug 2017 14:44:15 +0100
From: Ard Biesheuvel <ard.biesheuvel@...aro.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"H. Peter Anvin" <hpa@...or.com>, Arnd Bergmann <arnd@...db.de>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Kees Cook <keescook@...omium.org>,
Will Deacon <will.deacon@....com>,
Michael Ellerman <mpe@...erman.id.au>,
Thomas Garnier <thgarnie@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Serge E. Hallyn" <serge@...lyn.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Catalin Marinas <catalin.marinas@....com>,
Petr Mladek <pmladek@...e.com>, Ingo Molnar <mingo@...hat.com>,
James Morris <james.l.morris@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Joe Perches <joe@...ches.com>, Nicolas Pitre <nico@...aro.org>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Whitcroft <apw@...onical.com>,
Jessica Yu <jeyu@...nel.org>
Subject: Re: [PATCH v2 6/6] kernel: tracepoints: add support for relative references
On 18 August 2017 at 14:43, Steven Rostedt <rostedt@...dmis.org> wrote:
> On Fri, 18 Aug 2017 12:44:17 +0100
> Ard Biesheuvel <ard.biesheuvel@...aro.org> wrote:
>
>> On 18 August 2017 at 12:26, Ard Biesheuvel <ard.biesheuvel@...aro.org> wrote:
>> > To avoid the need for relocating absolute references to tracepoint
>> > structures at boot time when running relocatable kernels (which may
>> > take a disproportionate amount of space), add the option to emit
>> > these tables as relative references instead.
>> >
>> > Cc: Steven Rostedt <rostedt@...dmis.org>
>> > Cc: Ingo Molnar <mingo@...hat.com>
>> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>
>> > ---
>> > include/linux/tracepoint.h | 42 ++++++++++++++++++--
>> > kernel/tracepoint.c | 7 +---
>> > 2 files changed, 40 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
>> > index a26ffbe09e71..68701821933a 100644
>> > --- a/include/linux/tracepoint.h
>> > +++ b/include/linux/tracepoint.h
>> > @@ -228,6 +228,42 @@ extern void syscall_unregfunc(void);
>> > return static_key_false(&__tracepoint_##name.key); \
>> > }
>> >
>> > +#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
>> > +#define __TRACEPOINT_ENTRY(name) \
>> > + asm(" .section \"__tracepoints_ptrs\", \"a\"\n" \
>> > + " .balign 4\n" \
>> > + " .long " VMLINUX_SYMBOL_STR(__tracepoint_##name) " - .\n"\
>> > + " .previous\n")
>> > +
>> > +struct tracepoint_entry_t {
>> > + int tp_offset;
>> > +};
>> > +
>> > +static inline
>> > +struct tracepoint *tracepoint_from_entry(const struct tracepoint_entry_t *ent)
>> > +{
>> > + return (struct tracepoint *)((unsigned long)ent + ent->tp_offset);
>> > +}
>> > +#else
>> > +#define __TRACEPOINT_ENTRY(name) \
>> > + static struct tracepoint * const __tracepoint_ptr_##name __used \
>> > + __attribute__((section("__tracepoints_ptrs"))) = \
>> > + &__tracepoint_##name
>> > +
>> > +struct tracepoint_entry_t {
>> > + struct tracepoint *tp;
>> > +};
>> > +
>> > +static inline
>> > +struct tracepoint *tracepoint_from_entry(const struct tracepoint_entry_t *ent)
>> > +{
>> > + return ent->tp;
>> > +}
>> > +#endif
>> > +
>> > +extern struct tracepoint_entry_t const __start___tracepoints_ptrs[];
>> > +extern struct tracepoint_entry_t const __stop___tracepoints_ptrs[];
>> > +
>>
>> It appears the stuff above needs to be move inside the double-include
>> guard (which oddly enough does not cover the entire file)
>
> Why was this moved to the header file? To fulfill some checkpatch
> warning?
>
Yes.
Powered by blists - more mailing lists