From: sashiko-bot@kernel.org
To: "Eric Biggers" <ebiggers@kernel.org>
Cc: linux-raid@vger.kernel.org, yukuai@fygo.io
Subject: Re: [PATCH RESEND] xor: add missing vzeroupper to AVX code
Date: Mon, 31 Aug 2026 22:06:58 +0000 [thread overview]
Message-ID: <20260831220658.ADAE91F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260831212248.213805-1-ebiggers@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Incomplete fix: Missing `vzeroupper` in parallel AVX2/AVX-512 RAID6 and crypto implementations causes severe AVX-to-SSE transition penalties.
--
commit 0dc8e5aa3bec5867a6cc446b05765378e42b49c6
Author: Eric Biggers <ebiggers@kernel.org>
xor: add missing vzeroupper to AVX code
This commit adds a missing vzeroupper instruction to the AVX optimized XOR
code. This clears the upper bits of the YMM registers before returning,
preventing severe performance degradation when later SSE code is executed.
> diff --git a/lib/raid/xor/x86/xor-avx.c b/lib/raid/xor/x86/xor-avx.c
> index f7777d7aa269b..95b21e7225e8d 100644
> --- a/lib/raid/xor/x86/xor-avx.c
> +++ b/lib/raid/xor/x86/xor-avx.c
> @@ -147,6 +147,7 @@ static void xor_gen_avx(void *dest, void **srcs, unsigned int src_cnt,
> {
> kernel_fpu_begin();
> xor_gen_avx_inner(dest, srcs, src_cnt, bytes);
> + asm volatile("vzeroupper");
> kernel_fpu_end();
[Severity: High]
This is a pre-existing issue, but this fix appears incomplete. While this
solves the missing vzeroupper in xor_gen_avx(), are there other parallel
AVX2/AVX-512 RAID6 and crypto implementations that suffer from this same
AVX-to-SSE transition penalty?
For instance, raid6_avx21_gen_syndrome() in lib/raid/raid6/x86/avx2.c and
raid6_avx5121_gen_syndrome() in lib/raid/raid6/x86/avx512.c both heavily use
YMM/ZMM registers but call kernel_fpu_end() without clearing the upper
halves:
lib/raid/raid6/x86/avx2.c:raid6_avx21_gen_syndrome() {
...
asm volatile("sfence" : : : "memory");
kernel_fpu_end();
}
Similarly, raid6_2data_recov_avx2() in lib/raid/raid6/x86/recov_avx2.c
returns without executing vzeroupper:
lib/raid/raid6/x86/recov_avx2.c:raid6_2data_recov_avx2() {
...
kernel_fpu_end();
}
Also outside the RAID subsystem, routines like __aria_aesni_avx2_crypt_32way()
in arch/x86/crypto/aria-aesni-avx2-asm_64.S seem to have the exact same
omission:
arch/x86/crypto/aria-aesni-avx2-asm_64.S:__aria_aesni_avx2_crypt_32way() {
...
FRAME_END
RET;
}
Could these functions also leave the CPU in a dirty AVX state and cause
severe performance regressions for subsequent legacy SSE instructions?
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831212248.213805-1-ebiggers@kernel.org?part=1
next prev parent reply other threads:[~2026-08-31 22:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 21:22 [PATCH RESEND] xor: add missing vzeroupper to AVX code Eric Biggers
2026-08-31 22:06 ` sashiko-bot [this message]
2026-08-31 22:09 ` Eric Biggers
2026-09-02 13:37 ` Christoph Hellwig
2026-09-02 16:07 ` David Laight
2026-09-02 16:23 ` Eric Biggers
2026-09-02 18:19 ` David Laight
2026-09-02 18:41 ` Eric Biggers
2026-09-03 5:49 ` Christoph Hellwig
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=20260831220658.ADAE91F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ebiggers@kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.