The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Miroslav Cimerman <mc@raidlab.org>
Cc: Song Liu <song@kernel.org>, Yu Kuai <yukuai@fygo.io>,
	Andrew Morton <akpm@linux-foundation.org>,
	Li Nan <magiclinan@didiglobal.com>, Xiao Ni <xiao@kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	David Laight <david.laight.linux@gmail.com>,
	Markus Stockhausen <markus.stockhausen@collogia.de>,
	linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] raid6: x86: asm constraints, sfence and prefetch in xor_syndrome
Date: Sun, 22 Nov 2026 12:08:25 -0800	[thread overview]
Message-ID: <20261122200825.GC2122@sol> (raw)
In-Reply-To: <20261122032933.2306875-1-mc@raidlab.org>

On Sun, Nov 22, 2026 at 03:29:30AM +0000, Miroslav Cimerman wrote:
> This follows up on the review of "raid6: use normal stores in the x86 x4
> xor_syndrome functions" [1]. With that patch, none of the x86
> xor_syndrome() functions uses non-temporal stores, so their sfence
> orders nothing. Christoph suggested removing it [2]. Eric pointed out
> that the AVX-512 functions list P and Q as asm inputs only and rely on
> the "memory" clobber of that sfence, and suggested prefetcht0 for Q [3].
> 1/3 fixes the constraints, 2/3 removes the sfence, and 3/3 changes the
> prefetch of Q.
> 
> Based on mm-nonmm-unstable with [1] applied.
> 
> Testing:
> - Builds without warnings with W=1, gcc 15.2 and clang 21.1.
> - With 1/3, clang generates the same code as before. gcc reloads the
>   data pointers inside the loop of the AVX-512 functions (up to two
>   more instructions per function). With 2/3, the sfence instructions
>   are gone, and apart from alignment padding the code is the same.
>   3/3 only changes the six prefetch instructions.
> - The raid6 KUnit test passes in QEMU with -cpu max under KVM on a
>   Haswell host (avx2x1..x4) and with -cpu Westmere (sse2x1..x4). All
>   8 test cases pass in each run.
> - In userspace, gen_syndrome() and xor_syndrome() of all nine sse2,
>   avx2 and avx512 variants match a scalar reference (gen_syndrome for
>   2-24 data disks, xor_syndrome for every start/stop): sse2 natively on
>   a Core i5-2520M, avx2 natively on a Xeon E5-2699 v3, all variants
>   natively on a Xeon Gold 6130, and avx512 also with Intel SDE (-skx).
>   The AVX-512 functions were not run in a kernel. I have no AVX-512
>   machine with root access.
> 
> The patches and the tests were prepared with the help of an LLM. I
> reviewed everything.
> 
> [1] https://lore.kernel.org/linux-raid/20261109030805.25709-1-mc@raidlab.org/
> [2] https://lore.kernel.org/linux-raid/avqegZd_W0kce0UA@infradead.org/
> [3] https://lore.kernel.org/linux-raid/20261116210440.GE229817@google.com/
> 
> Miroslav Cimerman (3):
>   raid6: declare the AVX-512 P/Q stores as asm outputs
>   raid6: remove the sfence from the x86 xor_syndrome functions
>   raid6: prefetch Q with prefetcht0 in the x86 x4 xor_syndrome functions
> 
>  lib/raid/raid6/x86/avx2.c   |  7 ++-----
>  lib/raid/raid6/x86/avx512.c | 37 ++++++++++++++-----------------------
>  lib/raid/raid6/x86/sse2.c   |  7 ++-----
>  3 files changed, 18 insertions(+), 33 deletions(-)

Reviewed-by: Eric Biggers <ebiggers@kernel.org>

- Eric

      parent reply	other threads:[~2026-11-22 20:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  3:29 [PATCH 0/3] raid6: x86: asm constraints, sfence and prefetch in xor_syndrome Miroslav Cimerman
2026-11-22  3:29 ` [PATCH 1/3] raid6: declare the AVX-512 P/Q stores as asm outputs Miroslav Cimerman
2026-11-22  3:29 ` [PATCH 2/3] raid6: remove the sfence from the x86 xor_syndrome functions Miroslav Cimerman
2026-11-22  3:29 ` [PATCH 3/3] raid6: prefetch Q with prefetcht0 in the x86 x4 " Miroslav Cimerman
2026-11-22 20:08 ` Eric Biggers [this message]

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=20261122200825.GC2122@sol \
    --to=ebiggers@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david.laight.linux@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=magiclinan@didiglobal.com \
    --cc=markus.stockhausen@collogia.de \
    --cc=mc@raidlab.org \
    --cc=song@kernel.org \
    --cc=xiao@kernel.org \
    --cc=yukuai@fygo.io \
    /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