From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11957606A31C for ; Thu, 26 Nov 2026 16:36:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=CZll0CBT; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KTinv6/9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=wTk/8x0Maq/XwIFmVoNU0U+Iy9cYA+BinE6p+h+LkZo=; b=CZll0CBTiq6HHmQCAXS8G9petv /kh0pKhJVEi6ysXiawo1o/Ui8SFfj5E5JR/R2e+8qKG/7Cx7ToAwCB9GMOvS+KZJBgmA2JdLZ5sES xga9MTWG+0cNVBV7UmU0OIOrM/QbzRLVJSdr/VICsA5JwYMx6652KDd2LUk222eVhhefF8Fp7rCiz fHIVpynML3OXNBwfn+kQXpRMTV9rRhIfTOZfXYQ6auRJVK9UU2yxlZpJDoUHLfS39BC1iysSp1jVa gq7xVKuezuh72zhiLH3fOg43flFWeN3u9IVtxOpvjs96v4WxU6eivyx7HGUlIbyhCMJF39TiLWNpb UjFfQTPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWbrU-0000000Dp9T-3u46; Thu, 26 Nov 2026 15:58:16 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWbrS-0000000Dp92-46LA for linux-arm-kernel@lists.infradead.org; Thu, 26 Nov 2026 15:58:15 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 5AFB361866; Thu, 26 Nov 2026 15:58:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F1031F000C0; Thu, 26 Nov 2026 15:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795708694; bh=wTk/8x0Maq/XwIFmVoNU0U+Iy9cYA+BinE6p+h+LkZo=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=KTinv6/9XW8poNeJxb6crvd9x0P3Pt7/JXTjwWUmk7jdJhc+wCc3iSrzc+dTSIMo9 EpxSDtM8kLQz724vqv3ed6peCv30TBNTHjEYAlG8zwwG8bx9i7rPFSYG1BReNVmAIR t8VCRseKp07XNkeFkm4v8PEZSZiQMpdI8A9g+VOHfwrYA/FwrghxQXROeukrrZMmtD mwwmhl8jyNgMXPkP1MccTfUtNxU2qZTTSW2iPeOhvAqolFa+KlZhSmpEUCf4RpqCeO P8Vb7Un+F3kEaKFlffed4haDnxDEwPVz6pOISdJ4lGOvkJiywUfkw5eO6EJV/KyW+X +ZRa/ZgSO+mQA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xWbrP-00000003iUw-3gu5; Thu, 26 Nov 2026 15:58:12 +0000 Date: Thu, 26 Nov 2026 15:58:11 +0000 Message-ID: <86v75jy48c.wl-maz@kernel.org> From: Marc Zyngier To: Usama Arif Cc: oupton@kernel.org, fuad.tabba@linux.dev, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, riel@surriel.com, shakeel.butt@linux.dev, kernel-team@meta.com, rkeilty@meta.com, atish.patra@linux.dev, dgreid@meta.com, Lorenzo Stoakes Subject: Re: [PATCH] KVM: arm64: Reduce the stage-2 page cache on 64 KiB hosts In-Reply-To: <563d2406-dcfe-43b6-8f21-2a7694f1f266@linux.dev> References: <20261124152842.2634495-1-usama.arif@linux.dev> <86wlpzycnn.wl-maz@kernel.org> <563d2406-dcfe-43b6-8f21-2a7694f1f266@linux.dev> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-Archived-By: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: usama.arif@linux.dev, oupton@kernel.org, fuad.tabba@linux.dev, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, riel@surriel.com, shakeel.butt@linux.dev, kernel-team@meta.com, rkeilty@meta.com, atish.patra@linux.dev, dgreid@meta.com, ljs@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Thu, 26 Nov 2026 14:32:04 +0000, Usama Arif wrote: [nonsense deleted] > > Now, to the patch itself: I see no reason to special-case this. If > > kvm_mmu_cache_min_pages() is an indication of what is needed, then > > this macro should be driven by it, or the whole allocator take it into > > account. And then you adjust it by whatever fudge factor seems > > appropriate. > > > > Completely agree! [1] does that: no page-size special case, and > a capacity of KVM_PGTABLE_LAST_LEVEL - KVM_PGTABLE_FIRST_LEVEL for every > page size. It can't track kvm_mmu_cache_min_pages() > at runtime: the vCPU's cache is shared by the canonical and NV shadow > MMUs, and its capacity must stay fixed. So it has to cover the largest > minimum, which stage-2 caps at 3, and 4 is that plus one page of fudge. Of course it can. That's not exactly rock science to add, rather than relying on another set of bad heuristics. And this must cover more than a single mapping per top-up, because that has a ripple effect on the speed at which we can split large blocks (funnily enough, people care about that stuff). M. -- Without deviation from the norm, progress is not possible.