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 3A4C2606A68B for ; Tue, 1 Dec 2026 07:35:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=uqrtPDyQ; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=e/OQOP9y 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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From: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=qZho7vng3l59dJ0RGHE3Szzfo9bmUq2aQrt+szliiLk=; b=uqrtPDyQsZMERa9k425WQYw/56 JVfSFcBiW7neasJvYFEA7JXmaRFIeyI42xjVtUqvvRpRrDJJHPpzmdXMK7Oi0InMs6rrb6npSsZDu 9t7sTeRCi7v37nKF79nqT+ZOiHALxkhu1YRf/CK7dQA2ghsk1H7wvbKlLKkpHCpYSiv1Jq6Y5gFZ9 TYxQUs5mbEfIKqZVL2N3JZRQ7LxmUT9m/9vDg6UMLFHM9J3n0tqrtlq0kooV7YZzpNaWlRa69Gtsb Vw6IbyS8+IjyYXpp8ZJO22DgagqAZsjpznqzw53d9IPL+qb4sGvCzfr9clQT+zEnT394jLcUbU6PU zz97vnYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYIO2-00000006vA1-10NV; Tue, 01 Dec 2026 07:34:50 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYIO0-00000006v9D-3Su7 for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2026 07:34:48 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 6A30645241; Tue, 1 Dec 2026 07:34:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2ECD1F0093B; Tue, 1 Dec 2026 07:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796110488; bh=qZho7vng3l59dJ0RGHE3Szzfo9bmUq2aQrt+szliiLk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=e/OQOP9yJ09ktSjhVbxr6mHY1tUxMqlcifrgE1FLJPx4WGcVaPHQYuPj3BuVSViSQ sQaWWY0KvQT9WgMbtLfED9yTuJbq5lvsrKyVE487YhpmhnxLf8m6qffolZoZfC7LGQ GdFKK2yRn3+LtwWYwjuGD0Qwt0IgQo/PoPc2YTJbuNMWoQC49SNTWnhHeTM0ITlzA6 k45t5vdbh6eORr626kEfc9v6YeuKvjlvuoNzn1bgIL/EJZOmFTEEVk7SglH45Gukju o0jgeG8eTUiqyNwVybmj/xMHwae1A1y0Tz4jZ6ZBM/LiKEbP6U3MMp8Nd3DjxeumuV Q0H+pxN3akcMQ== Date: Mon, 30 Nov 2026 23:34:46 -0800 From: Oliver Upton To: Vincent Donnefort Cc: maz@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, kernel-team@android.com, fuad.tabba@linux.dev, qperret@google.com, weilin.chang@arm.com, Keir Fraser Subject: Re: [PATCH v5 01/25] KVM: arm64: Prefault host stage-2 entries on block split Message-ID: References: <20261130155710.2371874-1-vdonnefort@google.com> <20261130155710.2371874-2-vdonnefort@google.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130155710.2371874-2-vdonnefort@google.com> 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=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hi Vincent, On Mon, Nov 30, 2026 at 03:56:45PM +0000, Vincent Donnefort wrote: > + pa = ALIGN_DOWN(ctx->addr, kvm_granule_size(ctx->level)); > + for (i = 0; i < PTRS_PER_PTE; ++i, ++ptep, pa += kvm_granule_size(ctx->level + 1)) { > + kvm_pte_t pte = kvm_init_valid_leaf_pte(pa, block_pte, ctx->level + 1); > + > + /* > + * Skip ptes in the range being modified by the caller if we're > + * installing last level entries. Otherwise, we need to > + * temporarily put in a valid mapping to make sure the > + * prefaulting logic is triggered on the next > + * stage2_map_walk_leaf(). This adds an unnecessary TLBI as > + * we'll presumably re-break the freshly installed block, but > + * that should happen very infrequently. > + */ > + if ((ctx->level < (KVM_PGTABLE_LAST_LEVEL - 1)) || > + (pa < ctx->addr) || (pa >= ctx->end)) { > + *ptep = pte; > + if (counted) > + ctx->mm_ops->get_page(ptep); > + } So the aim of doing a custom split function rather than reusing kvm_pgtable_stage2_split() is eliding the temporary mappings? I'd rather we have a single implementation of "replace block with fully mapped table". Thanks, Oliver > + } > +} > + > static int stage2_map_walk_leaf(const struct kvm_pgtable_visit_ctx *ctx, > struct stage2_map_data *data) > { > struct kvm_pgtable_mm_ops *mm_ops = ctx->mm_ops; > + struct kvm_pgtable *pgt = data->mmu->pgt; > kvm_pte_t *childp, new; > int ret; > > @@ -1053,6 +1095,9 @@ static int stage2_map_walk_leaf(const struct kvm_pgtable_visit_ctx *ctx, > if (!childp) > return -ENOMEM; > > + if (pgt->flags & KVM_PGTABLE_S2_IDMAP) > + stage2_map_prefault_idmap(ctx, childp); > + > if (!stage2_try_break_pte(ctx, data->mmu)) { > mm_ops->put_page(childp); > return -EAGAIN; > @@ -1151,6 +1196,7 @@ int kvm_pgtable_stage2_annotate(struct kvm_pgtable *pgt, u64 addr, u64 size, > return -EINVAL; > > ret = kvm_pgtable_walk(pgt, addr, size, &walker); > + dsb(ishst); > return ret; > } > > -- > 2.56.1.839.g22a8290db9-goog > >