Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp350898rdb; Thu, 5 Oct 2023 07:48:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IErZTTCq+RZo5A6Qmytw56MuxmSxU4YtiMd1KZowYmTSmZsO59j+5iy4lYLGstoUH4wUzIT X-Received: by 2002:a05:6a00:398d:b0:68a:4103:9938 with SMTP id fi13-20020a056a00398d00b0068a41039938mr5502563pfb.0.1696517283717; Thu, 05 Oct 2023 07:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696517283; cv=none; d=google.com; s=arc-20160816; b=HNuaRax+KQSX5vg56h402H7OkX+k2Tenm1FUtv71B8iJmtIpib72A6F4vvzfZ0K3wl VAQTeHmsya55Eu3F2K5HKrItMbdoA1Nu5GwoAamIxyjyQsgxGQmKnLEyJde5OWmXG5+I sZ2lSJqTIVAPaWq9ee25avxfZKXcSw8FerIC17ocGSZsDiNf3g7vJYVsxyEnocPauY3J wvRYUqZB7OZjbOtKAhsqoZvtmwIxAY8VHJ9NgkMy3q5DL2Y50VEvuK+pUGH26+HkUSxq PQirn3QcqxNCbclcANTMeoT/kwleTRRX75I2iZemXJqdQHD6GXlzkTet3oT6VSc5ol9a 4cVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id; bh=AxoN/M275DA1yNIhvi+FUNdWfjcCoND6Gaxn4I5QTy8=; fh=VrPhBHX/9U1rqPMhiuFglE2G5SoQlkd1WSAx8iRfuAA=; b=zt9FqzCl5t/91E1zmejcky5ZSI4WxB7N+L7HMM1WefoLqgBOUDfKXRiRXzbAmtbGXi uJoKTZT+PtNBRmEssOxpaeQMZ3PsyfzI4M6kBsT5kMhRym7c/1bnEaBVAONo/S0/Mc8M cs/TkJ2WwGnh8FUriAd+kfS64QB5esOAGgmpJ7vIokO7eeQ4GcbgqEcocxGf52/28fE8 r0i8ZuKW3sIGcScoGa9S+73UFdaRv7AthUspFzPzsoO7h7z5wrIu38oFS/X87o8AgckI VxMWklsqGcCHVDLgOznCxmAHuMffVv+fIP/j1vsxm/YHsDmGxhTde8rQvsikTRtaZyIY GdEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id bo10-20020a056a000e8a00b0068fb4842092si1472619pfb.183.2023.10.05.07.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:48:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3F317867FEA4; Thu, 5 Oct 2023 07:46:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235259AbjJEOqX (ORCPT + 99 others); Thu, 5 Oct 2023 10:46:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239084AbjJEOlo (ORCPT ); Thu, 5 Oct 2023 10:41:44 -0400 Received: from vps-vb.mhejs.net (vps-vb.mhejs.net [37.28.154.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C6E810D; Thu, 5 Oct 2023 07:16:44 -0700 (PDT) Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qoLw6-0005y4-Dj; Thu, 05 Oct 2023 12:50:30 +0200 Message-ID: <04cae79f-cd04-4cfe-b6ca-8b02d96350f9@maciej.szmigiero.name> Date: Thu, 5 Oct 2023 12:50:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] KVM: x86: Ignore MSR_AMD64_BU_CFG access Content-Language: en-US, pl-PL To: Sean Christopherson Cc: Paolo Bonzini , Borislav Petkov , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Tom Lendacky References: <0ffde769702c6cdf6b6c18e1dcb28b25309af7f7.1695659717.git.maciej.szmigiero@oracle.com> <8c6a1fc8-2ac5-4767-8b02-9ef56434724e@maciej.szmigiero.name> From: "Maciej S. Szmigiero" Autocrypt: addr=mail@maciej.szmigiero.name; keydata= xsFNBFpGusUBEADXUMM2t7y9sHhI79+2QUnDdpauIBjZDukPZArwD+sDlx5P+jxaZ13XjUQc 6oJdk+jpvKiyzlbKqlDtw/Y2Ob24tg1g/zvkHn8AVUwX+ZWWewSZ0vcwp7u/LvA+w2nJbIL1 N0/QUUdmxfkWTHhNqgkNX5hEmYqhwUPozFR0zblfD/6+XFR7VM9yT0fZPLqYLNOmGfqAXlxY m8nWmi+lxkd/PYqQQwOq6GQwxjRFEvSc09m/YPYo9hxh7a6s8hAP88YOf2PD8oBB1r5E7KGb Fv10Qss4CU/3zaiyRTExWwOJnTQdzSbtnM3S8/ZO/sL0FY/b4VLtlZzERAraxHdnPn8GgxYk oPtAqoyf52RkCabL9dsXPWYQjkwG8WEUPScHDy8Uoo6imQujshG23A99iPuXcWc/5ld9mIo/ Ee7kN50MOXwS4vCJSv0cMkVhh77CmGUv5++E/rPcbXPLTPeRVy6SHgdDhIj7elmx2Lgo0cyh uyxyBKSuzPvb61nh5EKAG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hP1Oz+jKLUECbPS2ll73rFXUr+U3AKyLpx4T+/Wy1ajKn7rOB7udmTmYb8nnlQb 0fpPzYGBzK7zWIzFotuS5x1PzLYhZQFkfegyAaxys2joryhI6YNFo+BHYTfamOVfFi8QFQL5 5ZSOo27q/Ox95rwuC/n+PoJxBfqU36XBi886VV4LxuGZ8kfy0qDpL5neYtkC9w== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:46:59 -0700 (PDT) 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 couldn't find >>>>> any definition for this particular bit (8) - other than that it is reserved. >>>> >>>> I found it as MSR_AMD64_BU_CFG for Model 16h, but that's Jaguar/Puma, not Zen1. >>>> My guess is that Windows is trying to write this thing: >>>> >>>>    MSRC001_1023 [Table Walker Configuration] (Core::X86::Msr::TW_CFG) >>>>    Read-write. Reset: 0000_0000_0000_0000h. >>>>    _lthree0_core[3,1]; MSRC001_1023 >>>> >>>>    Bits   Description >>>>    63:50  Reserved. >>>>    49     TwCfgCombineCr0Cd: combine CR0_CD for both threads of a core. Read-write. Reset: 0. Init: BIOS,1. >>>>           1=The host Cr0_Cd values from the two threads are OR'd together and used by both threads. >>>>    48:0   Reserved. >>>> >>>> Though that still doesn't explain bit 8...  Perhaps a chicken-bit related to yet >>>> another speculation bug? >>>> >>>> Boris or Tom, any idea what Windows is doing?  I doubt it changes our options in >>>> terms of "fixing" this in KVM, but having a somewhat accurate/helpful changelog >>>> would be nice. >>> >>> It's definitely not related to a speculation bug, but I'm unsure what was >>> told to Microsoft that has them performing that WRMSR. The patch does the >>> proper thing, though, as a guest shouldn't be updating that setting. >>> >>> And TW_CFG is the proper name of that MSR for Zen. >> >> So, should I prepare v2 with MSR_AMD64_BU_CFG -> MSR_AMD64_TW_CFG change? > > If we can get Paolo's attention, I'd like to get his thoughts on punting 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 someday, which > I want to avoid at pretty much all costs. 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. But let's wait for Paolo's opinion then. Thanks, Maciej