From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77FF836B07E; Mon, 22 Jun 2026 09:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782119783; cv=none; b=u+vALmMk9pxdfaIryu8jEGMRtoYUOrplmaXxyPp2mYcKkcctCOQrbvxZuRsZn4TvZeMIqcXWw/L+pN3VYAp9cTn+pKO4fpmsXD75AY5ZXfqhD7L6ycC2CipqArphVfX7sHR3da4G95/NzzdmBLlfk0v0UQggSk3scmdeVNAuGO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782119783; c=relaxed/simple; bh=g2rGE5ww8vs4SWx5/NprZ/AXJVrKFbDjyxVMmuYdkgw=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=iBsT7j3VI8QS8ti0NS+D/skdcE8pU5j3X1Af5cz9tYOYFnAmu8xGCJT5oL8gVsNLVpaO1K2bTsPjOMX5GrvMmFpRXxfhAfR1X4v5eKwnBioD8XcGI4DUoMme1UIDSeONfBdQBgcIZtgUG7vniEaQK7SDTwjGCbaztkthxBzyyTI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JEfP7ejI; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JEfP7ejI" 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.