From: Dave Hansen <dave.hansen@intel.com>
To: Yi Lai <yi1.lai@intel.com>, Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, hpa@zytor.com, Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH] selftests/x86: Fix sysret_rip assertion failure on FRED systems
Date: Fri, 20 Mar 2026 07:31:34 -0700 [thread overview]
Message-ID: <c6c2ad7c-c307-4e8b-b2de-55e807f2c41f@intel.com> (raw)
In-Reply-To: <20260320063301.489599-1-yi1.lai@intel.com>
On 3/19/26 23:33, Yi Lai wrote:
> + /*
> + * SYSCALL works differently on FRED, it does not save RIP and RFLAGS
> + * to RCX and R11.
> + */
> + unsigned int eax, ebx, ecx, edx;
> +
> + __cpuid_count(0x7, 0x1, eax, ebx, ecx, edx);
> + if (!(eax & (1 << 17))) {
> + /* R11 and EFLAGS should already match. */
> + assert(ctx->uc_mcontext.gregs[REG_EFL] ==
> + ctx->uc_mcontext.gregs[REG_R11]);
> + }
Could of things:
First, CPUID doesn't tell you if FRED is in use. Is it even on by
default yet? There might not be a better way to do this than checking
CPUID, but checking CPUID is imprecise at best. This at _least_ needs to
be commented. Could you check around for other cases like this in the
x86 selftests and see what the existing solutions are?
Second, this is selftests/, but I feel like we can be a bit more
disciplined than doing raw CPUID calls and sprinkling magic numbers all
about. The least that can be done here is giving bit 17 a name and
making the "is FRED supported" into a helper function.
But it does look like something that needs to get fixed either way!
next prev parent reply other threads:[~2026-03-20 14:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 6:33 [PATCH] selftests/x86: Fix sysret_rip assertion failure on FRED systems Yi Lai
2026-03-20 14:31 ` Dave Hansen [this message]
2026-03-20 15:47 ` Andrew Cooper
2026-03-20 15:50 ` Dave Hansen
2026-03-22 6:13 ` Xin Li
2026-03-23 6:06 ` Lai, Yi
2026-03-23 16:19 ` Xin Li
2026-03-23 19:11 ` H. Peter Anvin
2026-03-23 19:17 ` Andrew Cooper
2026-03-23 20:27 ` H. Peter Anvin
2026-03-24 14:08 ` Andrew Cooper
2026-03-24 14:33 ` H. Peter Anvin
2026-03-24 14:46 ` Andrew Cooper
2026-03-24 15:16 ` H. Peter Anvin
2026-03-22 20:08 ` H. Peter Anvin
2026-03-23 5:55 ` Lai, Yi
2026-03-23 16:39 ` Andrew Cooper
2026-03-24 1:28 ` Lai, Yi
2026-03-24 11:08 ` David Laight
2026-03-24 14:31 ` H. Peter Anvin
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=c6c2ad7c-c307-4e8b-b2de-55e807f2c41f@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
--cc=yi1.lai@intel.com \
/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