From: Usama Arif <usama.arif@linux.dev>
To: Borislav Petkov <bp@alien8.de>
Cc: Usama Arif <usama.arif@linux.dev>,
Linus Torvalds <torvalds@linux-foundation.org>,
"H. Peter Anvin" <hpa@zytor.com>,
david.laight.linux@gmail.com, dave.hansen@linux.intel.com,
dsterba@suse.com, linux-kernel@vger.kernel.org, mingo@redhat.com,
terrelln@fb.com, tglx@kernel.org, x86@kernel.org, kas@kernel.org,
hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev,
kernel-team@meta.com
Subject: Re: [PATCH v2] x86/lib: Use REP MOVSB for large memcpy() on ERMS CPUs without FSRM
Date: Wed, 11 Nov 2026 05:24:27 -0800 [thread overview]
Message-ID: <20261111132428.3050403-1-usama.arif@linux.dev> (raw)
In-Reply-To: <09B273E6-9146-4489-BC46-E7455CD8CA16@alien8.de>
On Wed, 11 Nov 2026 01:16:37 +0000 Borislav Petkov <bp@alien8.de> wrote:
> On November 10, 2026 8:59:02 PM UTC, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> >On Tue, 10 Nov 2026 at 12:18, H. Peter Anvin <hpa@zytor.com> wrote:
> >>
> >> On November 10, 2026 9:53:07 AM PST, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> >> >Let's not do that.
> >> >
> >> >Putting magic things like RET in alternatives is just a bad bad idea.
> >> >
> >> > Linus
> >>
> >> Why is that, *given that it is in assembly*?
> >
> >It's assembly, but it's assembly that potentially gets rewritten.
> >objtool already knows about __x86_return_thunk being special (although
> >I think it's the _target_, not the call site, it cares about).
> >
> >I would like to not have magic in stuff that is in the alternatives
> >section. We've had issues with relocations etc before.
> >
> >That said, grepping a bit for this, it turns out we already seem to be
> >doing that in memmove_64.S, although it was hidden from my first grep:
> >
> > #define CHECK_LEN cmp $0x20, %rdx; jb 1f
> > #define MEMMOVE_BYTES movq %rdx, %rcx; rep movsb; RET
> > .Lmemmove_begin_forward:
> > ALTERNATIVE_2 __stringify(CHECK_LEN), \
> > __stringify(CHECK_LEN; MEMMOVE_BYTES), X86_FEATURE_ERMS, \
> > __stringify(MEMMOVE_BYTES), X86_FEATURE_FSRM
> >
> >which is pretty disgusting. But I guess that train has passed..
> >
> > Linus
>
> Yah, I never liked this piece of gunk. Lemme give it a fresh look when things relax a bit...
I have sent v3 that doesnt put RET in an alternative [1]
[1] https://lore.kernel.org/all/20261111132214.2979125-3-usama.arif@linux.dev/#t
next prev parent reply other threads:[~2026-11-11 13:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 22:28 Usama Arif
2026-11-05 8:12 ` David Laight
2026-11-05 17:28 ` Usama Arif
2026-11-10 16:25 ` Kiryl Shutsemau
2026-11-10 17:06 ` David Laight
2026-11-11 13:02 ` Usama Arif
2026-11-11 12:58 ` Usama Arif
2026-11-10 17:53 ` Linus Torvalds
2026-11-10 19:33 ` David Laight
2026-11-10 20:17 ` H. Peter Anvin
2026-11-10 20:59 ` Linus Torvalds
2026-11-10 22:35 ` David Laight
2026-11-11 1:16 ` Borislav Petkov
2026-11-11 13:24 ` Usama Arif [this message]
2026-11-10 21:00 ` David Laight
2026-11-11 0:24 ` H. Peter Anvin
2026-11-11 13:04 ` Usama Arif
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=20261111132428.3050403-1-usama.arif@linux.dev \
--to=usama.arif@linux.dev \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david.laight.linux@gmail.com \
--cc=dsterba@suse.com \
--cc=hannes@cmpxchg.org \
--cc=hpa@zytor.com \
--cc=kas@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=riel@surriel.com \
--cc=shakeel.butt@linux.dev \
--cc=terrelln@fb.com \
--cc=tglx@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®