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 4FB69C04A68 for ; Thu, 28 Jul 2022 15:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbiG1PnQ (ORCPT ); Thu, 28 Jul 2022 11:43:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229775AbiG1PnN (ORCPT ); Thu, 28 Jul 2022 11:43:13 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CACA069F2E for ; Thu, 28 Jul 2022 08:43:12 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id a7-20020a17090a008700b001f325db8b90so1111313pja.0 for ; Thu, 28 Jul 2022 08:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OvVirUwva7iitmCWZI9gOg8g2CWki9PsaWOed+nTpOU=; b=AiRFPHaA7gZOYNc69ZY96d8VhlOkMnaDNRHXUPXYvDABBFKi+J5uw7z/ofo7pXx+kZ OLkNhH6Kgd3V69r4I7YmRLT/Tjia4T46btmtB1dIkIw28Vis+01PIRvIPlJitO/FwFw/ 1U1P8H0p3NMJKHx+U00LYiF/H6ovjadOyBh9jbw5EV0yzAp2mhazixc661ahs+T9PIG2 PLxkwjYXNKIM7s/70lnmsJ6WXvH8uJuhEARVWaFT4vFEvklLelKE8IPxtg2ZlI3gWFrm WLZJK2MpAbAObHMb4Zc+gAO/fwqAEfWJaGvKTCbie4uhrbeJl0J8pMdvZBKF8ZOaLOct J5WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OvVirUwva7iitmCWZI9gOg8g2CWki9PsaWOed+nTpOU=; b=R1ITWPZcMUgXIBieaacELWFCwUbFw1ORUavMulh6p99b+Wr3jeROYloYxEA5AEgghE MsSw0UvEA/5T9Ziev5MEAWVvW52+KvvbdjkMphyYWSDRcRcFz+37lV2aM4HJzhn9txrC Rt3B1oKo1zAm9e3/JZI5oeOp+08hld5J+YlQfdnzELTtj4WlDW6ytiOOS71MyNFLnumY raBCaSKVuvkUa9y11WR7eQOKlx+Dfg/RmnAK/9JQTx6ohIeS+OHQPQ10N3I8Rb4AJlkj f8gPzt/C9XfIjc4Z01BjURm71+18WyW9tVR5qupRZ+0ve5rLN3Lzho5w+IzyuKbVmttz fy2g== X-Gm-Message-State: AJIora90DntX7jqRhZ4qtjPwSPo+zGdqyN93qdKWiIIvO74C1ur8INH7 sb0oVQTC6xWf8UV35NG3/d+yGMZpghXHlg== X-Google-Smtp-Source: AGRyM1sH1quS5prsBUI9o3IRDsm8cA8ZRJf5b7TYuFSboXNv9OrkXcNXF6d6uc0XJRCyRVNDWZAZfg== X-Received: by 2002:a17:902:d483:b0:16d:6d17:1695 with SMTP id c3-20020a170902d48300b0016d6d171695mr20600840plg.73.1659022992223; Thu, 28 Jul 2022 08:43:12 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id q17-20020aa78431000000b0052badc0f3d7sm947704pfn.50.2022.07.28.08.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 08:43:11 -0700 (PDT) Date: Thu, 28 Jul 2022 15:43:07 +0000 From: Sean Christopherson To: Michael Roth Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Tom Lendacky Subject: Re: Possible 5.19 regression for systems with 52-bit physical address support Message-ID: References: <20220728134430.ulykdplp6fxgkyiw@amd.com> <20220728135320.6u7rmejkuqhy4mhr@amd.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 Thu, Jul 28, 2022, Sean Christopherson wrote: > On Thu, Jul 28, 2022, Michael Roth wrote: > > On Thu, Jul 28, 2022 at 08:44:30AM -0500, Michael Roth wrote: > Different approach. To fix the bug with enable_mmio_caching not being set back to > true when a vendor-specific mask allows caching, I believe the below will do the > trick. ... > diff --git a/arch/x86/kvm/mmu/spte.c b/arch/x86/kvm/mmu/spte.c > index 7314d27d57a4..a57add994b8d 100644 > --- a/arch/x86/kvm/mmu/spte.c > +++ b/arch/x86/kvm/mmu/spte.c > @@ -19,8 +19,9 @@ > #include > #include > > -bool __read_mostly enable_mmio_caching = true; > -module_param_named(mmio_caching, enable_mmio_caching, bool, 0444); > +bool __read_mostly enable_mmio_caching; > +static bool __read_mostly __enable_mmio_caching = true; > +module_param_named(mmio_caching, __enable_mmio_caching, bool, 0444); > > u64 __read_mostly shadow_host_writable_mask; > u64 __read_mostly shadow_mmu_writable_mask; > @@ -340,6 +341,8 @@ void kvm_mmu_set_mmio_spte_mask(u64 mmio_value, u64 mmio_mask, u64 access_mask) > BUG_ON((u64)(unsigned)access_mask != access_mask); > WARN_ON(mmio_value & shadow_nonpresent_or_rsvd_lower_gfn_mask); > > + enable_mmio_caching = __enable_mmio_caching; This isn't ideal as the value used by KVM won't be reflected in the module param. The basic approach is sound, but KVM should snapshot the original value of the module param and "reset" to that. > + > if (!enable_mmio_caching) > mmio_value = 0; > >