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 29A79C433EF for ; Tue, 12 Jul 2022 02:07:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231287AbiGLCHp (ORCPT ); Mon, 11 Jul 2022 22:07:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbiGLCHh (ORCPT ); Mon, 11 Jul 2022 22:07:37 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 420687CB7D for ; Mon, 11 Jul 2022 19:07:32 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id f91-20020a17090a706400b001ef890a44e0so3127544pjk.9 for ; Mon, 11 Jul 2022 19:07:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=wC4daWuN72ntGNvsqnVV6vq+bt1gw7NePoqDxLLGrS8=; b=CVfLrEPTwIaX/ki4UHYkP2ZYB4PdTx80sHad8DGQnCFvjKorZ6JfnaYRfzbWOIJvW2 itUY2sdVixbqHdbUNb5j7uQy41tHY1uo4vwY590DpNkmxAyfP6T71U64XE0p6rGWRPOQ 4zULpdTPLDYFSAHe/VMpzNp5llohVFJbfQ0d+HDFFlr8op2cZywsn81iw+nSBCDzAxmu yUKf9e3Zh+S0hmBwRzIRA6wH5eaLxpZGN7G2g1skjxWOxRxEChRb0GcasYGWdF5itqR9 12CwWrVUW6QLDxrLrkDXRmgoK7wacQgV/NLz2Agxy0kIgSDFUko16nV+OJ5j3+h2O3Pv gjOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=wC4daWuN72ntGNvsqnVV6vq+bt1gw7NePoqDxLLGrS8=; b=C4WEZqyBdjKWw4GzXfYJhz0Yaczud8uxU8iwgh5VZ3AbddoGKsN+3STFmXxQ5j/D/s gnQGXX8msLSsicPdcNENIPU950CfTyMAAd35Zy/pNfl2tV01dEFqZrxzIwcexZXmvove Nm/D6LnfQj0pGKVd40cCBFn+0/+hZ1kovDIiDMcu11g170dRsSeJJAQ6gho4uC8Q45O5 wvu+lbaPDb62y2DXl5VerqLaHl8WkoPNNTG+rFW++3803CHRPe5kqp1jsx8qER7rp6cH PEjMbXRHW4hkteVqve+PGg7ChvRuhDWWTodlbFpBy+oz5GTgHP1cKLfyBpR7Ic4TytQF Ei6A== X-Gm-Message-State: AJIora9LZW+5xsCCyMZ6Vqg5nPrNXUfU9F2IQ1ctTl6FoIaqzxTAW2da HQxaryxOkG0IlJZbdH+UXiFs5m7ASKk= X-Google-Smtp-Source: AGRyM1tamDaouxIjsR84u7D+TdWg376mrBI9rco87Xf1xz5mM8bsjTYhZ9LZN+mcQ4ZJ0rEVThTJZqUAw5g= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90a:249:b0:1e0:a8a3:3c6c with SMTP id t9-20020a17090a024900b001e0a8a33c6cmr40863pje.0.1657591651230; Mon, 11 Jul 2022 19:07:31 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 12 Jul 2022 02:07:24 +0000 In-Reply-To: <20220712020724.1262121-1-seanjc@google.com> Message-Id: <20220712020724.1262121-4-seanjc@google.com> Mime-Version: 1.0 References: <20220712020724.1262121-1-seanjc@google.com> X-Mailer: git-send-email 2.37.0.144.g8ac04bfd2-goog Subject: [PATCH v3 3/3] KVM: x86/mmu: Fix typo and tweak comment for split_desc_cache capacity From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Matlack Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove a spurious closing paranthesis and tweak the comment about the cache capacity for PTE descriptors (rmaps) eager page splitting to tone down the assertion slightly, and to call out that topup requires dropping mmu_lock, which is the real motivation for avoiding topup (as opposed to memory usage). Cc: David Matlack Signed-off-by: Sean Christopherson --- arch/x86/kvm/mmu/mmu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 7a65e57b9b41..52664c3caaab 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -6125,14 +6125,15 @@ static int topup_split_caches(struct kvm *kvm) { /* * Allocating rmap list entries when splitting huge pages for nested - * MMUs is uncommon as KVM needs to allocate if and only if there is + * MMUs is uncommon as KVM needs to use a list if and only if there is * more than one rmap entry for a gfn, i.e. requires an L1 gfn to be - * aliased by multiple L2 gfns. Aliasing gfns when using TDP is very - * atypical for VMMs; a few gfns are often aliased during boot, e.g. - * when remapping firmware, but aliasing rarely occurs post-boot). If - * there is only one rmap entry, rmap->val points directly at that one - * entry and doesn't need to allocate a list. Buffer the cache by the - * default capacity so that KVM doesn't have to topup the cache if it + * aliased by multiple L2 gfns and/or from multiple nested roots with + * different roles. Aliasing gfns when using TDP is atypical for VMMs; + * a few gfns are often aliased during boot, e.g. when remapping BIOS, + * but aliasing rarely occurs post-boot or for many gfns. If there is + * only one rmap entry, rmap->val points directly at that one entry and + * doesn't need to allocate a list. Buffer the cache by the default + * capacity so that KVM doesn't have to drop mmu_lock to topup if KVM * encounters an aliased gfn or two. */ const int capacity = SPLIT_DESC_CACHE_MIN_NR_OBJECTS + -- 2.37.0.144.g8ac04bfd2-goog