From: Peter Zijlstra <peterz@infradead.org>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH RFC 4/5] x86/alternative: Improve code generation readability
Date: Wed, 9 Apr 2025 16:38:21 +0200 [thread overview]
Message-ID: <20250409143821.GE9833@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <35ae5c17e8cc88506b5ae8f3b06d9491f7ef319c.1744098446.git.jpoimboe@kernel.org>
On Tue, Apr 08, 2025 at 01:21:17AM -0700, Josh Poimboeuf wrote:
> Improve the readability and compactness of alternatives code.
>
> ---------------------
> ALTERNATIVE() before:
> ---------------------
>
> # ALT: oldinstr
> 771:
> rep movsb
> 772:
> # ALT: padding
> .skip -(((775f-774f)-(772b-771b)) > 0) * ((775f-774f)-(772b-771b)),0x90
> 773:
> .pushsection .altinstructions,"a"
> .long 771b - .
> .long 774f - .
> .4byte (((1 << 0) << 16) | ((18*32+ 4)))
> .byte 773b-771b
> .byte 775f-774f
> .popsection
> .pushsection .altinstr_replacement, "ax"
> # ALT: replacement
> 774:
> call rep_movs_alternative
> 775:
> .popsection
>
> --------------------
> ALTERNATIVE() after:
> --------------------
>
> # <ALTERNATIVE>
> 771: rep movsb
> 772: .skip -(((775f-774f)-(772b-771b)) > 0) * ((775f-774f)-(772b-771b)),0x90
> 773:
> # ALT ENTRY:
> .pushsection .altinstructions,"a"; .long 771b - .; .long 774f - .; .4byte (((1 << 0) << 16) | ((18*32+ 4))); .byte 773b-771b; .byte 775f-774f; .popsection
I find this very hard to read. I prefer the multi line form it had
before.
Other than that, I like the new layout.
> # ALT REPLACEMENT:
> .pushsection .altinstr_replacement, "ax"
> 774: call rep_movs_alternative
> 775:
> .popsection
> # </ALTERNATIVE>
next prev parent reply other threads:[~2025-04-09 14:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 8:21 [PATCH RFC 0/5] x86/asm: Improve code generation Josh Poimboeuf
2025-04-08 8:21 ` [PATCH RFC 1/5] objtool: Remove ANNOTATE_IGNORE_ALTERNATIVE from CLAC/STAC Josh Poimboeuf
2025-04-08 18:07 ` Linus Torvalds
2025-04-08 20:45 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-08 8:21 ` [PATCH RFC 2/5] objtool, x86/hweight: Remove ANNOTATE_IGNORE_ALTERNATIVE Josh Poimboeuf
2025-04-08 8:21 ` [PATCH RFC 3/5] noinstr: Use asm_inline() in instrumentation_{begin,end}() Josh Poimboeuf
2025-04-08 8:30 ` Ingo Molnar
2025-04-08 11:10 ` Uros Bizjak
2025-04-08 16:46 ` Josh Poimboeuf
2025-04-08 8:21 ` [PATCH RFC 4/5] x86/alternative: Improve code generation readability Josh Poimboeuf
2025-04-09 14:38 ` Peter Zijlstra [this message]
2025-04-09 17:41 ` Josh Poimboeuf
2025-04-09 18:02 ` Linus Torvalds
2025-04-09 19:51 ` Josh Poimboeuf
2025-04-09 21:20 ` Linus Torvalds
2025-04-09 21:27 ` Josh Poimboeuf
2025-04-09 21:55 ` Josh Poimboeuf
2025-04-16 23:30 ` Josh Poimboeuf
2025-04-08 8:21 ` [PATCH RFC 5/5] objtool: " Josh Poimboeuf
2025-04-09 14:40 ` Peter Zijlstra
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=20250409143821.GE9833@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=torvalds@linux-foundation.org \
--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®