From nobody Sat Feb 7 21:24:00 2026 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 7E2D7EB64DB for ; Sun, 18 Jun 2023 00:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232011AbjFRAJS (ORCPT ); Sat, 17 Jun 2023 20:09:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbjFRAJP (ORCPT ); Sat, 17 Jun 2023 20:09:15 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F9A9170E for ; Sat, 17 Jun 2023 17:09:14 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id d9443c01a7336-1b5035b777aso9119225ad.1 for ; Sat, 17 Jun 2023 17:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687046953; x=1689638953; h=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=VS80TIN3Apx7Lv9ngje3zYu1jx02+rpCr9yV1s94q+g=; b=qsV0MFwzdd4/C7i0HHJ9CBkbmMVR7hwOd2cmA+0KzTHzNh9ELEVms5TTB/4dzHUDyy gGGdEsHTFl85eB0vuIJz6s3e58HYKqZmv2eJfSw+XXEzHrnK15RPIln+eN/w3Mzlec61 nqju5F/mk+3B7UGborz8J3MyzvFeWabttyLOn3D+a0ziu6+Xt2aVdnvkedR5h4IlvrhX Y3FuKXEauGt+lxIdBa18cGzxxXjmubFYp/Y+G3XWoTZOCVdaFMpsjXlNOe1u6FIM6l0U DxJKRaifxq5yPP+xvMAo0t85Tci89KUCc436mq+go+r+m0TnblxwU7rIG/1LtDaTjYR9 hoBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687046953; x=1689638953; h=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=VS80TIN3Apx7Lv9ngje3zYu1jx02+rpCr9yV1s94q+g=; b=jSYLplYCRRDBNjdJ2NIMx3QhF+B+00xTU1grsJaEgwEel4FxNqGx6M6Qko60OaL3gz OKoMXujHIFxYbY3MCwI70alcLsinm6by87orKLxEyQZqDOEOMX+HzYJEAMHVTw7FWSrq gZSbbOcEWvhMOO7Z8T7A9h34vq5VWSvDgWYMmNAeFbPER/jRgKFI+Jz3z9F54pwHg7Zq iyEg84iKtDZ7o+gl985HNQH98l9URECOQbkTUap+cyqFKj7B8nKPsRfYGua6UtCHDM9R +70iF7bkOT8D6w0DxEIsk87Dsf7uHbc51CQpzYA1CJ1sS62aQIMmTSyr1v4bH8ycAT8Y zADg== X-Gm-Message-State: AC+VfDwr/aQi06rX7Z5B5P+Gl8qzQkljiNuLWSWEa/oftIOv1CL2WIXz A7HHsTMTkjTy62kC9n0FNSodSoFrb1CY X-Google-Smtp-Source: ACHHUZ7FUaWe91QusDNXC7G8USu5P3g7Xm5fFQ3geWg+aIW+9MIzFHs89tza+DkgLMXcq6FDjqk2LCkqQA35 X-Received: from mizhang-super.c.googlers.com ([34.105.13.176]) (user=mizhang job=sendgmr) by 2002:a63:ed06:0:b0:546:a389:b815 with SMTP id d6-20020a63ed06000000b00546a389b815mr385438pgi.1.1687046953388; Sat, 17 Jun 2023 17:09:13 -0700 (PDT) Reply-To: Mingwei Zhang Date: Sun, 18 Jun 2023 00:08:51 +0000 In-Reply-To: <20230618000856.1714902-1-mizhang@google.com> Mime-Version: 1.0 References: <20230618000856.1714902-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230618000856.1714902-2-mizhang@google.com> Subject: [PATCH 1/6] KVM: Documentation: Add the missing guest_mode in kvm_mmu_page_role From: Mingwei Zhang To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Mingwei Zhang , Jim Mattson , David Matlack , Ben Gardon Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add the missing guest_mode in kvm_mmu_page_role description. guest_mode tells KVM whether a shadow page is used for the L1 or an L2. Update the missing field in documentation. Signed-off-by: Mingwei Zhang Reviewed-by: Kai Huang --- Documentation/virt/kvm/x86/mmu.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x8= 6/mmu.rst index 8364afa228ec..561efa8ec7d7 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -202,6 +202,8 @@ Shadow pages contain the following information: Is 1 if the MMU instance cannot use A/D bits. EPT did not have A/D bits before Haswell; shadow EPT page tables also cannot use A/D bits if the L1 hypervisor does not enable them. + role.guest_mode: + Indicates the shadow page is created for a nested guest. role.passthrough: The page is not backed by a guest page table, but its first entry points to one. This is set if NPT uses 5-level page tables (host --=20 2.41.0.162.gfafddb0af9-goog From nobody Sat Feb 7 21:24:00 2026 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 5E695EB64DD for ; Sun, 18 Jun 2023 00:09:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233145AbjFRAJV (ORCPT ); Sat, 17 Jun 2023 20:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbjFRAJQ (ORCPT ); Sat, 17 Jun 2023 20:09:16 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB2E170E for ; Sat, 17 Jun 2023 17:09:15 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-53f44c25595so1035597a12.2 for ; Sat, 17 Jun 2023 17:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687046955; x=1689638955; h=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=v4DzIL/JVZchPV22EuNnJq/QdjxEQvSn2xrLtsDRw40=; b=WKB50UB0Mn3hH19NA/nQXNn4+OgIolVAiUqkFQCburr0Gk5bLVcJO0ERA6DsplScVO WGEXmbbUibqWtYGZd/7OQuoboJiIH++5nwxAZhSzT2C5EODsSvMTVefqmDd/hdpkwTSr jYBWaRY187nNjecdriEmiPHoWRRnGcXXaq7lMlwvT6OLaue5uK8YDrV79FP7A2WZC5nu kkEuqmmCQCaEbpEzi41NNFDBXqa38/4Dfg1teK1ACDBuvQJ4vdYkgC+HQVvrHff9cKF6 tOerjifpAymfFex7td0LJ/dIrHdApOXgD8DDzUW2NwwDCEeBXY6/AL3fLfAj8nbo+0BU aMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687046955; x=1689638955; h=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=v4DzIL/JVZchPV22EuNnJq/QdjxEQvSn2xrLtsDRw40=; b=dt4SO4SQRFGHNuVGuMpfo1Cjnciiz/0Wfv5FfnibzjtJ44R4x4OQhQ+sAlBq5jxqL4 3u07lWgrcVXu++YK6tvXsrps90qWT6j9ko2RhoTSj8MXHmWFMbWkTh/Gz6yrAUW+qYUJ p0i6Et6cg5Pv7cE2arL34SMM74FAPSWN0VwrOHwpr5fhUY9aoH/x0mqgSnctJ1+2YUQh hjxO50p+DvargltDMiglPY01Ws965JO1wFiSlJGtMxrWHhXojmL+O/YMXkI8t/xo/0Jt fwXKtQ9JYa1ura8EdY6Ly2ejz5D3ExyMBd3TJmFt/WRFyoc2jQiIsxCSxjpDg/wrm24c KrkQ== X-Gm-Message-State: AC+VfDxQeCyLQFYDBD2kRpvwSKn8kexgEno+FqVOzW4g1W0pBe3Y3zMS Z6NbYn3RDWuQvG8xBGe7/JnNhqpzVx57 X-Google-Smtp-Source: ACHHUZ6FM2shHdCtG4zHIoAoYPcYeJUqWXPelrDHcsq7bWlSJsIKfktBJmeYwjBAYAOYW9Saw4A54qRqqhhh X-Received: from mizhang-super.c.googlers.com ([34.105.13.176]) (user=mizhang job=sendgmr) by 2002:a63:83c1:0:b0:553:3ba2:f36 with SMTP id h184-20020a6383c1000000b005533ba20f36mr417311pge.9.1687046955292; Sat, 17 Jun 2023 17:09:15 -0700 (PDT) Reply-To: Mingwei Zhang Date: Sun, 18 Jun 2023 00:08:52 +0000 In-Reply-To: <20230618000856.1714902-1-mizhang@google.com> Mime-Version: 1.0 References: <20230618000856.1714902-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230618000856.1714902-3-mizhang@google.com> Subject: [PATCH 2/6] KVM: Documentation: Update the field name gfns in kvm_mmu_page From: Mingwei Zhang To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Mingwei Zhang , Jim Mattson , David Matlack , Ben Gardon Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update the 'gfns' in kvm_mmu_page to 'shadowed_translation'to be consistent with the code. The more detailed description of 'shadowed_translation' is already inlined in the data structure definition, so no need to duplicate the text but simply just update the name. Signed-off-by: Mingwei Zhang Reviewed-by: Kai Huang --- Documentation/virt/kvm/x86/mmu.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x8= 6/mmu.rst index 561efa8ec7d7..149dd3cba48f 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -221,7 +221,7 @@ Shadow pages contain the following information: at __pa(sp2->spt). sp2 will point back at sp1 through parent_pte. The spt array forms a DAG structure with the shadow page as a node, and guest pages as leaves. - gfns: + shadowed_translation: An array of 512 guest frame numbers, one for each present pte. Used to perform a reverse map from a pte to a gfn. When role.direct is set, any element of this array can be calculated from the gfn field when used, = in --=20 2.41.0.162.gfafddb0af9-goog From nobody Sat Feb 7 21:24:00 2026 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 80671C0015E for ; Sun, 18 Jun 2023 00:09:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233580AbjFRAJY (ORCPT ); Sat, 17 Jun 2023 20:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232271AbjFRAJT (ORCPT ); Sat, 17 Jun 2023 20:09:19 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0496170E for ; Sat, 17 Jun 2023 17:09:17 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id d2e1a72fcca58-666ecb21fb8so1228893b3a.1 for ; Sat, 17 Jun 2023 17:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687046957; x=1689638957; h=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=SWUWH2lvAYfFJm9Hx/6bdaK1OOQ3GRc/IjgAVTyvQ3A=; b=30sbRvHSEui1YuUerrYqr2XHk9jphndeiTUEpOhR4E/MjyMQ1vFoouVxAiTi+cWC2b z68RRVMYzKkyMcAJOFe9blpf8xgZ8aCKYV/bLeBkqCGnAYyF+I2DklMOG9N1+BvZnfdu wfyveTLvxnSK7i5/yPlXLgYGxmgdAxy6dmsWfAy3EwaEkNPHPb39w1nH1Vs6X+W0iXFC BQ7C5nEuqvgBVkKP7Sfb/2gv7rR5lbOsr+lTA9UnW0phq1AzQFgGDzruoKEnJsqowt8e v80Te8LKsZJf0Fvy4Y4zuIkUzFA+UHI/AsSBvfilqKtD4FLzAZAWaSxbeOOFjebG9hn/ PdVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687046957; x=1689638957; h=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=SWUWH2lvAYfFJm9Hx/6bdaK1OOQ3GRc/IjgAVTyvQ3A=; b=jhb8Uj1x9jNWRnVR1FYg6g3R0FD/vL4aQUX5K2bYD/FZUfK3HjaUzQ9e1J2FuciDSD 4XlYuyGZvLPydtnk4ta8rnZx/cCHY25GMlPKe3ZzdLFQ4twA/PptMxOWCl7o9bZBs1Yg CbLRGQsz0u5zN8WkYded6oYCTlixmrXL9nXUHcop6K/hX1PSMWhKdZ4c+xr3tSgLNCmC izl7d0nUb6HSSVJ2UDlIGcyp0FdZ+O4vsHWCNYN7oKI74dP1OSLDmFiulDNUUyuE7hJY eTM3ti88SldWFgE36yc7CwCXBijfCCM5/Jwgmi0aXn4rwHBwnVzgrPckjh7M7XVdgaBI HYKg== X-Gm-Message-State: AC+VfDwNb0wyU5dYZwSOkXdH8HvUGj98qjwyATnhqlnkkOzPsQ7J2oLM ggPnD8DuvI2gtuCtmJkrsu/lO+Gex74M X-Google-Smtp-Source: ACHHUZ79mIcs2IxhJoFUUkYrk9X7TD65uocd+N5bEK1pWUIg35JWl817ZPlg6BzzlYKbhgPk/Fly8vAOJETY X-Received: from mizhang-super.c.googlers.com ([34.105.13.176]) (user=mizhang job=sendgmr) by 2002:a05:6a00:1789:b0:643:a542:b311 with SMTP id s9-20020a056a00178900b00643a542b311mr1764182pfg.0.1687046957241; Sat, 17 Jun 2023 17:09:17 -0700 (PDT) Reply-To: Mingwei Zhang Date: Sun, 18 Jun 2023 00:08:53 +0000 In-Reply-To: <20230618000856.1714902-1-mizhang@google.com> Mime-Version: 1.0 References: <20230618000856.1714902-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230618000856.1714902-4-mizhang@google.com> Subject: [PATCH 3/6] KVM: Documentation: Add the missing ptep in kvm_mmu_page From: Mingwei Zhang To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Mingwei Zhang , Jim Mattson , David Matlack , Ben Gardon Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add the missing ptep in kvm_mmu_page description. ptep is used when TDP MMU is enabled and it shares the storage with parent_ptes. Update the doc to help readers to get up-to-date info. Signed-off-by: Mingwei Zhang --- Documentation/virt/kvm/x86/mmu.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x8= 6/mmu.rst index 149dd3cba48f..36bfe0fe02bb 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -236,6 +236,10 @@ Shadow pages contain the following information: parent_ptes points at this single spte, otherwise, there exists multip= le sptes pointing at this page and (parent_ptes & ~0x1) points at a data structure with a list of parent sptes. + ptep: + Pointer to the parent spte when TDP MMU is enabled. In TDP MMU, each + shadow page will have at most one parent. Note that this field is a + union with parent_ptes. unsync: If true, then the translations in this page may not match the guest's translation. This is equivalent to the state of the tlb when a pte is --=20 2.41.0.162.gfafddb0af9-goog From nobody Sat Feb 7 21:24:00 2026 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 DE262EB64DC for ; Sun, 18 Jun 2023 00:09:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234447AbjFRAJ1 (ORCPT ); Sat, 17 Jun 2023 20:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232536AbjFRAJU (ORCPT ); Sat, 17 Jun 2023 20:09:20 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89731170F for ; Sat, 17 Jun 2023 17:09:19 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-53f84f75bf4so1024978a12.3 for ; Sat, 17 Jun 2023 17:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687046959; x=1689638959; h=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=SZRhH39sdwsf6mf7jmU2xtyZAtu6JfAYC83IgKKrw3g=; b=yKkIRX0QpeQIZE1DidVGEAYWTGzy1a7kdjPPYLn8eK2kTitM+zJT9u6VA55WaqmtV6 pWHjiKIuMZWbo2Pnap/dtOis3oRHJicAz7uD3wD5V/AnkB+f30edVXETNO//NaRsMPv0 k/E+3VFdUlcad6EjHg+NVkBMrG8YirRZjg8CNYDb5HsmaTFw8gxIHruDw+7xEj5a/N9b s5WHerxEKQKPsUwVjAKK/8YaGjoM7Q8orVuDn+mfc8+Hw4YWUMIAnvwn2u9CkSdrJgFI sI+/eW+ixsQaT0cz+EHG9Hcon8LeQaDmkuRhNbgFglelLp5mNWJKezlzTzT9vI5/yjsC 68sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687046959; x=1689638959; h=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=SZRhH39sdwsf6mf7jmU2xtyZAtu6JfAYC83IgKKrw3g=; b=H+Jhak1Svc7yzEQsJMUu2ec7lIWJdO6j5CvjmPBOB9DAMnLIPfgCbLb2tqppYZFzrO 3TVib8HkR6abfw6K20tvxm8EoyJAA6YFn2eKSXJyRhaPPCdSlVEYZ2SdLJTj9wZJPTY9 edmXPf84ZCgDT0E0arc3G0YliRdnbxToUfhc2n2VbO+oHAoeS2597RNucHL0ztiDGwqc FfqF8cdhp92qPOPChMTu1YVpQQ65WsUf1ldkAaFbjK9RDZxcmR7tJmz5Vx+96aauidvY 0aQwUh46sRox6scDioMlvSkQnQvx0saDCgTJOR53Tya/h47o6yJuEiIx8ENBbqRuIYoj bF5A== X-Gm-Message-State: AC+VfDw86iPCAZ1H7HJvEVdbnzQN82yDaoo+FCJ/MjAkgioWUuZdhbY7 Jq6Q6R0VLP9kwDNGS4zA+xeRjWwoLsbj X-Google-Smtp-Source: ACHHUZ6s/0SDgBjDHb7lnw7v17wR8UYblxJ4u12S9rHeLlYYijB1xGLNmU6+VDed2EOc0mlXhPDl+/6YPoZi X-Received: from mizhang-super.c.googlers.com ([35.247.89.60]) (user=mizhang job=sendgmr) by 2002:a63:782:0:b0:517:ce37:756e with SMTP id 124-20020a630782000000b00517ce37756emr406250pgh.7.1687046959115; Sat, 17 Jun 2023 17:09:19 -0700 (PDT) Reply-To: Mingwei Zhang Date: Sun, 18 Jun 2023 00:08:54 +0000 In-Reply-To: <20230618000856.1714902-1-mizhang@google.com> Mime-Version: 1.0 References: <20230618000856.1714902-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230618000856.1714902-5-mizhang@google.com> Subject: [PATCH 4/6] KVM: Documentation: Add the missing tdp_mmu_root_count into kvm_mmu_page From: Mingwei Zhang To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Mingwei Zhang , Jim Mattson , David Matlack , Ben Gardon Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add tdp_mmu_root_count into kvm_mmu_page description. tdp_mmu_root_count is an atomic counter used only in TDP MMU. Its usage and meaning is slightly different with root_counter in shadow MMU. Update the doc. Signed-off-by: Mingwei Zhang --- Documentation/virt/kvm/x86/mmu.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x8= 6/mmu.rst index 36bfe0fe02bb..3dce2426ad6d 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -230,6 +230,12 @@ Shadow pages contain the following information: A counter keeping track of how many hardware registers (guest cr3 or pdptrs) are now pointing at the page. While this counter is nonzero, = the page cannot be destroyed. See role.invalid. + tdp_mmu_root_count: + An atomic reference counter in TDP MMU that allows for parallel + accesses. Accessing the page requires lifting the counter value. The + initial value is set as 2 indicating one reference from vCPU and one + from TDP MMU itself. While this counter is nonzero, the page cannot be + destroyed. Note this field is a union with root_count. parent_ptes: The reverse mapping for the pte/ptes pointing at this page's spt. If parent_ptes bit 0 is zero, only one spte points at this page and --=20 2.41.0.162.gfafddb0af9-goog From nobody Sat Feb 7 21:24:00 2026 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 29698EB64D9 for ; Sun, 18 Jun 2023 00:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231290AbjFRAJb (ORCPT ); Sat, 17 Jun 2023 20:09:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbjFRAJW (ORCPT ); Sat, 17 Jun 2023 20:09:22 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E1521715 for ; Sat, 17 Jun 2023 17:09:21 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id 98e67ed59e1d1-25e89d51bf2so954846a91.0 for ; Sat, 17 Jun 2023 17:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687046960; x=1689638960; h=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=kxL2IQh8QsyzT6M8Esvdn0S5tsYGjEEcYbokMBIJOOA=; b=zAN4yl/yAf39StZnUGptrfSOQsv6LlI7o2HkFCAMqcoRQjjCgZ3r19ALi5wJn9JDPy u6bIXwRmOwOC838v8rtUVWtWyBTAhG48OwwangQhrI26phyUC36Mvw7FPmof3d4i8thI HskS9RE2wxly89AwCkzpOj3R7prtSydMxkqZ+ZJoQqCLhsVvoRJvCeU+kw56/h1Tq95V 7xTx0H2mqfVUQNCwvin9J+4qUr0oZUX9SHG46zY+WPcusQv2dEzJTLeI1M/Uezu0MucY L0UArTP0fH+mSE7lERHIcQo2OODhzgmX1Azw0C2c/LZKL+qteyd4lSCgMSMmgLFAuRQz TPMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687046960; x=1689638960; h=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=kxL2IQh8QsyzT6M8Esvdn0S5tsYGjEEcYbokMBIJOOA=; b=e8V4GWiODzNCxvtIYfHozOaCNaSunfr9yFN6YT+EIOu59SkObewqDsR7vc81lzxdue 4hnTnUW86mbYRB0PFAJgRrKqTUVGtJ9Js/Tzy7R77jkCB5t/CdMyKMWvN9kkkdACuYkU Woil14VVURJ2yig/c7UTGO0BL30ztjdGYQPUpD+rlvBGqyzRcs1jgEie7iFz3ljungxv BgDJvojlzH2VDVcTsvwIoT2MayuXYXAkTUSIMBeGLuVktEpaHAlmzkic+OYQS9X50yl5 /XFbBCcNsOvrNzbd27cOKfykGwSJJNc43mn1JYITIoOj4UlK1iEm27xQDfP9w/SF9HKd lt2A== X-Gm-Message-State: AC+VfDwvTpihndxAD6OIIpZIOopQNPKsggGblthVZI+yMNMM7Dt97JO5 29cumViPryLj1sXFAjlrLcZWrPKR0Sgv X-Google-Smtp-Source: ACHHUZ667rmHgnnVMFyiOS98UlXH2hDjVOn68VnJ+dNKWA2D/uGC0vcKPrekHRymKGd05CoJKmuP1cPxyqdg X-Received: from mizhang-super.c.googlers.com ([35.247.89.60]) (user=mizhang job=sendgmr) by 2002:a05:6a00:1a15:b0:654:8eb9:4607 with SMTP id g21-20020a056a001a1500b006548eb94607mr1818385pfv.4.1687046960661; Sat, 17 Jun 2023 17:09:20 -0700 (PDT) Reply-To: Mingwei Zhang Date: Sun, 18 Jun 2023 00:08:55 +0000 In-Reply-To: <20230618000856.1714902-1-mizhang@google.com> Mime-Version: 1.0 References: <20230618000856.1714902-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230618000856.1714902-6-mizhang@google.com> Subject: [PATCH 5/6] KVM: Documentation: Add the missing mmu_valid_gen into kvm_mmu_page From: Mingwei Zhang To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Mingwei Zhang , Jim Mattson , David Matlack , Ben Gardon Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add mmu_valid_gen into kvm_mmu_page description. mmu_valid_gen is used in shadow MMU for fast zapping. Update the doc to reflect that. Signed-off-by: Mingwei Zhang Reviewed-by: Kai Huang --- Documentation/virt/kvm/x86/mmu.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x8= 6/mmu.rst index 3dce2426ad6d..0dbdb7fb8cc6 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -208,6 +208,10 @@ Shadow pages contain the following information: The page is not backed by a guest page table, but its first entry points to one. This is set if NPT uses 5-level page tables (host CR4.LA57=3D1) and is shadowing L1's 4-level NPT (L1 CR4.LA57=3D1). + mmu_valid_gen: + Used by comparing against kvm->arch.mmu_valid_gen to check whether the + shadow page is obsolete thus a convenient variable for fast zapping. + Note that TDP MMU does not use mmu_valid_gen. gfn: Either the guest page table containing the translations shadowed by th= is page, or the base page frame for linear translations. See role.direct. --=20 2.41.0.162.gfafddb0af9-goog From nobody Sat Feb 7 21:24:00 2026 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 56666EB64D9 for ; Sun, 18 Jun 2023 00:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234988AbjFRAJe (ORCPT ); Sat, 17 Jun 2023 20:09:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233745AbjFRAJZ (ORCPT ); Sat, 17 Jun 2023 20:09:25 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 330171729 for ; Sat, 17 Jun 2023 17:09:23 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id 41be03b00d2f7-53ba38cf091so1719407a12.1 for ; Sat, 17 Jun 2023 17:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687046962; x=1689638962; h=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=1VCe6Te4dbtLGKgb4rOHMky/xQ+L+u4Ve7fRkEOuWfM=; b=eM6eEMdeAdA3q12h/4zPiNDSyzDv6iURF6JeeAlS92vFN138+Ea57eUPBYKXB/1hSK LO+sRsz7LswUmxtY2fR1MXtZ5ODEii85FISwNsl00srPgkpT+xOgRzsXGZenLTovEC4K 5bCdZnpVEh3xw/+QxJve/qwSzVD1fa3TqfhTUHfYi7y0bg4vv9JGAYAycx//ck2bTtEa x0mjE8f8m8SfrfLilZa2KalRke5BniQVDR2ujyq/cZrSDYm/79+HVziX7w7RrRTnHlXw fYE6FC2kIKP7Hw3VUVpp7d1JE/EkJAqrZYwsEiLJj6sx6zDZWhNU/Od3Bkmt9PNwwxke +F7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687046962; x=1689638962; h=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=1VCe6Te4dbtLGKgb4rOHMky/xQ+L+u4Ve7fRkEOuWfM=; b=Y/BgNvZ2jkywqC3JQ65RXWKbAPVp1F3QsuQHAwhdMEqjSfSVomScXnLmxCqQEMqFZK 9dBzD3ZI/GeYYc2OID9tBvK5Uo4lfOZkFrJHknkrQ4/UG0hBGmQVZC6JqgRpE5aJEerK yMItkcHJTI7vBGnWXWYX4ZU2ZGz/ygQTdLAQFOSo29MSsjzzAIim2jU3Ks3GKZJ4YJz3 +Ls+rMsML7z0BuYeHP7LWpsz2FGAV6XNxMQPo/tiAuauZOc8rVapa1qLjsj0GqoZB53R UYYKMTrPM7TpY931Ym8svVPLd+500lqJYo93uORUC85JuttnGqw+iht3U3ovbA5tuW9u bpAQ== X-Gm-Message-State: AC+VfDwq7Zxn/NOiQQTD/WfeJ5CTYfYzVIVLTOwEZB0/11BKzgfTsWte 2mMsQQxhQiGIXYEpBg2+T+fY6/FTreie X-Google-Smtp-Source: ACHHUZ587n83fnu4WPNdcoRuCpjN8gdiXgApo0KsiKTF4x3Syc0S5oMmIS04y4PImd7mWuJ5Od9KbFTaOwBX X-Received: from mizhang-super.c.googlers.com ([35.247.89.60]) (user=mizhang job=sendgmr) by 2002:a17:902:e88b:b0:1a8:1f4:2d50 with SMTP id w11-20020a170902e88b00b001a801f42d50mr1222628plg.4.1687046962586; Sat, 17 Jun 2023 17:09:22 -0700 (PDT) Reply-To: Mingwei Zhang Date: Sun, 18 Jun 2023 00:08:56 +0000 In-Reply-To: <20230618000856.1714902-1-mizhang@google.com> Mime-Version: 1.0 References: <20230618000856.1714902-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230618000856.1714902-7-mizhang@google.com> Subject: [PATCH 6/6] KVM: Documentation: Add the missing tdp_mmu_page into kvm_mmu_page From: Mingwei Zhang To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Mingwei Zhang , Jim Mattson , David Matlack , Ben Gardon Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add tdp_mmu_page into kvm_mmu_page description. tdp_mmu_page is a field to differentiate shadow pages from TDP MMU and non-TDP MMU. When TDP MMU is enabled, sp->tdp_mmu_page=3D1 indicates a shadow page for L1, while sp->tdp_mmu_page=3D0 indicates a shadow page for an L2. When TDP MMU is disabled, sp->tdp_mmu_page is always 0. So update the doc to reflect the information. Signed-off-by: Mingwei Zhang --- Documentation/virt/kvm/x86/mmu.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x8= 6/mmu.rst index 0dbdb7fb8cc6..cbad49c37629 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -277,6 +277,10 @@ Shadow pages contain the following information: since the last time the page table was actually used; if emulation is triggered too frequently on this page, KVM will unmap the page to avoid emulation in the future. + tdp_mmu_page: + Is 1 if the shadow page is a TDP MMU page. When TDP MMU is disabled, + this field is always 0. + =20 Reverse map =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 2.41.0.162.gfafddb0af9-goog