From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: 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>,
"npiggin@gmail.com" <npiggin@gmail.com>,
"ardb@kernel.org" <ardb@kernel.org>,
"jbaron@akamai.com" <jbaron@akamai.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"jpoimboe@kernel.org" <jpoimboe@kernel.org>
Subject: Re: [PATCH v3 1/6] powerpc/code-patching: Implement generic text patching function
Date: Thu, 6 Oct 2022 09:19:23 +0000 [thread overview]
Message-ID: <b28d8d04-8658-c4be-88e9-80f635debfd7@csgroup.eu> (raw)
In-Reply-To: <6642c9085a1b98a4aa8a03383b71d070881afe45.camel@linux.ibm.com>
Le 06/10/2022 à 05:36, Benjamin Gray a écrit :
> On Wed, 2022-10-05 at 17:55 +0000, Christophe Leroy wrote:
>> I'm on business trip this week so I can't test it on hardware, but
>> the
>> generated code looks horrid and sub-optimal, with a stack frame and
>> so
>> many registers saved into it. That's mpc885_ads_defconfig built with
>> GCC
>> 12, without modules without stackprotector with 4k pages.
>
> Yeah, that definitely wasn't supposed to happen. I was looking at the
> 32 and 64 bit machine code closely while actively writing it, but I
> must have refactored it badly when cleaning up for submission. It was
> supposed to automatically be inlined, leaving it identical to the
> original on 32-bit.
>
> Given inlining is desirable here, and 64-bit inlines anyway, I think I
> should just mark __patch_memory with __always_inline.
FWIW, I get a far better result with :
diff --git a/arch/powerpc/lib/code-patching.c
b/arch/powerpc/lib/code-patching.c
index ba00c550d9d2..447b8de6e427 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -21,7 +21,7 @@ static int __patch_memory(void *patch_addr, unsigned
long val, void *exec_addr,
/* Prefixed instruction may cross cacheline if cacheline smaller than
64 bytes */
BUILD_BUG_ON(IS_ENABLED(CONFIG_PPC64) && L1_CACHE_BYTES < 64);
- if (unlikely(is_dword))
+ if (IS_ENABLED(CONFIG_PPC64) && unlikely(is_dword))
__put_kernel_nofault(patch_addr, &val, u64, failed);
else
__put_kernel_nofault(patch_addr, &val, u32, failed);
next prev parent reply other threads:[~2022-10-06 9:20 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 [this message]
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
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=b28d8d04-8658-c4be-88e9-80f635debfd7@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=ajd@linux.ibm.com \
--cc=ardb@kernel.org \
--cc=bgray@linux.ibm.com \
--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).