Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp78105rdb; Thu, 5 Oct 2023 17:44:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8/3nUXKfRCD426D5wCjB+Bo4pb0m54D5GdnYq3Y/9+MFLF9bWnSP+uexBypeYqhnJPvh+ X-Received: by 2002:a17:902:dacd:b0:1c7:54ee:c53c with SMTP id q13-20020a170902dacd00b001c754eec53cmr7570890plx.57.1696553087973; Thu, 05 Oct 2023 17:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696553087; cv=none; d=google.com; s=arc-20160816; b=gWKshFQBuTTHxv6EX8Gb/O5HT+9dIWAsdqXvb/10Kricbu8IGbshA3Vwjrx8/egbJQ Oa5S6BHyt2x3wv9sbv+91qBoeP3EPdxI0AcsE8vfBEStrIXObnaY5T95ZbbrwVQDx78Q np33E2zWB+88ktnpTt40xVjKSqyhl34AOm3iADhAVFTWxngipBdjxwFmVau5Qnoa1HRT zFZqPeWovK5R9xKNMa6pWMOHTKCc9JFyP9SXGZKwi0ExtrvX/jFr2kLP6W1Nax577HO1 ZEgfvO1InLpG6cpH4wXT5LUVmgQ28w3ypqrww8sg4esfi1MyPQBbb+xHSfUypzv8rMmW rkkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:dkim-signature; bh=TmC6vOdYmvXc1r+AmcCVVdtc5vurcrXqL0I0SrSeKiM=; fh=AfsjATVnzZRJaUrZvZrNsvo4nEvCYzJfa655Qzt9sTo=; b=sB10dfIKdAX4cvPFN8GttgIHsbq+Cpyq30DFTNTqa6wdC9dmn+tUPBzbh9JGBi9PxA 7Q5t1CrCRqVODvwU3kxrjIVKLSJ573IazUn7qjGSAqE+9TcGHwIFBXR1ncpMLWTzkhJv hyY4pqWtJFp5fU9xVfQ5wOTSKg1SDhJ7FcLiMsYpajr8pLc+WLzx+hhAxh1D5xZd7n/M 0jI8s+EFkh3ZM40qISX+OdNId1ZoBwAmUWGQM/NTMEk/FoOqXqOMpY52NQ7UdbiuSrAC yxVcG3e1/v0cZVbHfoj0Ec0lFkZZeOaieO5GRUgQcgpo13JS1kixllwaU3gSJ3eBlgwy NJFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=y0XYfM9D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id n9-20020a170902d2c900b001c1fe58a1e8si2983458plc.576.2023.10.05.17.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 17:44:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=y0XYfM9D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5FDF98085993; Thu, 5 Oct 2023 17:44:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229592AbjJFAog (ORCPT + 99 others); Thu, 5 Oct 2023 20:44:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjJFAoe (ORCPT ); Thu, 5 Oct 2023 20:44:34 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8197EE4 for ; Thu, 5 Oct 2023 17:44:33 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d817775453dso2061826276.2 for ; Thu, 05 Oct 2023 17:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696553072; x=1697157872; 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=TmC6vOdYmvXc1r+AmcCVVdtc5vurcrXqL0I0SrSeKiM=; b=y0XYfM9DGxxzDmPUq06lCUrcTdyITuI0MV5UtHzRq92cRAd4gAS632x+lFDCvbcGWJ yqXSm+6bj8nJbQLmD9cnfNfxRnd2iegx6QAz0LnIsgrZq2yo4HNhB5+8AwpNOgMsLszx E6N7vPB7csCZjQN6vSODnEq3rlwFzkLGZoqY/nrtaLBBtRNgS4CyFXIt4btwdH28f5L/ tiZv9GxputkESK2hEyYat0jjuo4KKU1ZmYFGlhukKlQkLpUh8Sq8LRo18apLCoNt1LWV HherJoVzqsNBz1gJaVrFHI1LK50UFKsRYlk2zyQgA3+3LvwpJc9bktyRPRVqLp0Ptjo6 idIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696553072; x=1697157872; 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=TmC6vOdYmvXc1r+AmcCVVdtc5vurcrXqL0I0SrSeKiM=; b=qqfYpVFUaD1XdjOv1jcP0A4PrJRWPnRsU2omrM2sqpIFpiZKAkSOZEwn8BuF0268jG yyIndRHjFJyeI2s+M/+NmiJ1jSGP7i97E8EFI2HiIwjrHIo9E1fjMeWrkDDiqZR1NB73 7NVA3YZQaJRUvoZhcSWo7JyXddfVRwnUkjkSWVjXo18WH5P24d6UAKBs3dm2py+mh4an 1ZohFgRE/aSR3IrDwmqPlZniASS82BXsK7MgnHBx0xfxJcT7grgVy564dissC2CtBWll e1VtNY0Nez+KxvXSOV5X6izf+koZL4AyDiq3W8aXKpJWxLQn+tD2sN0Iujv7Yh5wSo4a 6f9w== X-Gm-Message-State: AOJu0Yz97i0MoHjvyd1OPawvGWkg+Lw0aO3vHaj5wQNTaBEHC4TRkZZN NIxzGrHMIDdM+PBn1zFADTdhKWuI2rs= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:d510:0:b0:d89:4247:4191 with SMTP id r16-20020a25d510000000b00d8942474191mr110364ybe.3.1696553072785; Thu, 05 Oct 2023 17:44:32 -0700 (PDT) Date: Thu, 5 Oct 2023 17:44:31 -0700 In-Reply-To: <04cae79f-cd04-4cfe-b6ca-8b02d96350f9@maciej.szmigiero.name> Mime-Version: 1.0 References: <0ffde769702c6cdf6b6c18e1dcb28b25309af7f7.1695659717.git.maciej.szmigiero@oracle.com> <8c6a1fc8-2ac5-4767-8b02-9ef56434724e@maciej.szmigiero.name> <04cae79f-cd04-4cfe-b6ca-8b02d96350f9@maciej.szmigiero.name> Message-ID: Subject: Re: [PATCH] KVM: x86: Ignore MSR_AMD64_BU_CFG access From: Sean Christopherson To: "Maciej S. Szmigiero" Cc: Paolo Bonzini , Borislav Petkov , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Tom Lendacky Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 05 Oct 2023 17:44:45 -0700 (PDT) On Thu, Oct 05, 2023, Maciej S. Szmigiero wrote: > On 5.10.2023 02:10, Sean Christopherson wrote: > > On Mon, Oct 02, 2023, Maciej S. Szmigiero wrote: > > > On 26.09.2023 00:25, Tom Lendacky wrote: > > > > > > It's partially documented in various AMD BKDGs, however I could= n't find > > > > > > any definition for this particular bit (8) - other than that it= is reserved. > > > > >=20 > > > > > I found it as MSR_AMD64_BU_CFG for Model 16h, but that's Jaguar/P= uma, not Zen1. > > > > > My guess is that Windows is trying to write this thing: > > > > >=20 > > > > > =C2=A0=C2=A0 MSRC001_1023 [Table Walker Configuration] (Core::X8= 6::Msr::TW_CFG) > > > > > =C2=A0=C2=A0 Read-write. Reset: 0000_0000_0000_0000h. > > > > > =C2=A0=C2=A0 _lthree0_core[3,1]; MSRC001_1023 > > > > >=20 > > > > > =C2=A0=C2=A0 Bits=C2=A0=C2=A0 Description > > > > > =C2=A0=C2=A0 63:50=C2=A0 Reserved. > > > > > =C2=A0=C2=A0 49=C2=A0=C2=A0=C2=A0=C2=A0 TwCfgCombineCr0Cd: combi= ne CR0_CD for both threads of a core. Read-write. Reset: 0. Init: BIOS,1. > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1=3DThe h= ost Cr0_Cd values from the two threads are OR'd together and used by both t= hreads. > > > > > =C2=A0=C2=A0 48:0=C2=A0=C2=A0 Reserved. > > > > >=20 > > > > > Though that still doesn't explain bit 8...=C2=A0 Perhaps a chicke= n-bit related to yet > > > > > another speculation bug? > > > > >=20 > > > > > Boris or Tom, any idea what Windows is doing?=C2=A0 I doubt it ch= anges our options in > > > > > terms of "fixing" this in KVM, but having a somewhat accurate/hel= pful changelog > > > > > would be nice. > > > >=20 > > > > It's definitely not related to a speculation bug, but I'm unsure wh= at was > > > > told to Microsoft that has them performing that WRMSR. The patch do= es the > > > > proper thing, though, as a guest shouldn't be updating that setting= . > > > >=20 > > > > And TW_CFG is the proper name of that MSR for Zen. > > >=20 > > > So, should I prepare v2 with MSR_AMD64_BU_CFG -> MSR_AMD64_TW_CFG cha= nge? > >=20 > > If we can get Paolo's attention, I'd like to get his thoughts on puntin= g this > > to QEMU/userspace. I'm worried that "handling" uarch specific MSRs in = KVM is > > going to paint us into a corner and force KVM to check guest F/M/S some= day, which > > I want to avoid at pretty much all costs. >=20 > We already do similar ignoring in KVM for MSR_AMD64_BU_CFG2, MSR_AMD64_DC= _CFG > and MSR_F15H_EX_CFG, so doing this {BU_CFG2,TW_CFG} MSR filtering in QEMU= would > be inconsistent with these. Not if QEMU filters those too. :-) The MSR filter mechanism wasn't a thing back when KVM added "support" for t= hose MSR, so I don't feel that punting to userspace would be inconsistent. It's= more along the lines of asking/requiring userspace to utilize a new tool to solv= e a problem that is best solved in userspace, with a few outliers that got grandfathered in. Anyways, yeah, let's get Paolo's feedback.