Received: by 2002:a05:6358:c22:b0:b5:95e5:7f42 with SMTP id f34csp49904rwj; Wed, 24 Aug 2022 14:43:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR5dMOhBUD3zz0Gl5IhkJieuW5sIXwzUniXQe9NruaVs/s8EASekykQvX/R0J1UGK93b+Qir X-Received: by 2002:a17:907:960f:b0:73d:5b08:68b9 with SMTP id gb15-20020a170907960f00b0073d5b0868b9mr546467ejc.337.1661377411745; Wed, 24 Aug 2022 14:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661377411; cv=none; d=google.com; s=arc-20160816; b=NkC4geHA6T2wK/c8GfMo5l7dpSg3hSbq3GrxJCuVVM1VyUMhFppmET56lD3oYvJ4cq 3FL0sS4f+dhkAxk4lxk8RdQD3EOC108sZX/VtEwTwk7yTgt1vGpIINzbfWm9nDfOURqd BhgBKeGt3Rs9NZMl0/ks9kZZ7WDMqC4jp+K+AKNICdn/G9GvCbO79Z62SgM7oPU3N+V5 MvHtJ3OftEy4pvs4Dy4XBfgFSBH8HlbVpfmFtzS+zmbUVoxW6hM1+qbi6svfpzz+m4wY 5aNz6vOXvjHmrn8SAj7oc6vcsjRjD63fsdW9hOTKUHPHcCPEXUuXFh00OJNPDgMnQrxd +RYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/h4kOyHP46X43kQG6NQXXVAKCHL+YZ4y4xLu+bGaWYM=; b=yYKevvav5M76tKBMg8MZqQdsVVy679zb4A4cPjHJ0C9bEs2VBpjCbQMr6BWrh1Y658 AZhEOovbvH5W18mGC2+RJKmjeXicIEvlgK6gmDACRWaiqUwYTYcgboa5zcb1NzJRFi6o mWAKxK0+lxWshKLdPq2Xkg4MOJibAnj63yEbJXjsFHTQZuzcxaxCp1Aw3BY6E0Z002WR yLudGzRLxoezoUwADMOZx3wgNw1k+3/EIe8x85JFXbZYS6xl65YYp/gppISbAYMgg7cA 75mp4Q8AoEkl3ITEFUxDjvTqK81OddH5UUEgREc3uPwYEdtAg6aaWz9cBhpKfoMJU+fA s44A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=cwcBlsPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a056402330600b0044785508ac0si1879025eda.51.2022.08.24.14.43.06; Wed, 24 Aug 2022 14:43:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=cwcBlsPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240630AbiHXVIz (ORCPT + 99 others); Wed, 24 Aug 2022 17:08:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232245AbiHXVIy (ORCPT ); Wed, 24 Aug 2022 17:08:54 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D23DB796A6 for ; Wed, 24 Aug 2022 14:08:52 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id 1so10496947pfu.0 for ; Wed, 24 Aug 2022 14:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=/h4kOyHP46X43kQG6NQXXVAKCHL+YZ4y4xLu+bGaWYM=; b=cwcBlsPxRdk3XeWRUreTskl53H9+5FSGjnMWdcMjsVYlDnnee+Az4x8J6jXE7du94K kKvqTnHTX3i7cXkh8OuXPiNNhjprD1nG4zD2dTu15IYwTISXJU1FXlWYrKI7roqgK05P iB+MiKbJoA/0R9lIj/PCJydD4LldWOAgXGlOyTqMWrpRsCJsCOO2D1I3d/QFiwQGlgmH W8EwvuFp+ZrqLslH0mO9eP+KbxbANZfwRxe1J4l1/ZrstwvypUc+jYYRGjSqhhTVGJUH 6SArSVurtFtpyIpztTivIRYWAtfr5U8w9s+6kBT01ar64HoE2oEoWFoqIQuzZJeNbIuX LbNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=/h4kOyHP46X43kQG6NQXXVAKCHL+YZ4y4xLu+bGaWYM=; b=T2smUuoitYwiKHlwvstEEFhbJ6B/A3557YOEG3FlcUYTR3amITcv6AvnHFTl02I7tX fAYTQM6m6TyLreq4fb1g09zuRDLhi/hJvu1LGhLtZ6hfel7j5h+oSlGWe6sO8V5ppmn5 pwsj6xx7X/9J9G0Mf0h18EFfpcwAyd9LZWsygN5bGfb2KAhbcOUuj3qqjGHu6NgbxAXr 0uHDXd7i4GoacPs59qaR7M496qn+WOlIPnPNFdLWSucem4ikpOyU/+DLhdgyhgMKjLUB i40DFSEdGewQ+dH8aQ05XT051hjZJEnIlZDYGWlaPQid0SJ76iVWWwxt+gmjqliK1hue 7NaQ== X-Gm-Message-State: ACgBeo08Pt+caeV23UocvKoWXYyY5VePKsR5FqeBiIYdhAPOoc5XOZfd Xag4kgbxQfH/C2PXabNr6L3MZw/MMTYFRQ== X-Received: by 2002:a05:6a00:8cf:b0:522:93a6:46e9 with SMTP id s15-20020a056a0008cf00b0052293a646e9mr978816pfu.62.1661375332173; Wed, 24 Aug 2022 14:08:52 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id q15-20020a17090311cf00b0016d1f6d1b99sm13071802plh.49.2022.08.24.14.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 14:08:51 -0700 (PDT) Date: Wed, 24 Aug 2022 21:08:47 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: David Matlack , kvm list , LKML , Kai Huang , Michael Roth , Tom Lendacky Subject: Re: [PATCH v2 2/3] KVM: x86/mmu: Fully re-evaluate MMIO caching when SPTE masks change Message-ID: References: <20220803224957.1285926-1-seanjc@google.com> <20220803224957.1285926-3-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,FSL_HELO_FAKE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=no 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 On Fri, Aug 19, 2022, Paolo Bonzini wrote: > On 8/19/22 18:21, David Matlack wrote: > > On Wed, Aug 3, 2022 at 3:50 PM Sean Christopherson wrote: > > > > > > Fully re-evaluate whether or not MMIO caching can be enabled when SPTE > > > masks change; simply clearing enable_mmio_caching when a configuration > > > isn't compatible with caching fails to handle the scenario where the > > > masks are updated, e.g. by VMX for EPT or by SVM to account for the C-bit > > > location, and toggle compatibility from false=>true. > > > > > > Snapshot the original module param so that re-evaluating MMIO caching > > > preserves userspace's desire to allow caching. Use a snapshot approach > > > so that enable_mmio_caching still reflects KVM's actual behavior. > > > > Is updating module parameters to reflect the actual behavior (vs. > > userspace desire) something we should do for all module parameters? > > > > I am doing an unrelated refactor to the tdp_mmu module parameter and > > noticed it is not updated e.g. if userspace loads kvm_intel with > > ept=N. > > If it is cheap/easy then yeah, updating the parameters is the right thing to > do. Generally, however, this is only done for kvm_intel/kvm_amd modules > that depend on hardware features, because they are more important for > debugging user issues. (Or at least they were until vmx features were added > to /proc/cpuinfo). IMO, unless it's _really_ hard, KVM should keep the parameters up-to-date with reality, e.g. so that userspace can assert that a feature is fully enabled, either for testing purposes (unrestricted guest?) or to prevent running with a "bad" config. We've had at least one internal OMG-level bug where KVM effectively ran with the wrong MMU configuration, and IIRC one of the actions taken in response to that was to assert on KVM's parameters post-load.