Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp516579rdb; Thu, 19 Oct 2023 10:38:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFODnIWnCKg2Noi5Ms/HjgwP3pvEVqNOOuRO8Vk/f7vgEdrIoYzQswZSzMcTaeIh4Ws8kic X-Received: by 2002:a05:6a21:394c:b0:160:a752:59e with SMTP id ac12-20020a056a21394c00b00160a752059emr2831877pzc.40.1697737136252; Thu, 19 Oct 2023 10:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697737136; cv=none; d=google.com; s=arc-20160816; b=L6yw/0Edf5tKHWtiyxP5LhTYb645dmC0W+YazZyvbYXDAh1jJJqN+nnkslCyMXT8fl 4pc85ZxDqROC3Dz2CNveFAjlUBYv1KD/60w6LFZsd8h3CQctg1ulk3XyTS/i6i5Lbv2m wn9vjhqvIAOIyDQmGRxmIi58oPxFFQOXyD/f6cxac4SrK1WtrK+ezxL3N/zkxEAFGLJH 4OsIhOmbYkZi3Ts4JCMdcvg10ZSEEnSjnehBuEul4vhg95Jab32lv4pY+t5CaF5G8bHM Ve9Dt7m9H/7wQXS7+nlylkett8ybF240mPNuKQ+ARG0RdEPKAYFzmrtfl1M+7ICbmGo4 VGuA== 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:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Gi6qQG6+k6miM/ETdb6eGWM+MaqC/fZ3UHWAFSbxhBA=; fh=QTE/77NrEGanimgJjwQAd2ehxixvu5UlvH5I7QKHMIY=; b=R6GOLFfBuOpP9JJudHvnVNVQip/XEdd68IU5lQ2pRIiO9c0LtRRfj011j6YgGjP11W MrhGSrRSSKOa4+vorNIOTbGtn92TyVgq3rSBucmrI12foHgSS7wdv9bKgtEWyysLCY5n 9W4KhQfUgL7Oj8xNbZvbIbynKMao3M6SaSYbk6zTjv8ocq3Wks20+abuwTiZ/TMMxVxm 2nG0nxbcy0QlXp2qXdy9W+AXeJh6Rh6XnUZl0KnRUpZ5/RuZqm08pO1YtwZVX/1Bipk8 ulzPacXMfYHMN0PYrToBJ/lWRSnU7RV2m9tzSA2nKl/IeAATwXwJqTqlWMqWFc04jsyI EFgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fuFc2XEs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id 1-20020a630101000000b00573fa4cfe49si68797pgb.166.2023.10.19.10.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 10:38:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fuFc2XEs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8C06B8246965; Thu, 19 Oct 2023 10:38:53 -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 S1346257AbjJSRip (ORCPT + 99 others); Thu, 19 Oct 2023 13:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235495AbjJSRio (ORCPT ); Thu, 19 Oct 2023 13:38:44 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22BEDCF for ; Thu, 19 Oct 2023 10:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697737080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gi6qQG6+k6miM/ETdb6eGWM+MaqC/fZ3UHWAFSbxhBA=; b=fuFc2XEsYLL6HE4zp5Dp5d/yoGupm5lnT0X1zJCECUsbsgr13cHgtT8Q2WF0WLpVxA80Rj GfsH8r6r/BhFnvnXGhKNjzu3fPlsOgLe2rp+KMC7BKT8jdbMdHNWcDK1+h+vn/VWjjgA+1 c5LrjOSnmPBCXHFSAjED8/LQcyALIB8= Received: from mail-ua1-f71.google.com (mail-ua1-f71.google.com [209.85.222.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-455-Aart1ZJVMxeq0T7Nc_9Zsw-1; Thu, 19 Oct 2023 13:37:58 -0400 X-MC-Unique: Aart1ZJVMxeq0T7Nc_9Zsw-1 Received: by mail-ua1-f71.google.com with SMTP id a1e0cc1a2514c-7af53ed577fso3179361241.1 for ; Thu, 19 Oct 2023 10:37:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697737078; x=1698341878; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gi6qQG6+k6miM/ETdb6eGWM+MaqC/fZ3UHWAFSbxhBA=; b=dKS8AXkC2PDOvni4y8SyuOHEu6l2BblTggvoI6IBFB4O9NVSRb54MMa3RL/xfx92XD woaWdMydv9b2YJEjIwDkB/eTH7+klw6e3g6qeEy1tcH1DO9cE0bsCWdfKuu7Ons4/f0q RiL04pNezh3N7oSNHiub/b4mku/ca5klvw2jsBzUm6jrDaGjQoNIhgfyO3JxU/LES1vC b+JrF6sLQRE2TqK5JLS37DxTj/dp4KIh5QgRBrk8mdtpsG2K4aCHRNRRGfhfrHn8cXY8 ADMLHDQ9+5+QcDO2zlBd4JcYlno49tfDk2ZrZjLFKbGnEqXdpjVhZESwGDHEan6HAyut SFpQ== X-Gm-Message-State: AOJu0YyZtncPAW/X3NlXWqtR5KTz+qBKzfsz3YAg95W7fZZ7wIb0Cl+G m4eHxfls5KjeQGLuQWKNmtHarYn97Zli6N2balCxI2t62swqofrRR+mOGmBYsSwbvacPJntpYQf UCzuifHvJApkqp00751u0d7Y8e1yjgAaqagITfEd7 X-Received: by 2002:a67:c31d:0:b0:452:69e9:a4c with SMTP id r29-20020a67c31d000000b0045269e90a4cmr3488181vsj.3.1697737078093; Thu, 19 Oct 2023 10:37:58 -0700 (PDT) X-Received: by 2002:a67:c31d:0:b0:452:69e9:a4c with SMTP id r29-20020a67c31d000000b0045269e90a4cmr3488170vsj.3.1697737077800; Thu, 19 Oct 2023 10:37:57 -0700 (PDT) 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> In-Reply-To: From: Paolo Bonzini Date: Thu, 19 Oct 2023 19:37:46 +0200 Message-ID: Subject: Re: [PATCH] KVM: x86: Ignore MSR_AMD64_BU_CFG access To: Sean Christopherson Cc: "Maciej S. Szmigiero" , 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=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 10:38:53 -0700 (PDT) On Fri, Oct 6, 2023 at 2:44=E2=80=AFAM Sean Christopherson wrote: > > 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 QE= MU 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= those > 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 so= lve a > problem that is best solved in userspace, with a few outliers that got > grandfathered in. As long as it is enough to ignore the value and read as zero, IMO there is an advantage in doing so in KVM, because it centralizes the update to one place instead of requiring changes to all userspace implementations (those that can run Windows can be counted on one hand, granted, but still). If we get into giving semantics to really-model-specific registers, the disadvantages would be way more pronounced, however. I don't think we should get any of those MSRs into KVM_GET_MSR_INDEX_LIST ever, and we shouldn't implement them in KVM if KVM_SET_MSR has to do anything. Also, we probably shouldn't implement them in KVM if KVM_GET_MSR has to ever return anything but zero. We almost have one of those, a "feature MSR" bit that is used to pass down information on whether LFENCE serializes execution; but it's not supported by KVM_GET_MSR/KVM_SET_MSR. I'd retcon this happily as "we don't want any stateful chicken bit MSRs in the kernel", and I'm in favor of removing it if there are no complaints, now that AMD has defined a bit in 0x80000021 for this purpose. We have the microcode revision, which we had to add because of the side-channel mess of a few years ago. And we also have MSR_AMD64_OSVW_ID_LENGTH and MSR_AMD64_OSVW_STATUS, but those technically are vendor- specific but not model-specific and have an associated CPUID bit. I think those are as close as we get to being a mistake, but still (barely so) on the acceptable side. Paolo