Linux RAID subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eric Biggers" <ebiggers@kernel.org>
Cc: linux-raid@vger.kernel.org, yukuai@fygo.io
Subject: Re: [PATCH v3 8/8] xor: Add AVX-512 optimized xor_gen()
Date: Thu, 13 Aug 2026 02:39:49 +0000	[thread overview]
Message-ID: <20260813023950.4A1311F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813021506.55129-9-ebiggers@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing `vzeroupper` instruction after using AVX-512 (ZMM) registers, leading to severe AVX-to-SSE transition penalties in kernel threads.
--

--- Patch [8]: [PATCH v3 8/8] xor: Add AVX-512 optimized xor_gen() ---
commit 0074b2adffd00d86b2a03e4d30495b21794ecb20
Author: Eric Biggers <ebiggers@kernel.org>

xor: Add AVX-512 optimized xor_gen()

This commit introduces an AVX-512 optimized implementation of xor_gen()
using 512-bit ZMM registers and the vpternlogq instruction. It is enabled
on x86_64 CPUs with AVX512F that do not have the PREFER_YMM feature set.

> diff --git a/lib/raid/xor/x86/xor-avx512.c b/lib/raid/xor/x86/xor-avx512.c
> new file mode 100644
> index 0000000000000..17f57900d8274
> --- /dev/null
> +++ b/lib/raid/xor/x86/xor-avx512.c
[ ... ]
> +static void xor_gen_avx512(void *dest, void **srcs, unsigned int src_cnt,
> +			   unsigned int bytes)
> +{
> +	kernel_fpu_begin();
> +	xor_gen_avx512_inner(dest, srcs, src_cnt, bytes);

[Severity: Medium]
Does this code need a vzeroupper instruction before releasing the FPU to avoid
AVX-to-SSE transition penalties? If a kernel thread modifies the ZMM registers
here and subsequently executes legacy SSE instructions (for example, in kcryptd)
without an intervening user-space context switch to clear the state, the CPU
could incur a severe transition penalty on affected architectures.

While this problem already existed in the xor-avx.c implementation using YMM
registers, the newly introduced xor-avx512.c appears to repeat the defect.

> +	kernel_fpu_end();
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813021506.55129-1-ebiggers@kernel.org?part=8

      reply	other threads:[~2026-08-13  2:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  2:14 [PATCH v3 0/8] x86: Remove cpu_has_xfeatures() and add AVX-512 xor_gen() Eric Biggers
2026-08-13  2:14 ` [PATCH v3 1/8] x86/fpu: Check for missing AVX and AVX-512 xstate bits Eric Biggers
2026-08-13  2:15 ` [PATCH v3 2/8] um: " Eric Biggers
2026-08-13  2:15 ` [PATCH v3 3/8] crypto: x86 - Stop using cpu_has_xfeatures() Eric Biggers
2026-08-13  2:15 ` [PATCH v3 4/8] lib/crypto: x86: " Eric Biggers
2026-08-13  2:15 ` [PATCH v3 5/8] lib/crc: " Eric Biggers
2026-08-13  2:15 ` [PATCH v3 6/8] x86/fpu: Remove cpu_has_xfeatures() Eric Biggers
2026-08-13  2:15 ` [PATCH v3 7/8] xor: Remove redundant X86_FEATURE_OSXSAVE check Eric Biggers
2026-08-13  2:15 ` [PATCH v3 8/8] xor: Add AVX-512 optimized xor_gen() Eric Biggers
2026-08-13  2:39   ` sashiko-bot [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=20260813023950.4A1311F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox