From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795462238; b=bFnhNo51pzgm1BTjMTKhBJBzbIYptXxAGB2DHhZBcICd9IijbAdzrnukVgkmk50EKkHB BfkHcEvV/MNKMPGyGQjBpj3+63HWJ4BVglx0PNbTAXFXINIHszx4EgkGS2bOqVMKTGW74 tmirOzY3RAQWk3kiscbCCCgouqyE7I3PTkiUt8OSMZD+2vBmHoZ3C3ChKwrXttb/AZA3r lb+Vi0lQ21UiINP+/7DbA0t3K8QD9p54eBlQHSDt06zkc29haglllZdtL8ARiU0GvICHT F8nX2jXAn1bmH1bfyuZydlsJbM7v6eY42ipuuLAvP315f050W43tZ1YdvaIYt7VG07A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795462238; h=Received:DKIM-Signature:Received:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:User-Agent:MIME-Version:Content-Type: X-SA-Exim-Connect-IP:X-SA-Exim-Rcpt-To:X-SA-Exim-Mail-From: X-SA-Exim-Scanned; bh=z+dq6Ervyi98/+N8sziu7yKbuSrwvrBsyjh52/p6ALM=; b=p8zab5Z1eF+l1yiGdEpZlgUQThFj21BI+nZ2tJAJ/vDJLBrENybNLmw4JPGh7ShUeLe0 SHlFNHAQQ6uO4ZFo+7/Ivqd6AuxrtZVcUUXlapmBkHnqGdoeEMu30il6do3ic5qPo46jf FVYr0P/x3f7Dn1m4gD9V0MzlycwKKQwL2/l8eScixJSKORyu6dbz1zWX/H+Li2kaVbdGT dLLQHCE2EfD9JXLkMWpLRZgJTJo85VeKxeRazltxNHfx4B88rWQLWUalH5JQAOFSEsHlC GfUp8YiF/SAOmrKa+h4AgagoLNMEYWvJLjLt0uN1W7Pm2zXEtN6LiX9E+wzY2WqHxzQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q4Fqwtcf; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7288E606A31A; Mon, 23 Nov 2026 19:30:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q4Fqwtcf Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D5F31F000C6; Mon, 23 Nov 2026 19:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795462238; bh=z+dq6Ervyi98/+N8sziu7yKbuSrwvrBsyjh52/p6ALM=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Q4FqwtcfPIuZLt0rOsqefYMLZEjKMFzh2SZylcjdl3N7FtCfhpwnF6/HadiP98Mvu iKjq+NFC6v31+JILqy9ea1An3NewSDWZjIC7tlgy7Lj/qXVqJJfu7IvC4FewQBRSAS 2sbDfyettR5SI/ySjItyJXGZ4phz8pSQqOOgi1v2z1IHcHIrRONAJzErTHehWGcWfD 6SwjMKHJx3YdXPNVVrUZNCvJJzO5c4LjLJ9NSHFJZ+U/27630Ps25zmaQpZQm1L+vG 29H2z8AFFJO+NLanPktuNoSs2eVK2fS9StH4X3PMWjtywBF7rohbVIJLteTUy7GAbP G3hVLPskPTpDw== 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 1xVZkK-00000002BkY-23wk; Mon, 23 Nov 2026 19:30:36 +0000 Date: Mon, 23 Nov 2026 19:30:36 +0000 Message-ID: <86bj7fz6oz.wl-maz@kernel.org> From: Marc Zyngier To: Dan Carpenter Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Steffen Eiden , Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Fuad Tabba , stable@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: nv: Upgrade sub-page TTL hint to maximum size In-Reply-To: References: <20261123182312.4842-1-maz@kernel.org> 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-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: dan@pereq.eu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, seiden@linux.ibm.com, joey.gouly@arm.com, suzuki.poulose@arm.com, oupton@kernel.org, yuzenghui@huawei.com, fuad.tabba@linux.dev, stable@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, 23 Nov 2026 19:25:09 +0000, Dan Carpenter wrote: > > On Mon, Nov 23, 2026 at 06:23:12PM +0000, Marc Zyngier wrote: > > Should a guest be slightly foolish and submit a S2 TLBI with a TTL hint > > that describe a base granule size smaller than the host's page size, > > we take the resulting size at face value and feed it to the S2 unmapping > > code. Which legitimately screams about something not being page-aligned. > > > > The architecture allows us to drop the TLBI on the floor, as we don't > > support a S2 granule size smaller than the host's page size. But it turns > > out that doing so is proving pretty hard (we call compute_tlb_inval_range > > from a number of places, none of which is amenable to an early out). > > > > Instead, detect the annoying case, and pretend that we don't have a TTL > > hint at all, leaving the size upgrade mechanism to take place and use > > the largest possible size for the guest's S2 granule size. > > > > This will still allow nonsensical stuff to get through, such as a 4kB > > level 2 (aka 2MB) from a guest with a 64kB S2 base granule size running > > on a 16kB page size host, but that's not worse than doing nothing, and > > the host code won't get shouty. > > > > Reported-by: Dan Carpenter > > Link: https://lore.kernel.org/r/20261123-inval_range-v1-1-815e15797089@pereq.eu > > Fixes: d1de1576dc21 ("KVM: arm64: nv: Handle FEAT_TTL hinted TLB operations") > > Signed-off-by: Marc Zyngier > > Cc: stable@vger.kernel.org > > --- > > > > Notes: > > Reposting this as a first class patch, as I'd like to plug that one > > as early as possible (and Dan has plenty of other patches in flight...) > > Tested-by: Dan Carpenter > > Although obviously zero is handled on the next line so there wasn't > much call for testing, but I still did do the testing. And that's much appreciated. Thank you! M. -- Without deviation from the norm, progress is not possible.