Skip to content

Commit 38753cb

Browse files
coltonlewisMarc Zyngier
authored andcommitted
KVM: arm64: Move data barrier to end of split walk
This DSB guarantees page table updates have been made visible to the hardware table walker. Moving the DSB from stage2_split_walker() to after the walk is finished in kvm_pgtable_stage2_split() results in a roughly 70% reduction in Clear Dirty Log Time in dirty_log_perf_test (modified to use eager page splitting) when using huge pages. This gain holds steady through a range of vcpus used (tested 1-64) and memory used (tested 1-64GB). This is safe to do because nothing else is using the page tables while they are still being mapped and this is how other page table walkers already function. None of them have a data barrier in the walker itself because relative ordering of table PTEs to table contents comes from the release semantics of stage2_make_pte(). Signed-off-by: Colton Lewis <[email protected]> Acked-by: Oliver Upton <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 7c626ce commit 38753cb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/arm64/kvm/hyp/pgtable.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,6 @@ static int stage2_split_walker(const struct kvm_pgtable_visit_ctx *ctx,
15471547
*/
15481548
new = kvm_init_table_pte(childp, mm_ops);
15491549
stage2_make_pte(ctx, new);
1550-
dsb(ishst);
15511550
return 0;
15521551
}
15531552

@@ -1559,8 +1558,11 @@ int kvm_pgtable_stage2_split(struct kvm_pgtable *pgt, u64 addr, u64 size,
15591558
.flags = KVM_PGTABLE_WALK_LEAF,
15601559
.arg = mc,
15611560
};
1561+
int ret;
15621562

1563-
return kvm_pgtable_walk(pgt, addr, size, &walker);
1563+
ret = kvm_pgtable_walk(pgt, addr, size, &walker);
1564+
dsb(ishst);
1565+
return ret;
15641566
}
15651567

15661568
int __kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm_s2_mmu *mmu,

0 commit comments

Comments
 (0)