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.