[PATCH 2/2] KVM: arm64: Remove superfluous aligning of gfn for dirty logging
Leonardo Bras
leo.bras at arm.com
Mon Jun 8 08:23:05 PDT 2026
On Fri, Jun 05, 2026 at 04:32:48PM +0100, Wei-Lin Chang wrote:
> Stage-2 mapping size is forced to PAGE_SIZE when dirty logging is
> enabled for a memslot, therefore we don't need to align it down to
> a possibly larger vma size or THP adjusted size, they won't happen.
>
IIRC there was some effort being made in terms of tracking in LEVEL2 block
granularity instead of LEVEL3 (PAGE_SIZE). It makes sense as some platforms
can have very fast networking so setup time is more relevant than actual
sending time.
Would not making this change affect such effort?
Thanks!
Leo
> Signed-off-by: Wei-Lin Chang <weilin.chang at arm.com>
> ---
> arch/arm64/kvm/mmu.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 06c46124d3e7..d1f6ff7c2943 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -2050,13 +2050,12 @@ static int kvm_s2_fault_map(const struct kvm_s2_fault_desc *s2fd,
>
> /*
> * Mark the page dirty only if the fault is handled successfully,
> - * making sure we adjust the canonical IPA if the mapping size has
> - * been updated (via a THP upgrade, for example).
> + * mapping size is forced to PAGE_SIZE if dirty logging is enabled,
> + * so we don't have to adjust the canonical IPA here.
> */
> if (writable && !ret) {
> - phys_addr_t ipa = gfn_to_gpa(get_canonical_gfn(s2fd, s2vi));
> - ipa &= ~(mapping_size - 1);
> - mark_page_dirty_in_slot(kvm, s2fd->memslot, gpa_to_gfn(ipa));
> + gfn_t canonical_gfn = get_canonical_gfn(s2fd, s2vi);
> + mark_page_dirty_in_slot(kvm, s2fd->memslot, canonical_gfn);
> }
>
> if (ret != -EAGAIN)
> --
> 2.43.0
>
More information about the linux-arm-kernel
mailing list