Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1419488rdh; Fri, 27 Oct 2023 13:50:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHC05AE3cmy94zGA7ig5W/LemJx5jVJ6cIrTJqbEkAY5hwK4EBXVI1MlpEPX/JyKSaOHIez X-Received: by 2002:a17:90a:1a0b:b0:280:1022:f00e with SMTP id 11-20020a17090a1a0b00b002801022f00emr2352678pjk.29.1698439803962; Fri, 27 Oct 2023 13:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698439803; cv=none; d=google.com; s=arc-20160816; b=wZoFQYJx0okk8/tdQE5eZZoECVCPu7pHqv6l/LPsCJCuYVd3XsdE5EsNlNsQW7LBGn KcckwIKFV8lN1Jf65CXoLKaQRE/4nSUbr3YPYn579FosaEJpiXmSbPPX4jLxwhJoka87 ImhZh0cuWMDM53Zib3IQeJ1szOuHSPqwB99W5gvS4yBbZEmnK0xgI3ePjYoo7JSkLzsy cz7DnIRx1rei0bnb7/hvmj87eFVrNTWQ1712REtgYaX2NeDJv9J32344ffMJcgP5n63D UkjHc4OWf7OaTMHnNTZVLO/BAYKGYor0oeiKELy1jld4ca7PBFy8TgSHOvxdEd9aoPzB 0nWg== 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:from:subject :message-id:references:mime-version:in-reply-to:date:reply-to :dkim-signature; bh=o0CV1M/k92Q3xvDsogLi4g0xsgOAA/CC5ii4d683MKg=; fh=dogxdQWc7Q2U5Ekp9F18wEHwMgE3kRwQ/60KgTj3654=; b=I3qbVMSARh0HmYyT4rgyU7mOpD1e6zZ7IS7xs3d02WsJZZ7WKixMP68vYr9G+py3TE xzuSFSf+38STl5/7fpIsRaU12BV9z7shmTdifOwFdaw4lL7OB0kHh5zle4dNbLWFLF+0 Jh9pSOF9ky+max/8W41OxgBDbYFHwS+KwmqArG1pxO8oKwz0ZQIfG2IUt1OqdvUTr/ES lGT7/X0Rni2SV76xlcr1F88WMjtnKuZFlj8zHfOGTxX1LUijY5agV6wL46hmwx/7Ue4D otqfd/XNZIfTcjIHy+GU2hqlTvFYVf6nQyVLfUh6eTGQ4zxOPQlPYbsQAPkggs0WTlaS Qzkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CtvkMEik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id fz24-20020a17090b025800b0027920d6f859si977416pjb.107.2023.10.27.13.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 13:50:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CtvkMEik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 63B8980AB1EC; Fri, 27 Oct 2023 13:50:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346593AbjJ0Uty (ORCPT + 99 others); Fri, 27 Oct 2023 16:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346543AbjJ0Uts (ORCPT ); Fri, 27 Oct 2023 16:49:48 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7E67D55 for ; Fri, 27 Oct 2023 13:49:45 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5ae5b12227fso22076817b3.0 for ; Fri, 27 Oct 2023 13:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698439784; x=1699044584; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:from:to:cc:subject:date :message-id:reply-to; bh=o0CV1M/k92Q3xvDsogLi4g0xsgOAA/CC5ii4d683MKg=; b=CtvkMEikP2CIqXDhyruQ08qAT0RVSGGx25ICdO8QSDKBv2JOk+PKxIbL1FTVI/8gdo 9dZUehrz3Ary66ADg2Ex4PRIYexOybRjAepWK3l2gAB094BOUvqQ1Ot3HQEkKz8SylbF 3dmFmTevGZmk/j9k93r/A3atGjTY/81nWnYhLlUHuymiqcQ2yBe16SJBK97nuqhQFNfP JDwe+TW3xmHs+3c2hIBZoLP0oFr49561MErFATbCQdSherQ6zKDrwcuBq1PckJspJVDA sJ/xcF1IXv9NbADE5OUZG1LY/L+Umn3gS2tB3Zon+C1yFMeJ8eSNBIzgOjRRAL0wlhtZ bdVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698439784; x=1699044584; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=o0CV1M/k92Q3xvDsogLi4g0xsgOAA/CC5ii4d683MKg=; b=X385voY3O0xNZyGG7vWANO+fJQ2gp1Pzb10W2h31IvzZ6d/8zeY5HSfiPBev07OaFe ILP2TdRfDIiwMACXF9Ich5WfrWi78Y/pTgcjR4bACP4WdlUbO36Wwa2cXFEOwLyZw5N9 xyqoizp6Ogrdpd5BOJhpYIYk6kx3WM0SBEIN0rWp3nzEhbDrkuIlvnizhBD43NUh9cm9 L5kAMDUptDeNNBOzLAioqAKYBs4DE1OGqzNlOSZ1yaKaUbCiqKv8vdLg1MPmbdPiy9D7 NlOVFVX5HOWrMeiEJgzBNBkSLE0cjxWRafxsGF54USd6yRJK23/qo4Yv5a5rwNCSgDe3 q/uA== X-Gm-Message-State: AOJu0YzBmAUWPwRR0sIoVavGyBjskQE4CBlXyl1hMYtyg0OdJhpdZ8x6 lMqHd8V2AUhHy8iAc+N0GyzTL2Swl2I= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:add5:0:b0:d9a:4f4c:961b with SMTP id d21-20020a25add5000000b00d9a4f4c961bmr70045ybe.1.1698439784672; Fri, 27 Oct 2023 13:49:44 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 27 Oct 2023 13:49:28 -0700 In-Reply-To: <20231027204933.3651381-1-seanjc@google.com> Mime-Version: 1.0 References: <20231027204933.3651381-1-seanjc@google.com> X-Mailer: git-send-email 2.42.0.820.g83a721a137-goog Message-ID: <20231027204933.3651381-5-seanjc@google.com> Subject: [GIT PULL] KVM: x86: MMU changes for 6.7 From: Sean Christopherson To: Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL 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 (snail.vger.email [0.0.0.0]); Fri, 27 Oct 2023 13:50:02 -0700 (PDT) This is mostly the first half of a series by Yan to optimize KVM's handling= of guest MTRR changes for VMs with non-coherent DMA. Yan had to put more comp= lex changes that actually realize the optimizations on hold, but the patches he= re are all nice cleanups on their own. The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3= : Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux i= nto HEAD (2023-09-23 05:35:55 -0400) are available in the Git repository at: https://github.com/kvm-x86/linux.git tags/kvm-x86-mmu-6.7 for you to fetch changes up to 1de9992f9de0a92b6e11133aba0e2be833c11084: KVM: x86/mmu: Remove unnecessary =E2=80=98NULL=E2=80=99 values from sptep= (2023-10-18 14:34:28 -0700) ---------------------------------------------------------------- KVM x86 MMU changes for 6.7: - Clean up code that deals with honoring guest MTRRs when the VM has non-coherent DMA and host MTRRs are ignored, i.e. EPT is enabled. - Zap EPT entries when non-coherent DMA assignment stops/start to prevent using stale entries with the wrong memtype. - Don't ignore guest PAT for CR0.CD=3D1 && KVM_X86_QUIRK_CD_NW_CLEARED=3Dy= , as there's zero reason to ignore guest PAT if the effective MTRR memtype is= WB. This will also allow for future optimizations of handling guest MTRR upd= ates for VMs with non-coherent DMA and the quirk enabled. - Harden the fast page fault path to guard against encountering an invalid root when walking SPTEs. ---------------------------------------------------------------- Li zeming (1): KVM: x86/mmu: Remove unnecessary =E2=80=98NULL=E2=80=99 values from s= ptep Yan Zhao (5): KVM: x86/mmu: Add helpers to return if KVM honors guest MTRRs KVM: x86/mmu: Zap SPTEs when CR0.CD is toggled iff guest MTRRs are ho= nored KVM: x86/mmu: Zap SPTEs on MTRR update iff guest MTRRs are honored KVM: x86/mmu: Zap KVM TDP when noncoherent DMA assignment starts/stop= s KVM: VMX: drop IPAT in memtype when CD=3D1 for KVM_X86_QUIRK_CD_NW_CL= EARED arch/x86/kvm/mmu.h | 7 +++++++ arch/x86/kvm/mmu/mmu.c | 37 ++++++++++++++++++++++++++----------- arch/x86/kvm/mtrr.c | 2 +- arch/x86/kvm/vmx/vmx.c | 9 +++------ arch/x86/kvm/x86.c | 21 ++++++++++++++++++--- 5 files changed, 55 insertions(+), 21 deletions(-)