From patchwork Tue Aug 1 00:21:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingwei Zhang X-Patchwork-Id: 128943 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2383866vqg; Mon, 31 Jul 2023 19:02:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlHWM7O4MBNbRkX+NydrMy57UpFcE2zXiniKWnPUa18t1Loen6uqEXyL+IZO8E2H4LayIocn X-Received: by 2002:a9d:798c:0:b0:6b7:4cd0:8a1e with SMTP id h12-20020a9d798c000000b006b74cd08a1emr11678263otm.19.1690855357123; Mon, 31 Jul 2023 19:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690855357; cv=none; d=google.com; s=arc-20160816; b=obFv/SEgeOIRBDw7GY6j0IdZmtO1jIMfi4ZxAPgRYiISvLPah0b9EietPrlc9+j6k4 jhbmUBjBPtR1dwSrRpjBDvZOB8dKhO1vvmgeQC+ug0QxL4viGakkPk8uuw9DYXiyQVgs fprhC22Vo5UoT6Pt0byDtKci5Zk2G3O5wjvpJ0FtjPYbhOqgj9PVPjdmuYlVZLgaFJG+ p1WArp5q2RjCeNc9YCQ6H6WkKbkAqyFedSq0b5JUYGr/o0N/2Orj1NNikAkLWdEbDuj4 A5/dD8QOk/EqprQfRqwOJB2cPrVFJ24627pjpfy6kI8wF13PajVFFOR+JA8lNShIwVs2 iqFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=2V2qqbRtJdIF4yKoul1PG5FvBTRojVE4noGz8EUUEGo=; fh=gya5F2cZq9WTAdFit1IlKDHE8FQoHEyxSPkqDAO7wTs=; b=QhTGf3Mtf0yra/LDaAh0sV+RBoxVB/QXBWWpSh4oI3lD51epoxHeSKCM8edAycJicA HdkdbVLLny9i4XhZDd2FxAnmBd13Ex2CH8OfvBGiGdbVysAvpLaV+z2q/34oLmrZeBhn NOXcYF8KiJCIEDpoHBlnNBJQPg+tctWFfJLVFMW7yxanAuTutJvLsT1sxqnpIbKjVOyg CoVmpDlruNvhtkHEfwI/Dr0xUK+dLzJX9yTlKXn8oYmCqhY6JzZr0awr9kkerPeCNhfp ygIEKfHLOtc2c4q+4JN7RaChe917dT48xeTlqJ+Y3p8AuELxvP0FLK/J3ZxQJFozKQl1 dpPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=b4gXIVWX; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n4-20020a635904000000b00553e8d95742si6764583pgb.654.2023.07.31.19.02.24; Mon, 31 Jul 2023 19:02:37 -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=20221208 header.b=b4gXIVWX; 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 S231238AbjHAAVg (ORCPT + 99 others); Mon, 31 Jul 2023 20:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230507AbjHAAVc (ORCPT ); Mon, 31 Jul 2023 20:21:32 -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 211BE19A8 for ; Mon, 31 Jul 2023 17:21:32 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id 41be03b00d2f7-563bcd2cb78so5212138a12.3 for ; Mon, 31 Jul 2023 17:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690849291; x=1691454091; 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=2V2qqbRtJdIF4yKoul1PG5FvBTRojVE4noGz8EUUEGo=; b=b4gXIVWX4cTKAZEBzuS9bcuTAIwnIpR66S3yHkHBzJg6Pqk6/twID1GBjAw9sqMNEe sr8t7BYV6mty7CFn9oOUry++ndP3gel1ZBA8n433pUcnMmtKavpQiAYhxdjtq1zNP+qW A8K77tu+LeGtGiHgEOpdG7tDsHmKWquXFI6tAAxOsBTLMioIR2PHsAOh+VW6BFFxkxcA 9CrK1F/fby5iCi3/bzHMc/edGX33OcDpyrk8Q2FoI/Y4wqcJJHZfuATFIWdUgbI2RS9R GNpOA/tcOK68CMq2+Z/xSUQ1C7Fa6o9a9EpLwQSaxRB1rwWII+JOkwVx5V2Wyx1Ewdl/ ZR7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690849291; x=1691454091; 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=2V2qqbRtJdIF4yKoul1PG5FvBTRojVE4noGz8EUUEGo=; b=CZWTdaEJskame7ElP2QDMNX4C8/cPNbKXqChLh0w9z8GceVNAlZmiZe5+qZacdS8UP avqF+eNt1cD8+vPLvRCpUihLf9cIRwARukDoWTTWbDczMpeQreGdU23Rhk9RhBmzRPfj 96DvyjJTt3ZA8Vn/AQk4g+YtdRY8rCZ20911I531ql09YXi7DrkAL2FAjAz4ZsqKo3Pc v1bDmQhcqVioZUGfIFn2XGTigp0HtCouk9TaVSkZwJsrsL+IPqZgk7pHn9fzglnYzuOU eVxoy8Mn/yDO0f2jtjBHb6jCg2acYbbv9a+hQ5H3sInomW4xVvB64fQh88bLb5kydsUd +bBg== X-Gm-Message-State: ABy/qLawTdIr0OkcGfS2jGxOLxjs1NFauJDY0hRfboA2C8cntn990Qve JurOzwgiPq88IV0GmIXv7BuYtwNhkU+p X-Received: from mizhang-super.c.googlers.com ([34.105.13.176]) (user=mizhang job=sendgmr) by 2002:a63:7e54:0:b0:564:f85:c822 with SMTP id o20-20020a637e54000000b005640f85c822mr66706pgn.8.1690849291659; Mon, 31 Jul 2023 17:21:31 -0700 (PDT) Reply-To: Mingwei Zhang Date: Tue, 1 Aug 2023 00:21:21 +0000 In-Reply-To: <20230801002127.534020-1-mizhang@google.com> Mime-Version: 1.0 References: <20230801002127.534020-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230801002127.534020-2-mizhang@google.com> Subject: [PATCH v3 1/6] KVM: Documentation: Add the missing description for 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 , Kai Huang , Jim Mattson , David Matlack , Ben Gardon , Xu Yilun , Zhi Wang , Randy Dunlap 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,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772990347041847651 X-GMAIL-MSGID: 1772990347041847651 Add the missing description for 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/x86/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 From patchwork Tue Aug 1 00:21:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingwei Zhang X-Patchwork-Id: 128964 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2398795vqg; Mon, 31 Jul 2023 19:44:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlGwf3cQy/oqCBd61LjBoQUH+o6wcmHzgQgLcKQSWuUyk6KgBowW5JnUNieALhX23pJIKI4f X-Received: by 2002:a17:902:e546:b0:1b5:561a:5c9a with SMTP id n6-20020a170902e54600b001b5561a5c9amr11856755plf.39.1690857888700; Mon, 31 Jul 2023 19:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690857888; cv=none; d=google.com; s=arc-20160816; b=N1kQG1MK/T+7nkY+/zgVfkOmkPihkLfjEQkIL7wOtMjUeWsYJtL1OX8AmR1q7NiheN PmDQumuKhrqPa1KCBimkg76DyruOfEZW+5YiJazQTkPwFcSD1y3BmFVyXNGm+JadCOtN 6o1wJ7VTYKSrL6pq18i3dXGluwFytIWdXvUhYtxTnECms9sguNfD24VwCTwBaJWrW5iV 3+NoEha0KmPldB8pcYFmjBhDbWIwieFRGyFnGMOS+EcgMvwDdbS0zii7vMASje4JaqOe nHX+/2AQqRSW4TUgbp07t2YzEWToJHxRnChgsDhLIRgALSEtabiB9AwMgS7x0e7odgb3 M+tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=MiBo42sK/GMXkVAkei5JHweORvWMqcmgUZYS33J6fF0=; fh=gya5F2cZq9WTAdFit1IlKDHE8FQoHEyxSPkqDAO7wTs=; b=e123muBzNZV+dfCauekiYHvQz49wA1KIta4MWvr3Sy3yqrKU8mioKWQQMoaRoPJj27 4rFPnVYo/lyPt/RDVOs1r1U+YcS7N3YR2AeYvd7J7SshSMm1s3LBOT0Rv0M5QcF/ljby T1j3BlXiJke33prggE2HRI62kFELMvy8woA1zN1sZVpCtpJU41Yhr3QZ8kBtmYIjwui/ EjFDzsxP9tgnwb7e6ZiRiVTlXoEBg3ac31oKAybIbNwmlXs4pZhcMH8x7Wm1go/1D75E nkAF0wy5rfHx3jaQXN7dXHHuccOpq90dAtWQWQjC/tAArA+HC0nhyher/3ALJSxz6WOe mxWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=xCOyw96l; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a1709029f8800b001bbd2599ac7si8226373plq.53.2023.07.31.19.44.35; Mon, 31 Jul 2023 19:44:48 -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=20221208 header.b=xCOyw96l; 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 S231350AbjHAAVl (ORCPT + 99 others); Mon, 31 Jul 2023 20:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231243AbjHAAVg (ORCPT ); Mon, 31 Jul 2023 20:21:36 -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 31933199F for ; Mon, 31 Jul 2023 17:21:34 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5704970148dso61350587b3.3 for ; Mon, 31 Jul 2023 17:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690849293; x=1691454093; 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=MiBo42sK/GMXkVAkei5JHweORvWMqcmgUZYS33J6fF0=; b=xCOyw96l+NGIsCoqla91ojMChbo7SK0mxjsBS5En4m6U8FZuat4rWttoEUC2kEUlRC Kc5Tdi3f/aC074kdK9WPVcbpEqFOD5snoJtJRh/GW8NPp7DdzGioQ2jCQ53aKAAMVNgV H5LOLNlPJaayXRR+pgE4o+eqbb3X+xSKM0jo1106+iKscpzsP1EGPa0ydb/aj4FLtxsY 0donlqAlwXUUmCYafnPKmqmI1HPi+8LHmgKCNUbUmu3rVwJ7KhsLSWeNCX/OGzUbsggN aeRLetSPiTZb1U7EoSaftIT6N09FIkj+uoCbe5WsmP3ETqmIpdraN0k9VEsoVBooWVQW kbAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690849293; x=1691454093; 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=MiBo42sK/GMXkVAkei5JHweORvWMqcmgUZYS33J6fF0=; b=fAeug3/AhttJqMB+6N0bVyj0WI+r6HEil6+wOCO1C1E+4ZVpVwM0rCTyKfDhIPGnYl Usid86mNANMbCo5Qys8K1qWOPTbEKcgyoiXY+X6nzjRoopLN0LKUZFzTzHCAMCE0T2Yi iYuCjR7JSxLwXoUFESv2PNAeN7jp+Wlb9Kk6IpNn5BMjloE70jZ+THzhTtbyHQ/RZ4lv 4PghumJ8cOnFHRl60GlOvk4G16EaKe8tC0bAlmAwPTLs6m0RVAO8K7J0l17QKcPUmUuy 0s/5fObTJcmOAlZZmwc5uRq7vulFIejEOxE5CAn338rijqbxNPQwKEIuK6GFNZ4Io1Du QZQw== X-Gm-Message-State: ABy/qLYR5YQcZoTS4TvcG+q+7VDxcgvl16I6gMV6OipY+w3PVO6ykH/M bUehQXrwwAjA8NBsWcSCy5v/fWDRisZd X-Received: from mizhang-super.c.googlers.com ([34.105.13.176]) (user=mizhang job=sendgmr) by 2002:a81:b710:0:b0:576:92da:cd3d with SMTP id v16-20020a81b710000000b0057692dacd3dmr79492ywh.8.1690849293487; Mon, 31 Jul 2023 17:21:33 -0700 (PDT) Reply-To: Mingwei Zhang Date: Tue, 1 Aug 2023 00:21:22 +0000 In-Reply-To: <20230801002127.534020-1-mizhang@google.com> Mime-Version: 1.0 References: <20230801002127.534020-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230801002127.534020-3-mizhang@google.com> Subject: [PATCH v3 2/6] KVM: Documentation: Update the field name gfns and its description 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 , Kai Huang , Jim Mattson , David Matlack , Ben Gardon , Xu Yilun , Zhi Wang , Randy Dunlap 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_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=unavailable 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772993001284874286 X-GMAIL-MSGID: 1772993001284874286 Update the field 'gfns' in kvm_mmu_page to 'shadowed_translation' to be consistent with the code. Also update the corresponding 'gfns' in the comments. 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 names. Signed-off-by: Mingwei Zhang Reviewed-by: Kai Huang --- Documentation/virt/kvm/x86/mmu.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x86/mmu.rst index 561efa8ec7d7..35e642303962 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -221,11 +221,14 @@ 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: - 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 - this case, the array of gfns is not allocated. See role.direct and gfn. + shadowed_translation: + An array of 512 shadow translation entries, one for each present pte. Used + to perform a reverse map from a pte to a gfn as well as its access + permission. When role.direct is set, the shadow_translation array is not + allocated. This is because the gfn contained in any element of this array + can be calculated from the gfn field when used. In addition, when + role.direct is set, KVM does not track access permission for each of the + gfn. See role.direct and gfn. root_count: 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 From patchwork Tue Aug 1 00:21:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingwei Zhang X-Patchwork-Id: 128950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2386159vqg; Mon, 31 Jul 2023 19:07:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlE8fRWnBaqcsmJPV5CjeBfm3rJz7Q0bet/ps16riOIJh4KqIpOWAXANzuUKGUTBczxmXT4A X-Received: by 2002:a05:6a21:4849:b0:117:a2f3:3c93 with SMTP id au9-20020a056a21484900b00117a2f33c93mr10223568pzc.2.1690855678337; Mon, 31 Jul 2023 19:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690855678; cv=none; d=google.com; s=arc-20160816; b=KIG9NOqmvx2Kw9kuNZ62yHvnfDh5Mm5C+yF1LD1gSHH8Sp0W/Wor8LiyLjtRGRkyaJ BgiV84KW3vviJr4ejIA+IVeZt0+2T3tTotnPZx4Y6glvABbhOE2fR3liORQVw9qIS0nP iEXQ447K046124Q1ibYUTry2LTRQiDrOPF+ULOBFowTnRJqqasa21vYcrWVa/cvR8TP5 Bn0jySSWpCjd5GDt5Aslv5Tb+Vhf2zwa1JwhiwYHfWahxUtmCw5sEFquWxfuByGDbR95 GvaO0lHsvWlf7DvBvXSWt5vf1boMUR/UnBOX4GdEHuKGc9CS5cpkAMKq9sfftx780SoF qBQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=X6gKOGhlGB8pLW0DYtQuv9ffBJaXjDy6pmjMuBOFYgg=; fh=gya5F2cZq9WTAdFit1IlKDHE8FQoHEyxSPkqDAO7wTs=; b=lf+Wz4jmhZP4djToVRyl4tktFa82vuBmtRUk6e78CghFj4oGSBZNNuwY6q6tXQIx/I 46iUym/0pyeqHDJHPtjshrZNgrndN44urxtBaE13uQjfps/4x7KCcmv7zAPJNILmm0uY U1ooXWAvUQIpHpvXifjRn1ormTURKHCBiCltn3IngT3xnEbQPFETDAnfXNksI4eOHo3A ZuekaygoxOGo8kNfMGebdpPf8IC+bACPLlxAnYPfPuf2EigdWSPJx3TFKGXkG7S68UkU 2c6ArEirE7oVLIeogjGCaVTkdZkAMuCzyGlAr2YyGf6bpn1GctwT1KU0liDGB4GEfPd8 ANww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=kQoqrjZU; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eg25-20020a056a00801900b00682babd7453si1209964pfb.142.2023.07.31.19.07.45; Mon, 31 Jul 2023 19:07:58 -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=20221208 header.b=kQoqrjZU; 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 S231300AbjHAAVn (ORCPT + 99 others); Mon, 31 Jul 2023 20:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231268AbjHAAVh (ORCPT ); Mon, 31 Jul 2023 20:21:37 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5F2019A8 for ; Mon, 31 Jul 2023 17:21:35 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d10792c7582so3920953276.3 for ; Mon, 31 Jul 2023 17:21:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690849295; x=1691454095; 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=X6gKOGhlGB8pLW0DYtQuv9ffBJaXjDy6pmjMuBOFYgg=; b=kQoqrjZUSpYSVWxRkD8CyHapEmqNssIKnU0p8DbOeOtORHqvQa2sRcXhVsWCzU4YXH zZKas3OblcCNpHead2nGTkpMYThMQMfZeHh41WgRE1hPLNiwbHntVRxHiv/NqnNsu6We KNZIuYEWFnyjDmvXcOy5RwHVYQaGudAGf1nLCyRoZSHMxNSpdZrY7aU4AzRIfp1+8ha8 gqHlW5ZZCXCmF7ZW8oxl02SvyyCRoY3Egwy9Mv5L85kKyaSF/yQkV7Trl0FnFZ+9EL1R mMTvAT/jSm6uCb3HkZgyPqa4An9p+T65XcE0u04cE0v+XXg1hINDwPuIhtIjwA+Za4dr /fEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690849295; x=1691454095; 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=X6gKOGhlGB8pLW0DYtQuv9ffBJaXjDy6pmjMuBOFYgg=; b=DV+oUbttA73pLAvdRtQVby+5cydszGF0bEP6upY0D/z3POjUueTT+VvJtJnwWGzBTI G8h6Q0ERFCEBymGjDJMLGWBLSFVg8bTEzk7Vs10bGqt3SSu+xlpGo1D+fGCXU2uL5FB0 HKqbcAVTIptvg7l0+wXx3NJtYgwFKqO8NmXy5NGFe1HXXa0K81vY9Sb+BakVLZG7Z8KL 2HZRcV3ymFNvDUEh3UsZEo1ub96kay0ReeP+RXQ0nlrqlvZJ3KfwusyZWf8g0uFqbmmg qU0LhEMuYunUUjKO3ZpQAnl/ISxfzP9p67WBGxJ/eymfyLkdcZQpnmC6CzzCYziGkxCb iNRw== X-Gm-Message-State: ABy/qLYGD4RbbQU9DA1KAL/0+w1SHWsMEyO4ns9x/cW2gr2yKa8EhDx9 QfXSn+GxYeD6w+JHjSaFCY0r5E2qYbY4 X-Received: from mizhang-super.c.googlers.com ([35.247.89.60]) (user=mizhang job=sendgmr) by 2002:a05:6902:11ca:b0:d09:b19:fe2c with SMTP id n10-20020a05690211ca00b00d090b19fe2cmr70907ybu.12.1690849294946; Mon, 31 Jul 2023 17:21:34 -0700 (PDT) Reply-To: Mingwei Zhang Date: Tue, 1 Aug 2023 00:21:23 +0000 In-Reply-To: <20230801002127.534020-1-mizhang@google.com> Mime-Version: 1.0 References: <20230801002127.534020-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230801002127.534020-4-mizhang@google.com> Subject: [PATCH v3 3/6] KVM: Documentation: Add the missing description for 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 , Kai Huang , Jim Mattson , David Matlack , Ben Gardon , Xu Yilun , Zhi Wang , Randy Dunlap 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_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772990683522863146 X-GMAIL-MSGID: 1772990683522863146 Add the missing description for 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 Reviewed-by: Kai Huang --- Documentation/virt/kvm/x86/mmu.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x86/mmu.rst index 35e642303962..17d90974204e 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -239,6 +239,9 @@ Shadow pages contain the following information: parent_ptes points at this single spte, otherwise, there exists multiple sptes pointing at this page and (parent_ptes & ~0x1) points at a data structure with a list of parent sptes. + ptep: + The kernel virtual address of the SPTE that points at this shadow page. + Used exclusively by the TDP MMU, 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 From patchwork Tue Aug 1 00:21:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingwei Zhang X-Patchwork-Id: 128934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2359921vqg; Mon, 31 Jul 2023 17:54:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlEImKwGFQucQ3pXLLOWIhQjXEQzr9mejpEX9jtTv9Z+JkTLJ0018VueVwI0uLBryAUtkj1B X-Received: by 2002:a05:6512:3123:b0:4fe:8c4:44fb with SMTP id p3-20020a056512312300b004fe08c444fbmr1057833lfd.38.1690851276250; Mon, 31 Jul 2023 17:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690851276; cv=none; d=google.com; s=arc-20160816; b=JXu+QL7Wf8/p25GbmwEiI9jmkwT0WMfJD5lrrworyukksVHSFRzyV+ZToSnzecnIUE ZHTkPC36yNkxlghADTmEXKFRc1TEHJyKGFj7H/gZ/4YAOi4DqaHpmim/bH/Z+ox3kl2J LokUFjkqZdoiQZZVqcUKMmukaOt3dN+Ifla77lTyLJybMfb6ExqX3RUY9o6zG40trSZu zjIbV/nhVgMhxV6hFoQufJF2/q7iXx2UQKBoZFLzQmbyqMkPBSzzRK5W7ALLxPfaWq8r JPmo0a8/GLw41l1kXrA6Y5TVsMindCTD4fPkN9WPBRlTYpRLbhSs+yVTJvWT0igPo1nY qaeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=kVIN1SxWU+09oSbIiYC5Gj1hDPsle00BScGOxCHhrag=; fh=gya5F2cZq9WTAdFit1IlKDHE8FQoHEyxSPkqDAO7wTs=; b=f+kNA5pg/FjCBIjpixULxv49baScnNfM1vZS+gXj5DJc7GqjdjmCd0ZndkyVc/mXN2 Mxb/DqEtUZoY0vQY98J1PUP03ehYDjjPQJvxWfWMlgb1r5OGAjWrvdYlxDoL3G/UPUD+ taCfHx9B4XyaPyriLoAn3tHBvbJLpKF666dvdUbiA/9u9tS4KlPniERVPUsyx6Z0lD0F PiIZZPTkl/zA8CZ5uyduj+gvcpOBcPIUJfjOw++MKJ8neCGml6w+QWX2frHAH8lVr+F6 PzOQq/jBC5eiF5/Cs5yDeeVhZFyw1F2vNf35J++zAWiGVKFfQzBoDmhb7ot0dds5diFy W/qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=i2qQfafF; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a26-20020a1709065f9a00b0099318060d55si8179704eju.516.2023.07.31.17.54.12; Mon, 31 Jul 2023 17:54:36 -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=20221208 header.b=i2qQfafF; 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 S231638AbjHAAVr (ORCPT + 99 others); Mon, 31 Jul 2023 20:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231304AbjHAAVj (ORCPT ); Mon, 31 Jul 2023 20:21:39 -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 C0C501BC3 for ; Mon, 31 Jul 2023 17:21:37 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-5634dbfb8b1so3056042a12.1 for ; Mon, 31 Jul 2023 17:21:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690849297; x=1691454097; 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=kVIN1SxWU+09oSbIiYC5Gj1hDPsle00BScGOxCHhrag=; b=i2qQfafFamWuvPA18RkGa8E8zFcHZxADjKobAJAfD4VJl0KHKOIts34GO90Xxevqgc hl/SB+uKmk2pLiB+Pd8wvX8baxQPSWzwwsS4gu7CoO8hHrUQdLZarh468D1KcnEtSiKN MlsrnBB6f5tOLH4Y59PfUbZe02Ei0PNLblWdm3naMBwj9F57jp8VyaSAMai9p4va25V1 AvwFWeYRcz8hCZPkGrLgoyNT4+NJM13b4w/QiVC7CGIwDLa2INndl+Jn/X7POqiuLf7H VH+RNYpsHrblm82aBL7y4qM/wa6Wfs+Of6krp49zjmSohfW0sj/XEmjFyxOaXt0Q0BKB GnqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690849297; x=1691454097; 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=kVIN1SxWU+09oSbIiYC5Gj1hDPsle00BScGOxCHhrag=; b=jJgXoGWduN/5VE+miTfwiRaWzrj6VmBJ5uVF7PSgboa5fzuvUkRi3TFFzcPV+SoLEF xaxBBO2anbWrAJ8M7MWivjtWxjqy4aqmzmbVIm5xP3RBfYCjMHjQrtt3qv9FMVZ2c+ct fttatzfsXeavRNteeCF7TjfDTDan/kUNTyy0vRWWHYGbkqy240cgKaaKRf4IaqAHOKT/ XAk8IswiOahCcLWutjyIy7bN3hj3RuodS5SxPBcCwxXrym971EavJ/PlEXmyNwPN6fNm ANaLXwCsUzfwyye6sQktSKJ6EdNtKnnK2jJ6BB9d4ksPS+NWorIUj/VpyE2AKRnIRa1D o14A== X-Gm-Message-State: ABy/qLZ+yHEh/aPGLBBWx0ObIgxZzhQ2z5OL+vsQ1nhsZyF2RDfS1jiz B8uU9YD3yn1QTsLVAyQcu96voBCTN+N0 X-Received: from mizhang-super.c.googlers.com ([34.105.13.176]) (user=mizhang job=sendgmr) by 2002:a63:374a:0:b0:55a:b9bb:7ca with SMTP id g10-20020a63374a000000b0055ab9bb07camr54208pgn.10.1690849296762; Mon, 31 Jul 2023 17:21:36 -0700 (PDT) Reply-To: Mingwei Zhang Date: Tue, 1 Aug 2023 00:21:24 +0000 In-Reply-To: <20230801002127.534020-1-mizhang@google.com> Mime-Version: 1.0 References: <20230801002127.534020-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230801002127.534020-5-mizhang@google.com> Subject: [PATCH v3 4/6] KVM: Documentation: Add the missing description for 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 , Kai Huang , Jim Mattson , David Matlack , Ben Gardon , Xu Yilun , Zhi Wang , Randy Dunlap 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,T_SCC_BODY_TEXT_LINE, 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772986067559471747 X-GMAIL-MSGID: 1772986067559471747 Add the description of tdp_mmu_root_count into kvm_mmu_page description and combine it with the description of root_count. tdp_mmu_root_count is an atomic counter used only in TDP MMU. Update the doc. Signed-off-by: Mingwei Zhang Reviewed-by: Kai Huang --- Documentation/virt/kvm/x86/mmu.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x86/mmu.rst index 17d90974204e..40daf8beb9b1 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -229,10 +229,14 @@ Shadow pages contain the following information: can be calculated from the gfn field when used. In addition, when role.direct is set, KVM does not track access permission for each of the gfn. See role.direct and gfn. - root_count: - 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. + root_count / tdp_mmu_root_count: + root_count is a reference counter for root shadow pages in Shadow MMU. + vCPUs elevate the refcount when getting a shadow page that will be used as + a root page, i.e. page that will be loaded into hardware directly (CR3, + PDPTRs, nCR3 EPTP). Root pages cannot be destroyed while their refcount is + non-zero. See role.invalid. tdp_mmu_root_count is similar but exclusively + used in TDP MMU as an atomic refcount. When the value is non-zero, it + allows vCPUs acquire references while holding mmu_lock for read. 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 From patchwork Tue Aug 1 00:21:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingwei Zhang X-Patchwork-Id: 128933 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2359916vqg; Mon, 31 Jul 2023 17:54:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlE+4DnqdyaqUoQwIlFCUxIPwPMdKkoYkGFVBAofu50iwealMJxAkNJDk7FnlHEoA6UCXbge X-Received: by 2002:a17:90b:1116:b0:25c:8b5e:814 with SMTP id gi22-20020a17090b111600b0025c8b5e0814mr10289101pjb.44.1690851275077; Mon, 31 Jul 2023 17:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690851275; cv=none; d=google.com; s=arc-20160816; b=LA4iLR9s64ZenZCWYg7/fb5ng3ICBMx8ISonMSJe9bZRhzw8FVza2j0Du11/LAzubh 2EFB0NWjw8zCK+2ltgHwDjbO+0oQYWjsRebrP3LshtDyglaargj/Wd58OMdASWoLo+pS oAm9T0Gso7Zi4k2hmTGEuIkmbAxi4JVx9lLGYDjAbZNK/8MjBpJQIv3mU7i2LfDzWHGF jj3bNgcr4gvfTyD5HYfSLjKKq4psp/2wjZF7+474tilALtjD0QuezLV8d3hiyVt+FNAs feRlOZt647s41Po0XoEo1RGZ9N2D2BD1Rr+4y72iH/zpMXR30PM5Z9r58K16MjStxllN pLCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=lAQnhGDOkYRMbkZrdC3SL5zoWbQR4X7L8Yn3+Vr770Y=; fh=gya5F2cZq9WTAdFit1IlKDHE8FQoHEyxSPkqDAO7wTs=; b=lFQku82XFb2oQxS0s0h82rE4OkyAEByRXHEE7onkqzA4V6eZ2nCmvrEniG5tF8mBUV yH+giTTjmiZ1C4Gg4ecekEMqZqQ+hF0WGQXy/LswcgJ1O1reJ9fbEKiR4qL2tLMamkYc pRqrr8xYXYqlejyaLn8Qn+iGeH6MlKPz8UpnTP7S1YuGmfZl+8zRwUNpryzpBPaUdIiT on58caJZtahCe5tusDL7relKrbgJG697nOKD7+gXJhGi6vTFfFfgGrqVj06j3xg/xs5j vMef8BraN83oX7b/Q6PZtTbNGGnkqm6OnKsahlfyn/Eb9N1yysS+jCvGY1IZ56PWbF6h 7C+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=mSlCLmLd; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp22-20020a17090b191600b00262e6b05c92si9600851pjb.150.2023.07.31.17.54.22; Mon, 31 Jul 2023 17:54:35 -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=20221208 header.b=mSlCLmLd; 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 S231741AbjHAAVx (ORCPT + 99 others); Mon, 31 Jul 2023 20:21:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231453AbjHAAVm (ORCPT ); Mon, 31 Jul 2023 20:21:42 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 764FC1BCC for ; Mon, 31 Jul 2023 17:21:39 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-c647150c254so9351637276.1 for ; Mon, 31 Jul 2023 17:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690849298; x=1691454098; 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=lAQnhGDOkYRMbkZrdC3SL5zoWbQR4X7L8Yn3+Vr770Y=; b=mSlCLmLdSdPxkircK3iN8jwT5W5vP1eDs51MN2JElm1ENf0E0zV1+hxVIqVpBj8Lbq 3YbA2/WyG5K4xCuq9Coj3iUMdMibr4FQcUpL6vKn/cEb0mcK+XtbQBYhpoD1utE9R/hw sNnyB6mq7sHFk+jZtZuvaN58hRjds+AE8Y+onHTyMUrpDQcsvWZDQTAAoX0qYG6i2kei BlqqustZeYnIPg8lYc6HCZmKcoW3EI/AsWv3P+mg4OOKdmJfb1bjcImHHRWilDTHx0WD OiGbBfE4+wE/VlffLCEkwsxzLb7nSfkAHH9Dkh8+py9OmsUsIBcfhvxGec3zqaWc+OQH 1g3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690849298; x=1691454098; 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=lAQnhGDOkYRMbkZrdC3SL5zoWbQR4X7L8Yn3+Vr770Y=; b=PowjmOXBOWwFSDpc6E7n/OmvhcuzMyoom252AHrsz5kNB0mexjU/J5hpAPJeCEfjw4 7lGSzebQmpvnu47tXEHgbX7D1TDGFmj4X/e3Hmt4bqzHYK1qrdwA8GhkHwtKSwjtY8St oeuk+DZsFLYYjsqEqoTJAAB2OnvkBxPJ3KYrC8J+6i1toG/H/a4e/cV7d/tFHuVLHryo 5EEr5Uhhy2LNl8NV+r5chFmToNIwdiLZ3LuWrrSoijTagUO6Kz0viiJ6rzawDIQwe7Kh sO3Qc3p/4RorgZ96xYHpMQsbDA6JY12nNZXLxfKZGvGiMKTwtzaMA/Ua/iJobYzGgwCv 2rxw== X-Gm-Message-State: ABy/qLbHIAEmKicX2HJzRmytUo/ErhOxQExMic4qFu2VpR9DVs1SgwwL 4uIerCXUm3Ro4Zu+3ZBhJwy8bTY/1HBG X-Received: from mizhang-super.c.googlers.com ([34.105.13.176]) (user=mizhang job=sendgmr) by 2002:a25:dfc3:0:b0:d15:53b5:509f with SMTP id w186-20020a25dfc3000000b00d1553b5509fmr119752ybg.2.1690849298640; Mon, 31 Jul 2023 17:21:38 -0700 (PDT) Reply-To: Mingwei Zhang Date: Tue, 1 Aug 2023 00:21:25 +0000 In-Reply-To: <20230801002127.534020-1-mizhang@google.com> Mime-Version: 1.0 References: <20230801002127.534020-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230801002127.534020-6-mizhang@google.com> Subject: [PATCH v3 5/6] KVM: Documentation: Add the missing description for 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 , Kai Huang , Jim Mattson , David Matlack , Ben Gardon , Xu Yilun , Zhi Wang , Randy Dunlap 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_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=unavailable 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772986066671558066 X-GMAIL-MSGID: 1772986066671558066 Add the description for 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x86/mmu.rst index 40daf8beb9b1..581e53fa00a2 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -208,6 +208,16 @@ 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=1) and is shadowing L1's 4-level NPT (L1 CR4.LA57=1). + mmu_valid_gen: + The MMU generation of this page, used to fast zap of all MMU pages within a + VM without blocking vCPUs. Specifically, KVM updates the per-VM valid MMU + generation which causes the mismatch of mmu_valid_gen for each mmu page. + This makes all existing MMU pages obsolete. Obsolete pages can't be used. + Therefore, vCPUs must load a new, valid root before re-entering the guest. + The MMU generation is only ever '0' or '1'. Note, the TDP MMU doesn't use + this field as non-root TDP MMU pages are reachable only from their owning + root. Thus it suffices for TDP MMU to use role.invalid in root pages to + invalidate all MMU pages. gfn: Either the guest page table containing the translations shadowed by this page, or the base page frame for linear translations. See role.direct. From patchwork Tue Aug 1 00:21:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingwei Zhang X-Patchwork-Id: 128935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2362418vqg; Mon, 31 Jul 2023 18:01:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlFKMOFyzDmIGihc/M78pNBAB/xQToREzJzJ7ovFlSQWo7fj0PaubgZjfOSS9Tbz+QjMxZB4 X-Received: by 2002:a17:906:3191:b0:965:fb87:4215 with SMTP id 17-20020a170906319100b00965fb874215mr1060785ejy.15.1690851686780; Mon, 31 Jul 2023 18:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690851686; cv=none; d=google.com; s=arc-20160816; b=V5/ttFXLFHEE208QkvVS0aUD57cU4P5/PbdI7x6qcdejlbvoOpEBrjjXJk8NjzRsNm uoAvFwCJWIYdPbbpY0HJj/LuJU1/GPbSKMgS6hDHaOLPjLz6JTpMm8F1insUU2ikMNw8 Ip1hBLJ4ThaI8x+249PLF1HdQroVmhXddqYvjWOU5oDPUd9TdePqBDbAoD44lfCohHML arLJJnhgt8pOCHtY0DVgQ98HYwVi3TMxsrIZWeszxVfh/HWTwglQD5p0Rmpi8oPHGAxB GfA86/TZNKae7UE/KjMXVfmBmPdvTxmbMXNg3ZDp7lFabn93ItkeCfGDTaWEys3gh01T qUaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=IZ3RpcngQEoYF628RWUm7FlAucMXyfC7tt8DVxrqfpY=; fh=gya5F2cZq9WTAdFit1IlKDHE8FQoHEyxSPkqDAO7wTs=; b=F5pDJHPQmHjymukMshf2pGQk9ItTWTxU0QaOuBq2UdPggTxM/AMIvOhhAbO4jad9z8 KRiD16outhTXi+YlDysZwnOyxutHBYsUNmFKYYl0+NiYGzYAzyn2ifEJF8Ano5VRvFW3 D+5gWkxg9hB7HYYExEsM+9KK6bCumlKIBNYuxOTaKRNkn2j4sYWHvUG9xeDD8F3j7gAC 6pKofo9E51pTavmoaKX7M53+I2m5fdATTUWcpzDF0IZu9Gkb7m7uetKJl6XZWi51fa8p Sn5ZtDYr2uy2Ir7LIDVZcZMNRyNzt+XZrQwDxzeDmXDiZN57tXy8vV4HJa7p3MRH93WD OnCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=57IFX5W4; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ck8-20020a170906c44800b009888e599645si7956981ejb.771.2023.07.31.18.01.02; Mon, 31 Jul 2023 18:01:26 -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=20221208 header.b=57IFX5W4; 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 S231309AbjHAAV7 (ORCPT + 99 others); Mon, 31 Jul 2023 20:21:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231526AbjHAAVn (ORCPT ); Mon, 31 Jul 2023 20:21:43 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E18E1BE7 for ; Mon, 31 Jul 2023 17:21:41 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d1ebc896bd7so6005359276.2 for ; Mon, 31 Jul 2023 17:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690849300; x=1691454100; 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=IZ3RpcngQEoYF628RWUm7FlAucMXyfC7tt8DVxrqfpY=; b=57IFX5W4Q+tAl7op44Oy2FM4bWgLYmdYlV0ogtgE5VG/ceIH+YmCPWbyTsDo7fM9HN Lnws4wIpSYfJP0UKGkymy0Y9qXgPTHZMA1sxCxyWUSD9ih6zw8bvFEzlCftl0K6cQTss +cPMLOtCZiICXqKSWGuNnDiPpNVODe1ajPspNsrTYIclyEnCffPmoeUMnORWiwoduSCr zQS61STgZlvgz8Yu1+FnDARWgqHun0qtMl3aGJbVHKvXfCsV3YJQ7Ij8D9Nt6LV81ioT 7+p+yXyQJEPBAvWCncTEjzJ/A8lxjPAogZ7LriiCKW6wLSbz0zZujQ/ZJU30KoiZfXYq lz+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690849300; x=1691454100; 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=IZ3RpcngQEoYF628RWUm7FlAucMXyfC7tt8DVxrqfpY=; b=K4Vf+dYekBS39E58OKpIVd5kZ7YCo8srWYkLNrk+vb9io4Tx7lR2aYfRjVFBdo0gYj qSu3ZarGUgfs1cO0mQxq964p2WbRDQ4UN28xQZBwW9tcrl/kw54fjFVd/aqvNq0sIDh2 z1n+Y0+iY0gVVpKymjb05CAsa5Q/QUxMUiQqCBFJTgD4wtS7tgOqO4vjq5yhLkmAcyt0 0NEMTMY7LZoKqHyQUJwwTTBpi/JZ+0tXzLbzCI6rZH610yUpJXeBjCCwW2f1GpcM4T1h bwX7rNJtHeyur6btPq/2MF6DX11UPqkfIhkpnJtaTQuazxJ8A17T7RgFGFZpvO15medK O4RA== X-Gm-Message-State: ABy/qLah/LDcnwTn/BczWRRcc6iFuofrF0FKwEBRiY5NkZdXIXZz4jm2 HChJLdoLPOhZvJ0za3jLkwvnZfn3/Qjr X-Received: from mizhang-super.c.googlers.com ([35.247.89.60]) (user=mizhang job=sendgmr) by 2002:a25:dbcc:0:b0:c4d:9831:9712 with SMTP id g195-20020a25dbcc000000b00c4d98319712mr65659ybf.0.1690849300437; Mon, 31 Jul 2023 17:21:40 -0700 (PDT) Reply-To: Mingwei Zhang Date: Tue, 1 Aug 2023 00:21:26 +0000 In-Reply-To: <20230801002127.534020-1-mizhang@google.com> Mime-Version: 1.0 References: <20230801002127.534020-1-mizhang@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230801002127.534020-7-mizhang@google.com> Subject: [PATCH v3 6/6] KVM: Documentation: Add the missing description for 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 , Kai Huang , Jim Mattson , David Matlack , Ben Gardon , Xu Yilun , Zhi Wang , Randy Dunlap 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_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772986497949068108 X-GMAIL-MSGID: 1772986497949068108 Add the description for 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. 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/x86/mmu.rst index 581e53fa00a2..3be646a6daf5 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -283,6 +283,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. This variable is used to + bifurcate the control flows for KVM when walking any data structure that may + contain pages from both TDP MMU and shadow MMU. Reverse map ===========