From: Michael Ellerman <mpe@ellerman.id.au>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
Benjamin Gray <bgray@linux.ibm.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Cc: "ajd@linux.ibm.com" <ajd@linux.ibm.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"jpoimboe@kernel.org" <jpoimboe@kernel.org>,
"jbaron@akamai.com" <jbaron@akamai.com>,
"npiggin@gmail.com" <npiggin@gmail.com>,
"ardb@kernel.org" <ardb@kernel.org>
Subject: Re: [PATCH v3 5/6] powerpc/64: Add support for out-of-line static calls
Date: Thu, 06 Oct 2022 11:39:50 +1100 [thread overview]
Message-ID: <878rltpyy1.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <b76d122b-5487-b677-11e1-58e53a6b521f@csgroup.eu>
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 05/10/2022 à 07:32, Benjamin Gray a écrit :
>> Implement static call support for 64 bit V2 ABI. This requires making
>> sure the TOC is kept correct across kernel-module boundaries. As a
>> secondary concern, it tries to use the local entry point of a target
>> wherever possible. It does so by checking if both tramp & target are
>> kernel code, and falls back to detecting the common global entry point
>> patterns if modules are involved. Detecting the global entry point is
>> also required for setting the local entry point as the trampoline
>> target: if we cannot detect the local entry point, then we need to
>> convservatively initialise r12 and use the global entry point.
>>
>> The trampolines are marked with `.localentry NAME, 1` to make the
>> linker save and restore the TOC on each call to the trampoline. This
>> allows the trampoline to safely target functions with different TOC
>> values.
>>
>> However this directive also implies the TOC is not initialised on entry
>> to the trampoline. The kernel TOC is easily found in the PACA, but not
>> an arbitrary module TOC. Therefore the trampoline implementation depends
>> on whether it's in the kernel or not. If in the kernel, we initialise
>> the TOC using the PACA. If in a module, we have to initialise the TOC
>> with zero context, so it's quite expensive.
>>
>> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
>
> This looks good to me
>
> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> However, thinking out loudly, I'm wondering, could we make things any
> simpler when CONFIG_MODULES is not selected, or is that a too much
> corner case on PPC64 ?
I'd say it's mostly a corner case.
Obviously no distros ship with modules disabled.
AFAIK even the stripped down kernels we use in CPU bringup have modules
enabled.
So I think it's probably not worth worrying about, unless there's an
obvious and fairly simple optimisation.
cheers
next prev parent reply other threads:[~2022-10-06 0:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-05 5:32 [PATCH v3 0/6] Out-of-line static calls for powerpc64 ELF V2 Benjamin Gray
2022-10-05 5:32 ` [PATCH v3 1/6] powerpc/code-patching: Implement generic text patching function Benjamin Gray
2022-10-05 17:55 ` Christophe Leroy
2022-10-06 3:36 ` Benjamin Gray
2022-10-06 9:19 ` Christophe Leroy
2022-10-06 21:53 ` Benjamin Gray
2022-10-05 5:32 ` [PATCH v3 2/6] powerpc/module: Handle caller-saved TOC in module linker Benjamin Gray
2022-10-05 19:18 ` Christophe Leroy
2022-10-06 3:51 ` Andrew Donnellan
2022-10-06 4:39 ` Benjamin Gray
2022-10-05 5:32 ` [PATCH v3 3/6] powerpc/module: Optimise nearby branches in ELF V2 ABI stub Benjamin Gray
2022-10-05 19:21 ` Christophe Leroy
2022-10-06 8:24 ` Andrew Donnellan
2022-10-05 5:32 ` [PATCH v3 4/6] static_call: Move static call selftest to static_call_selftest.c Benjamin Gray
2022-10-05 19:22 ` Christophe Leroy
2022-10-05 5:32 ` [PATCH v3 5/6] powerpc/64: Add support for out-of-line static calls Benjamin Gray
2022-10-05 19:38 ` Christophe Leroy
2022-10-06 0:39 ` Michael Ellerman [this message]
2022-10-06 5:01 ` Benjamin Gray
2022-10-06 18:22 ` Segher Boessenkool
2022-10-06 18:38 ` Christophe Leroy
2022-10-06 20:45 ` Segher Boessenkool
2022-10-06 20:50 ` Christophe Leroy
2022-10-06 21:04 ` Segher Boessenkool
2022-10-05 5:32 ` [PATCH v3 6/6] powerpc: Add tests " Benjamin Gray
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=878rltpyy1.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=ajd@linux.ibm.com \
--cc=ardb@kernel.org \
--cc=bgray@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=jbaron@akamai.com \
--cc=jpoimboe@kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).