From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61A38C3F6B0 for ; Wed, 24 Aug 2022 21:08:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239911AbiHXVI4 (ORCPT ); Wed, 24 Aug 2022 17:08:56 -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-Google-Smtp-Source: AA6agR4JWyvRqXWOx88AQZo2m3/E2P8Fe1MV7l0ifpCJivKRr7nDN0BCCEr+IF5HcNidBzynrcbGJQ== 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: 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.