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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41502CDB46F for ; Mon, 22 Jun 2026 09:16:29 +0000 (UTC) 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-Owner; bh=UTgNLIBhPKstViXQ//dmtK/LO1QXotSXTQUkzHcPMcM=; b=phX3bUkbrxaYpZHSwPp0pOUDhL Fc8pcDq0VX6CMhXVwGO9mQDD2/hq3TcQxro1Gj9j9KY6xl9ifFwNR2yk2Ut3YG3Qjjzzgvkf/9W7t jyaVsXtF0A8mbXy9nX46WmufEkoeJhbw+Ve8TWyyq+at3V8ChjVoWIMrbAJKfarK1UhdrWL0PNUK3 4dxUz1wOgDegSuIOuXwIMtl6kCcXt6bl0Miv501K0mWn/TvO3WAihe1CgSs/J/ckpojuJ0Qbmnozk smrZ/K+S6Ff1eDI6GFac2+SHT1R6K4r6/QPfkHLWb9ObQut5tD5mIFbdsZGsTGVTNIolwTLD8UXc4 IdVwl/Ag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wbalS-00000004jjD-27Gl; Mon, 22 Jun 2026 09:16:22 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wbalR-00000004jj7-3EB0 for linux-arm-kernel@lists.infradead.org; Mon, 22 Jun 2026 09:16:21 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 07CE2600AF; Mon, 22 Jun 2026 09:16:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2E1A1F000E9; Mon, 22 Jun 2026 09:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782119780; bh=UTgNLIBhPKstViXQ//dmtK/LO1QXotSXTQUkzHcPMcM=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=JEfP7ejIVnmlA3NOIH3peY2AjrUBE/NY1Zu/eWBaHNd+qMzDfluyhWwr1iu4oNC1t ZtuJUfjafRRap9eUeFHGuRRR0eMyt8tlyLszZEeVThoIRZ5ujDBA7qVMluXb6PPj78 +dx7oxSWe/vKn7cF84gyPRjHQgpHFu2MAlcVKjw/veNprSKKDc8EnTuItzGw1mfcLf BlB8s6ldNJDCIwEUdYm4Yt7RQw/y71W7PXhjNVcu52fWiAHjUR1vosAzMJSxTrOdOX R10JrwsdNBhvfWGlUX4QvQTXtcyOMWybtYT7VZM8idIypt5Kf4XKErddP4kL/bScAT DMuaznEu7yulA== 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 1wbalO-0000000ErFO-1iO1; Mon, 22 Jun 2026 09:16:18 +0000 Date: Mon, 22 Jun 2026 10:16:18 +0100 Message-ID: <86y0g7q6jh.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Bradley Morgan , Oliver Upton , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: account pKVM reclaim against the VM mm In-Reply-To: References: <20260621213155.6019-1-include@grrlz.net> 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) 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: fuad.tabba@linux.dev, include@grrlz.net, oupton@kernel.org, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 22 Jun 2026 09:32:45 +0100, Fuad Tabba wrote: > > On Sun, 21 Jun 2026 at 22:32, Bradley Morgan wrote: > > > > Protected guest faults charge long term pins to the VM's mm. Teardown > > can run later from file release, where current->mm may be unrelated. > > > > Drop the charge from kvm->mm instead. > > > > Fixes: 4e6e03f9eadd ("KVM: arm64: Hook up reclaim hypercall to pkvm_pgtable_stage2_destroy()") > > Signed-off-by: Bradley Morgan > > Reproduced by creating a protected VM, running the vCPU to fault in a > page, then forking and having the child close the last fd reference. > Without the fix, the parent's VmLck leaks (the reclaim decrements the > child's mm, which is freed on exit). With the fix the parent's VmLck > returns to zero. > > One minor observation: account_locked_vm() also passes `current` as > the task pointer to __account_locked_vm(), but on the decrement path > that is only used in the pr_debug log line, so it is technically wrong > but functionally harmless. I don't think this is wrong. Awkward, maybe. It is just that the rlimit check and the accounting may be different contexts, and the pr_debug() call covers both inc and dec. > > Reviewed-by: Fuad Tabba > Tested-by: Fuad Tabba < fuad.tabba@linux.dev> Thanks, M. -- Without deviation from the norm, progress is not possible.