* [PATCH v2] KVM: arm64: Move data barrier to end of split walk
@ 2024-08-08 17:42 Colton Lewis
2024-08-08 17:55 ` Oliver Upton
2024-08-22 14:25 ` (subset) " Marc Zyngier
0 siblings, 2 replies; 4+ messages in thread
From: Colton Lewis @ 2024-08-08 17:42 UTC (permalink / raw)
To: kvm
Cc: Marc Zyngier, Oliver Upton, Ricardo Koller, James Morse,
Suzuki K Poulose, Zenghui Yu, Catalin Marinas, Will Deacon,
linux-arm-kernel, kvmarm, linux-kernel, Colton Lewis
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 <coltonlewis@google.com>
---
v2:
* Added more information about purpose of DSB to commit message
* Rebased to v6.11-rc2
v1:
https://lore.kernel.org/kvmarm/20240718223519.1673835-1-coltonlewis@google.com/
arch/arm64/kvm/hyp/pgtable.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
index 9e2bbee77491..9788af2ca8c0 100644
--- a/arch/arm64/kvm/hyp/pgtable.c
+++ b/arch/arm64/kvm/hyp/pgtable.c
@@ -1547,7 +1547,6 @@ static int stage2_split_walker(const struct kvm_pgtable_visit_ctx *ctx,
*/
new = kvm_init_table_pte(childp, mm_ops);
stage2_make_pte(ctx, new);
- dsb(ishst);
return 0;
}
@@ -1559,8 +1558,11 @@ int kvm_pgtable_stage2_split(struct kvm_pgtable *pgt, u64 addr, u64 size,
.flags = KVM_PGTABLE_WALK_LEAF,
.arg = mc,
};
+ int ret;
- return kvm_pgtable_walk(pgt, addr, size, &walker);
+ ret = kvm_pgtable_walk(pgt, addr, size, &walker);
+ dsb(ishst);
+ return ret;
}
int __kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm_s2_mmu *mmu,
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] KVM: arm64: Move data barrier to end of split walk
2024-08-08 17:42 [PATCH v2] KVM: arm64: Move data barrier to end of split walk Colton Lewis
@ 2024-08-08 17:55 ` Oliver Upton
2024-08-08 19:58 ` Colton Lewis
2024-08-22 14:25 ` (subset) " Marc Zyngier
1 sibling, 1 reply; 4+ messages in thread
From: Oliver Upton @ 2024-08-08 17:55 UTC (permalink / raw)
To: Colton Lewis
Cc: kvm, Marc Zyngier, Ricardo Koller, James Morse, Suzuki K Poulose,
Zenghui Yu, Catalin Marinas, Will Deacon, linux-arm-kernel,
kvmarm, linux-kernel
Hi Colton,
On Thu, Aug 08, 2024 at 05:42:43PM +0000, Colton Lewis wrote:
> 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).
Would you have time to put together a patch for the dirty_log_perf_test
changes you've made? This would be quite valuable for testing future
improvements to eager page splitting.
> 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 <coltonlewis@google.com>
The diff itself looks good to me, so:
Acked-by: Oliver Upton <oliver.upton@linux.dev>
--
Thanks,
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] KVM: arm64: Move data barrier to end of split walk
2024-08-08 17:55 ` Oliver Upton
@ 2024-08-08 19:58 ` Colton Lewis
0 siblings, 0 replies; 4+ messages in thread
From: Colton Lewis @ 2024-08-08 19:58 UTC (permalink / raw)
To: Oliver Upton
Cc: kvm, maz, ricarkol, james.morse, suzuki.poulose, yuzenghui,
catalin.marinas, will, linux-arm-kernel, kvmarm, linux-kernel
Oliver Upton <oliver.upton@linux.dev> writes:
> Hi Colton,
> On Thu, Aug 08, 2024 at 05:42:43PM +0000, Colton Lewis wrote:
>> 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).
> Would you have time to put together a patch for the dirty_log_perf_test
> changes you've made? This would be quite valuable for testing future
> improvements to eager page splitting.
I can do that.
>> 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 <coltonlewis@google.com>
> The diff itself looks good to me, so:
> Acked-by: Oliver Upton <oliver.upton@linux.dev>
> --
> Thanks,
> Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: (subset) [PATCH v2] KVM: arm64: Move data barrier to end of split walk
2024-08-08 17:42 [PATCH v2] KVM: arm64: Move data barrier to end of split walk Colton Lewis
2024-08-08 17:55 ` Oliver Upton
@ 2024-08-22 14:25 ` Marc Zyngier
1 sibling, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2024-08-22 14:25 UTC (permalink / raw)
To: kvm, Colton Lewis
Cc: Oliver Upton, Ricardo Koller, James Morse, Suzuki K Poulose,
Zenghui Yu, Catalin Marinas, Will Deacon, linux-arm-kernel,
kvmarm, linux-kernel
On Thu, 08 Aug 2024 17:42:43 +0000, Colton Lewis wrote:
> 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).
>
> [...]
Applied to next, thanks!
[1/1] KVM: arm64: Move data barrier to end of split walk
commit: 38753cbc4dca431d4354319c7481f6bd1a212baf
Cheers,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-22 14:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08 17:42 [PATCH v2] KVM: arm64: Move data barrier to end of split walk Colton Lewis
2024-08-08 17:55 ` Oliver Upton
2024-08-08 19:58 ` Colton Lewis
2024-08-22 14:25 ` (subset) " Marc Zyngier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox