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=1793723165; b=Y6q5pJ+3+/Dvc7m08EjbnI06CI/zvsKRMhYaXwLuEKMYMBeqet3gOccKDJ3K6J5snfv3 6as5mW4PoDFsmgY5E1FUcom9FFZK+AfZWZnjx0dVZyKoOWH63wWDams+7NKqHz3JGROXf y94gPFOcHCzXp826qSceGqItghFKQwGTAD5RT1nEKgdhAEcx51NGpxq86yhjU2bGqTNQE j8l2e8DvR8JFUGcETWrJqkCweg2E9j6k6gwLQ0C1hyk8ird74ToASe1z4lIFEpG2zeAOK SSITetrX4AxeeRPK7VvJyAAaM5Lue8tmGJboQdzz1RC+1lGhG8LWJCHD+v+8r1h4jzw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793723165; 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=NsCA1FKYyEC6+lnEUbeQgCTjVtjYpHvweOvN+u1DACA=; b=iA0xo49IGYhH4pQQD3Hv2mCUyMNhNOdaLVB4j6vv5J8nGd/O4gc+tQpdBpFL7B86O6P7 dutzjxoCOyDpYtXKiiqyYEumC4PUCaX7MWZ92HsQp+xP1OgoZIZ6EctaaprLvMeXvb1KU XgcNMZVbBmR1getwI/kNHzCdjdq+betcpfgro/BQlgFnGmsWk0EIyEcgvpkSKyLzh6VJw GXzpW4ynuRKQ08MO+zyvMixAx4xO0GEvsUk06hftobFdHWs3pnV7WM88u1Ys5dFyxBPZP 2W2ae1AbpvtdaBt+tKlTmLra2QmE/aTkhU29YMXqmCym15pQaZnf7ycvtC5xCuHJnxw== 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=XY3qZadr; 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 CC841606A328; Tue, 3 Nov 2026 16:26:04 +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=XY3qZadr 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-Mailing-List: linux-kernel@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: 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 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.