mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Kiryl Shutsemau <kas@kernel.org>,
	Usama Arif <usama.arif@linux.dev>,
	bp@alien8.de, dave.hansen@linux.intel.com, dsterba@suse.com,
	hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@redhat.com,
	terrelln@fb.com, tglx@kernel.org, x86@kernel.org,
	hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev,
	kernel-team@meta.com
Subject: Re: [PATCH] x86/lib: Use REP MOVSB for large memcpy() on ERMS CPUs without FSRM
Date: Thu, 22 Oct 2026 09:49:58 +0100	[thread overview]
Message-ID: <20261022094958.13aeb5c0@pumpkin> (raw)
In-Reply-To: <CAHk-=wh+dyDPs2kp=KoUiCYdk2MBBqzTKYbrkAyOMV9Z1XNu0w@mail.gmail.com>

On Wed, 21 Oct 2026 08:18:25 -1000
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Tue, 20 Oct 2026 at 23:55, Kiryl Shutsemau <kas@kernel.org> wrote:
> >
> > Moving MOVQ inside ALTERNATIVE_2 is ugly...  
> 
> Yeah, maybe it would make sense to make that function be
> 
>         movq %rdi, %rax
>         movq %rdx, %rcx
>         ALTERNATIVE "jmp memcpy_orig", "rep movsb", X86_FEATURE_FSRM
>         RET
> 
> instead? No nop instructions at all, and both alternatives are two bytes.
> 
> Then do any ERMS logic at the top of memcpy_orig, which now has the
> registers ready for string instructions anyway.

Is it possibly to just patch "rep movsb; RET" over whatever gets generated
for memcpy_orig (after the two register moves) ?
Then there are neither nops nor a jmp.

David

> 
> Hmm?
> 
>                       Linus
> 


  reply	other threads:[~2026-10-22  8:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 10:04 Usama Arif
2026-10-15 10:39 ` Kiryl Shutsemau
2026-10-17 19:27   ` Usama Arif
2026-10-21  9:54     ` Kiryl Shutsemau
2026-10-21 18:18       ` Linus Torvalds
2026-10-22  8:49         ` David Laight [this message]
2026-10-17 21:42 ` David Laight

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=20261022094958.13aeb5c0@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.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=usama.arif@linux.dev \
    --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®