From: Catalin Marinas <catalin.marinas@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-mips <linux-mips@linux-mips.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Will Deacon <will.deacon@arm.com>,
Paul Mackerras <paulus@samba.org>,
"H. Peter Anvin" <hpa@zytor.com>,
sparclinux@vger.kernel.org,
linux-s390 <linux-s390@vger.kernel.org>,
Nicolas Pitre <nico@linaro.org>,
Michael Ellerman <mpe@ellerman.id.au>,
the arch/x86 maintainers <x86@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Ingo Molnar <mingo@redhat.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
Petr Mladek <pmladek@suse.com>, Kees Cook <keescook@chromium.org>,
Arnd Bergmann <arnd@arndb.de>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Steven Rostedt <rostedt@goodmis.org>,
James Morris <james.l.morris@oracle.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-arm-kernel@lists.infradead.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ralf Baechle <ralf@linux-mips.org>,
"David S. Miller" <davem@davemloft.net>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Jessica Yu <jeyu@kernel.org>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Thomas Garnier <thgarnie@google.com>
Subject: Re: [PATCH v7 07/10] kernel/jump_label: abstract jump_entry member accessors
Date: Fri, 5 Jan 2018 18:22:29 +0000 [thread overview]
Message-ID: <20180105182229.pjnlq3l5hzfac4na@armageddon.cambridge.arm.com> (raw)
In-Reply-To: <CAKv+Gu8zROE-TDpfbbVi3RPOr8BNcsN_s27Gr-VvMN+-eMU+Hg@mail.gmail.com>
On Fri, Jan 05, 2018 at 06:01:33PM +0000, Ard Biesheuvel wrote:
> On 5 January 2018 at 17:58, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > On Tue, Jan 02, 2018 at 08:05:46PM +0000, Ard Biesheuvel wrote:
> >> diff --git a/arch/arm/include/asm/jump_label.h b/arch/arm/include/asm/jump_label.h
> >> index e12d7d096fc0..7b05b404063a 100644
> >> --- a/arch/arm/include/asm/jump_label.h
> >> +++ b/arch/arm/include/asm/jump_label.h
> >> @@ -45,5 +45,32 @@ struct jump_entry {
> >> jump_label_t key;
> >> };
> >>
> >> +static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
> >> +{
> >> + return entry->code;
> >> +}
> >> +
> >> +static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
> >> +{
> >> + return (struct static_key *)((unsigned long)entry->key & ~1UL);
> >> +}
> >> +
> >> +static inline bool jump_entry_is_branch(const struct jump_entry *entry)
> >> +{
> >> + return (unsigned long)entry->key & 1UL;
> >> +}
> >> +
> >> +static inline bool jump_entry_is_module_init(const struct jump_entry *entry)
> >> +{
> >> + return entry->code == 0;
> >> +}
> >> +
> >> +static inline void jump_entry_set_module_init(struct jump_entry *entry)
> >> +{
> >> + entry->code = 0;
> >> +}
> >> +
> >> +#define jump_label_swap NULL
> >
> > Is there any difference between these functions on any of the
> > architectures touched? Even with the relative offset, arm64 and x86
> > looked the same to me (well, I may have missed some detail).
>
> No, the latter two are identical everywhere, and the others are the
> same modulo absolute vs relative.
>
> The issue is that the struct definition is per-arch so the accessors
> should be as well.
Up to this patch, even the jump_entry structure is the same on all
architectures (the jump_label_t type differs).
With relative offset, can you not just define jump_label_t to s32? At a
quick grep in mainline, it doesn't seem to be used outside the structure
definition.
> Perhaps I should introduce two variants two asm-generic, similar to
> how we have different flavors of unaligned accessors.
You could as well define them directly in kernel/jump_label.h or, if
used outside this file, include/linux/jump_label.h.
--
Catalin
next prev parent reply other threads:[~2018-01-05 18:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-02 20:05 [PATCH v7 00/10] add support for relative references in special sections Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 01/10] arch: enable relative relocations for arm64, power and x86 Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 02/10] module: allow symbol exports to be disabled Ard Biesheuvel
2018-01-02 23:47 ` Nicolas Pitre
2018-01-02 23:55 ` Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 03/10] module: use relative references for __ksymtab entries Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 04/10] init: allow initcall tables to be emitted using relative references Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 05/10] PCI: Add support for relative addressing in quirk tables Ard Biesheuvel
2018-01-05 17:41 ` Catalin Marinas
2018-01-05 17:45 ` Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 06/10] kernel: tracepoints: add support for relative references Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 07/10] kernel/jump_label: abstract jump_entry member accessors Ard Biesheuvel
2018-01-05 17:58 ` Catalin Marinas
2018-01-05 18:01 ` Ard Biesheuvel
2018-01-05 18:22 ` Catalin Marinas [this message]
2018-01-05 18:29 ` Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 08/10] arm64/kernel: jump_label: use relative references Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 09/10] x86: jump_label: switch to jump_entry accessors Ard Biesheuvel
2018-01-02 20:05 ` [PATCH v7 10/10] x86/kernel: jump_table: use relative references Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180105182229.pjnlq3l5hzfac4na@armageddon.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=hpa@zytor.com \
--cc=james.l.morris@oracle.com \
--cc=jeyu@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=nico@linaro.org \
--cc=paulus@samba.org \
--cc=pmladek@suse.com \
--cc=ralf@linux-mips.org \
--cc=rostedt@goodmis.org \
--cc=schwidefsky@de.ibm.com \
--cc=serge@hallyn.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=sparclinux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=thgarnie@google.com \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®