From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 E86043C3C11 for ; Thu, 5 Mar 2026 15:35:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772724916; cv=none; b=By02ASVJf7oVwqh9Go0yGw3HMJpR/Q8n8I7dsWBugRFyNjCZV/+X8Nd8sxshnmh0orqaIg43tS6LraJilTu3sE76r9QIGCbwW71GaF+jK0tcFEgHaSPwHVP+oe4vpHItQXepxuJggJH1UlsnzZPdrLsw+ETS/JgZJZYjhW9gGW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772724916; c=relaxed/simple; bh=xPxR7A1KpL6unFCuzXfwTzWyLcM4UNIGR0JOSYbIUDM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=hkkw6Ue3bZEf1WIfe7zUJ4R54yIZcQHgWvVhfNAthqViRLtw+pHqk0CR033o8J5D3uq5W9zcvYuDw1OnDZIndiDwRzZPRkUTK+wVHSjoIicWJBDsK44YoDKycELjp1DWhuhcTsK0u8GEabNSq5gBWu4P6b3Qh2bmeAKnpERxObU= 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=JLZdnS1n; arc=none smtp.client-ip=209.85.216.73 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="JLZdnS1n" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-359887aece0so5282621a91.1 for ; Thu, 05 Mar 2026 07:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772724914; x=1773329714; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Nb1Po5uhA8ajtfdop0hCLXdvKmdr6sjlbz1AVD84as4=; b=JLZdnS1nC/l4jr9dJj9Fq1IrWvMm6ttJo6dxGgsE22hy2Zs1qDPCN1ORDIMxbuRrG5 lESbKZKQ2ntD+dV8xS0UIODaHYsq7EDnAZYzJIthmBj/3AhoPhVv4lpEE6CeJHzssyOp dMeXcHNpfIw77lNX9s96/LbaCY3bsvqnMSgihGYxuxrLbjM9etmm1B3Z158psDNtIXNI idIaeFtSFkxQV0eS2p35KKgY+z72iVS1kcxiqm+87ACMBi9tDZnjPU/6heQ5JFXOr6Aj QpHlD1CcciDvE/+yEmgLPdLK8RSD2eslMkUoNkIqvHIZUv8o3wZA+kU4vzhQPnnoLZRj rUeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772724914; x=1773329714; h=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=Nb1Po5uhA8ajtfdop0hCLXdvKmdr6sjlbz1AVD84as4=; b=Y4EyGd0lLa7Hwl5Q759GL0px2kuDYe8xcyyWaMO6bxR4TR0ahlVhCrBG3tKCrvPZLv e4WPS9CN5X0fK40WsFgIF0GOxCEnuIbDAWZHoCDSpVJGP95Wqz0mfVjoghfDslAPI2/5 Xa0VlKl+vXFarilCZeIhre880wdcCbH40V6S6orEynZ2JWaIyRk9LpbrvPyVdHgiAfon TJMuf33BhsBNH7bjreuUdDKIZxy6pjGUNqQNbSk+WDSgTcBZi0+xsOq8yzzelmOEvHoU ZQduFH4kwpqDfmrP5cTqsUR4Ksd8zXpgV5T12wLJgCw77C9jm3wc6waFDFjSsNIXc4Z0 WUiw== X-Forwarded-Encrypted: i=1; AJvYcCVe5LoTl3z528oFBWUhmHAM4yJK1PwYEtQrroKhr/+Qy2ydQHDF+qUf9zAdqsrtALQJQ7vtI12wzRy7uYw=@vger.kernel.org X-Gm-Message-State: AOJu0YxPjvgCf5eAxkJ+7E1QgsslXHZBF3RKJRx+17D2oJPWpIma9YQS h1Hy9vh3KMlMiQghNVZBPx/bftiDZy5oCKwv7OZqoXEGSfxDw/T3J5GaRbJZ5WqIS5mTqbV8Exj fI7uZMQ== X-Received: from pjbof5.prod.google.com ([2002:a17:90b:39c5:b0:359:86b9:176d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1a91:b0:359:7c55:c160 with SMTP id 98e67ed59e1d1-359a69da7d6mr5554358a91.13.1772724913982; Thu, 05 Mar 2026 07:35:13 -0800 (PST) Date: Thu, 5 Mar 2026 07:35:12 -0800 In-Reply-To: <263F364B-D516-40B3-B065-A5369BFB1A7F@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251026201911.505204-1-xin@zytor.com> <20251026201911.505204-16-xin@zytor.com> <263F364B-D516-40B3-B065-A5369BFB1A7F@zytor.com> Message-ID: Subject: Re: [PATCH v9 15/22] KVM: x86: Mark CR4.FRED as not reserved From: Sean Christopherson To: Xin Li Cc: Chao Gao , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, pbonzini@redhat.com, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, peterz@infradead.org, andrew.cooper3@citrix.com, hch@infradead.org, sohil.mehta@intel.com Content-Type: text/plain; charset="us-ascii" On Wed, Mar 04, 2026, Xin Li wrote: > > >> 2. mk_cr_64() drops the high 32 bits of the new CR4 value. So, CR4.FRED is always > >> dropped. This may need an update. > > > > Ugh, I didn't realize FRED broke into bits 63:32. Yeah, that needs to be updated, > > and _that_ one is unique to the emulator. > > > > Unless Chao and I can't read code and are missing magic, KVM's virtualization of > > FRED is quite lacking. > > > > More importantly, I don't see *any* tests. At a bare minimum, KVM's msrs_test > > needs to be updated too get coverage for userspace vs. guest accesses, save/restore > > needs to be covered (maybe nothing additional required?), and there need to be > > negative tests for things like leaving 64-bit mode with FRED=1. We can probably > > get enough confidence in the "happy" paths just by running VMs, but even then I > > would ideally like to see tests for edge cases that are relatively rare when just > > running a VM. > > > > I'm straight up not going to look at new versions if there aren't tests. Like > > CET before it, both Intel and AMD are pushing FRED and want to get it merged, > > yet no one is providing tests. That's not going to fly this time, as I don't > > have the bandwidth to help write the number of testcases FRED warrants. > > I must admit the issues Chao raised were a clear oversight on my part. > > I wrote some basic functionality unit tests in kernel selftests, which were > included in v1 and v2. > > Later I started to create FRED tests in kvm-unit-tests and extended one > nested test case to CET: > > https://lore.kernel.org/kvm/aJ9DB12YVJEyDORD@intel.com/ > > I planned to send out these new kvm unit tests (not just FRED tests) after > KVM FRED patch series gets merged. Definitely send them before. Even if no one outside of Intel can run them (I forget when FRED hardware is coming), people like me can at least see what you're testing, which makes it more likely that we'll spot bugs. E.g. in this case, the lack of negative tests for CR4.FRED is a big red flag.