From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A02F533AD8A for ; Wed, 11 Feb 2026 16:26:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770827188; cv=none; b=OwnrWg9EjK6yXpSbcGhr7vohYiB3NcKQ82peztAUO7kc4iLcKUd3QSrGpRpgARMDbQUFtlko4s/rniGQUPZPGmobPbwDmViO+wrh5F3GNrA4vB5SLFVNDSSeQm1GvYv2ITZBzIt14Mj1KGBFmu3yrJyTYJjLKQv0MkxM+hmFZsM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770827188; c=relaxed/simple; bh=QIUgdplTX9FeLykL3XX+1apXjFaIxvWy6awsPERQYeU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oy6zt5YAt9BYg8/6b5HQ8mhgZlZXPFtCFASUFIm0XWiojhCYNzOOh88KLKIwn2TGN6Hx743D5omlUVxFFkwMbqOBy8QE4dP9b9kCldV8pKj75oZUfbuDMtHBkNzIuQD6YpgSdN3lBUvuj7t2tHzXP9d6tz+3IL+9KKCNpRuhn0g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uuRlaxl5; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uuRlaxl5" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-29f2381ea85so138048875ad.0 for ; Wed, 11 Feb 2026 08:26:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770827187; x=1771431987; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=jZ/jbuv2cJCfGshCIenTd+0KJACRJkkS3H39sEGYyCo=; b=uuRlaxl5Yo8W4Q5AOvc7XPcmMDCtTPsKyNRSuAjNs+SYbbSrJ1fy6W4HWc0OmXivSf Fe75UB5WMyETaCRnUHbvfy93kRs98M+R4Z21jYWXz9xsSyW9tx3TMM+jIH0sHPbFagoR bqY4p2Pz0AWCWBlrc0g+khMQ63zBDn5CkcU2KuJ7BTV7WIc3SVyKs8BjmlSyCrrSoN66 /epnJbg2KG5CopbpITGfMF8SDgz2KQC8aPcNN3F7TQU0pHuzrFYhJJM7uez+93lO1R8n P0pngxIC0PKshWHJADqntkGxvP8bAz3tfsNts/8MV/0cefkJBgTm/QNESdT42vkzGLVJ NKIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770827187; x=1771431987; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=jZ/jbuv2cJCfGshCIenTd+0KJACRJkkS3H39sEGYyCo=; b=aFiZyXql+n0rA3AKzUVl3Wk0K+JttNsbnNmXykpZIWGRfvF0RQTQlD8jJi2Gr3JZnV Q0/qGgSXQ1SXjJ/uPmTd44aUY/AwmKtwH+ZPHqrdDD9SGv/vFXxUqLjAE1uXO8nT3tDH xW+z+gY/3YxSDw9meyzFfzcx6VlWpqvtiQqM5nTAoLgnxJHlW867FHE3MzD++HgEnlbq YLY+LNUtRxOkb+3Qa3R48uPy248CmCwpX/M+SkD7yvkETDk5dZSOLylOeWwK+6GSSBn6 xhQZ3BO91DkNCduZO+WMoNJ+gc/Q1ODrBn5GLJ/DqVAyTv+GhVOdQuk1rve/WV2LMhkM 4IBQ== X-Forwarded-Encrypted: i=1; AJvYcCWpbmA1wOyb1EBDQwrzMkibvmPHLR9fgBYe15eSV2QjKkxDpJIXg0VjU+9Rmr59XAj9S0QjzZrgNcAemRY=@vger.kernel.org X-Gm-Message-State: AOJu0YxIo8G65BlYl4m/sT1g1CtVlRhkteCTzTaJ4hbheIigeu4gjHQ9 3emqznvEZ4WRiUj+Ygpe2jeWQnvnPTACa15FALAJFOt0f1uaH0aOB8vrQM8ZJqFACsnrTEiPhN6 9rhVPiQ== X-Received: from plrq7.prod.google.com ([2002:a17:902:b107:b0:2a8:2677:6e7]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:b46:b0:2aa:f43d:7c42 with SMTP id d9443c01a7336-2ab27d13dd8mr27085085ad.24.1770827186712; Wed, 11 Feb 2026 08:26:26 -0800 (PST) Date: Wed, 11 Feb 2026 08:26:25 -0800 In-Reply-To: <3088af31-7ef8-45f3-9e0c-c51274ab9ca0@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260209041305.64906-1-zhiquan_li@163.com> <20260209041305.64906-6-zhiquan_li@163.com> <65765e72-fce0-48ed-ab95-af2736a562cd@163.com> <3088af31-7ef8-45f3-9e0c-c51274ab9ca0@163.com> Message-ID: Subject: Re: [PATCH RESEND 5/5] KVM: x86: selftests: Fix write MSR_TSC_AUX reserved bits test failure on Hygon From: Sean Christopherson To: Zhiquan Li Cc: pbonzini@redhat.com, shuah@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 11, 2026, Zhiquan Li wrote: >=20 > On 2/11/26 04:02, Sean Christopherson wrote: > > Gah, I think I tested -rdpid and -rdtscp in a VM on Intel, but not AMD.= I think > > the fix is just this: > >=20 > > diff --git a/tools/testing/selftests/kvm/x86/msrs_test.c b/tools/testin= g/ > > selftests/kvm/x86/msrs_test.c > > index 40d918aedce6..ebd900e713c1 100644 > > --- a/tools/testing/selftests/kvm/x86/msrs_test.c > > +++ b/tools/testing/selftests/kvm/x86/msrs_test.c > > @@ -175,7 +175,7 @@ void guest_test_reserved_val(const struct kvm_msr *= msr) > > * If the CPU will truncate the written value (e.g. SYSENTER on= AMD), > > * expect success and a truncated value, not #GP. > > */ > > - if (!this_cpu_has(msr->feature) || > > + if ((!this_cpu_has(msr->feature) && !this_cpu_has(msr->feature2)) || > > msr->rsvd_val =3D=3D fixup_rdmsr_val(msr->index, msr->rsvd_= val)) { > > u8 vec =3D wrmsr_safe(msr->index, msr->rsvd_val); >=20 > Perfect! You found the root cause and fixed it. > I=E2=80=99ve verified the fix on Hygon platform, I will test it on Intel = and AMD > platforms as well to make sure there is no regression. > I=E2=80=99m going to include the you fix in the V2 series. Since my modi= fications are > totally miss the point, I will remove my SoB and only add my =E2=80=9CRep= orted-by:=E2=80=9D tag, > I suppose the SoB position would be wait for you, Sean :-) Nice! Here's a full patch for v2. -- From: Sean Christopherson Date: Wed, 11 Feb 2026 08:18:47 -0800 Subject: [PATCH] KVM: selftests: Fix reserved value WRMSR testcase for multi-feature MSRs When determining whether or not a WRMSR with reserved bits will #GP or succeed due to the WRMSR not existing per the guest virtual CPU model, expect failure if and only if _all_ features associated with the MSR are unsupported. Checking only the primary feature results in false failures when running on AMD and Hygon CPUs with only one of RDPID or RDTSCP, as AMD/Hygon CPUs ignore MSR_TSC_AUX[63:32], i.e. don't treat the bits as reserved, and so #GP only if the MSR is unsupported. Fixes: 9c38ddb3df94 ("KVM: selftests: Add an MSR test to exercise guest/hos= t and read/write") Reported-by: Zhiquan Li Closes: https://lore.kernel.org/all/20260209041305.64906-6-zhiquan_li@163.c= om Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/x86/msrs_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/x86/msrs_test.c b/tools/testing/se= lftests/kvm/x86/msrs_test.c index 40d918aedce6..ebd900e713c1 100644 --- a/tools/testing/selftests/kvm/x86/msrs_test.c +++ b/tools/testing/selftests/kvm/x86/msrs_test.c @@ -175,7 +175,7 @@ void guest_test_reserved_val(const struct kvm_msr *msr) * If the CPU will truncate the written value (e.g. SYSENTER on AMD), * expect success and a truncated value, not #GP. */ - if (!this_cpu_has(msr->feature) || + if ((!this_cpu_has(msr->feature) && !this_cpu_has(msr->feature2)) || msr->rsvd_val =3D=3D fixup_rdmsr_val(msr->index, msr->rsvd_val)) { u8 vec =3D wrmsr_safe(msr->index, msr->rsvd_val); =20 base-commit: e944fe2c09f405a2e2d147145c9b470084bc4c9a --