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 D727D606A33D for ; Tue, 3 Nov 2026 16:26:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=y+GaGUKc; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XY3qZadr 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=NsCA1FKYyEC6+lnEUbeQgCTjVtjYpHvweOvN+u1DACA=; b=y+GaGUKcxeKCruHAVE7O15EKtv vzW3C2DqPS36m4CO41C/X80+zHyGrjEPduKMVmNEMPNBoXbWqOalwAjY7a7UYcoTni+98AYV1s9Nt lfHrTw4LVABlIggVN3UM7QNgU1tXM5+0S1BL0fZWkLTF0efBnlVcZr1i6YPeAmXkzXWU5fyhDzZVY 7VEk42lgFCSWiKMdBSiq+LoFvjrxNn2jj0cn562SWgWNv7ZVnnOP9Aj90wSa/eRE5I5SwtYGr57Wu CTpFWwBeOd0r49/s5CUc0nAac7edQzyyzicrflU+LAxSRawjXFjgnL4NsJs82EuxylMxspy3iiDGX qo/xdmhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xOHKo-0000000376Z-1HeT; Tue, 03 Nov 2026 16:26:06 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xOHKn-0000000375w-0YED for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2026 16:26:05 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 8CC1A41AAF; Tue, 3 Nov 2026 16:26:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A5D01F000C1; Tue, 3 Nov 2026 16:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793723164; bh=NsCA1FKYyEC6+lnEUbeQgCTjVtjYpHvweOvN+u1DACA=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=XY3qZadr11uiBhM392hBYJVR/qMO5gtXMq34UYO9nzjQRrjMi2jN0lLN+tvdAdDqV qEYTO6RPoEhwC8zH498eSdFxnB8CAmzPxjl6JMF8JpLIz0FL7c7vn6OnH/RTiTS17S GL4OKQgLmBTs3mo2ED1tQPK02BP/NsjgaXJBhB/KkVzeVOoZ0F7htqU3HPMrZFrXca +GVm1bbT1kdEp0wEAcPCEU3JskHw4XrRsB02MwMFD9yhfjDmZF5qCScUi9elTKQUa0 /uKDShFLGe5WMWmCWxwcY40uFAmBdSahCE1QU+RSQjelSR7aiA/A+3YZFsiCUVDjo5 UAuIGSq6ZLr+w== 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 1xOHKk-0000000AaH5-1VOP; Tue, 03 Nov 2026 16:26:02 +0000 Date: Tue, 03 Nov 2026 16:26:01 +0000 Message-ID: <865wyd3mqu.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Vincent Donnefort , Oliver Upton , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Raghavendra Rao Ananta Subject: Re: [PATCH 1/3] KVM: arm64: Don't walk the whole IPA space when destroying a pKVM stage-2 In-Reply-To: References: <20261103084742.1302597-1-fuad.tabba@linux.dev> <20261103084742.1302597-2-fuad.tabba@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: fuad.tabba@linux.dev, vdonnefort@google.com, oupton@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, 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, rananta@google.com 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 Tue, 03 Nov 2026 16:15:03 +0000, Fuad Tabba wrote: > > Hi Vincent, > > On Tue, 03 Nov 2026 14:52:36 +0000, Vincent Donnefort > wrote: > [...] > > > Walk the mapping tree once instead, and reschedule after passing each > > > mapping to the reclaim or unshare helper. The unshare helper can't > > > reschedule itself, as the map and unmap paths call it under the > > > mmu_lock. A failed unshare now leaves only its own mapping behind, not > > > the rest of its chunk. > > > > Not a problem now, but don't we make the device assignment story harder? > > I don't think so. In Android, the host doesn't track the MMIO of a > device assigned to a protected guest. The hypervisor maps it into the > guest, and gives it back to the host in __pkvm_start_teardown_vm(), > before the host reclaims anything. So the walk this patch changes > shouldn't reach it. > > > > > > > > > Fixes: 4ddfab5436b69 ("KVM: arm64: Reschedule as needed when destroying the stage-2 page-tables") > > > > Isn't it an optimisation? > > No, it fixes a regression: 4ddfab5436b6 replaced a single walk of the > mapping tree with the 2^27 lookups, as described in the commit > message. But that's a configuration that simply does not exist in HW. Therefore this isn't a fix, this is an opportunistic optimisation that may or may not become useful. So not a fix, no backporting. M. -- Without deviation from the norm, progress is not possible.