* [PATCH v2 0/2] KVM: arm64: Dirty logging fixes/cleanups
@ 2026-10-29 17:52 Wei-Lin Chang
2026-10-29 17:52 ` [PATCH v2 1/2] KVM: arm64: Fix dirty logging detection in ring-only mode Wei-Lin Chang
2026-10-29 17:52 ` [PATCH v2 2/2] KVM: arm64: Remove stale remark on canonical IPA alignment Wei-Lin Chang
0 siblings, 2 replies; 4+ messages in thread
From: Wei-Lin Chang @ 2026-10-29 17:52 UTC (permalink / raw)
To: linux-arm-kernel, kvmarm, linux-kernel
Cc: Marc Zyngier, Oliver Upton, Fuad Tabba, Joey Gouly,
Steffen Eiden, Suzuki K Poulose, Zenghui Yu, Catalin Marinas,
Will Deacon, Mark Rutland, Gavin Shan, Leonardo Bras,
Wei-Lin Chang
Hi,
These are two fixes/cleanups I found when reading the code. It fixes
dirty logging detection in ring-only mode and updates a stale comment.
Please view the patches for more detail.
* Changes from v1 ([1]):
- Keep memslot_is_logging() and use kvm_slot_dirty_track_enabled() in
it. This preserves the RO memslot check.
- Change patch 2 to updating the stale comment only, the original
change is obsolete now.
- Collect Reviewed-by and Tested-by tags from Fuad (thanks!).
Thanks!
[1]: https://lore.kernel.org/kvmarm/20260605153248.2412064-1-weilin.chang@arm.com/
Wei-Lin Chang (2):
KVM: arm64: Fix dirty logging detection in ring-only mode
KVM: arm64: Remove stale remark on canonical IPA alignment
arch/arm64/kvm/mmu.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] KVM: arm64: Fix dirty logging detection in ring-only mode
2026-10-29 17:52 [PATCH v2 0/2] KVM: arm64: Dirty logging fixes/cleanups Wei-Lin Chang
@ 2026-10-29 17:52 ` Wei-Lin Chang
2026-10-29 17:52 ` [PATCH v2 2/2] KVM: arm64: Remove stale remark on canonical IPA alignment Wei-Lin Chang
1 sibling, 0 replies; 4+ messages in thread
From: Wei-Lin Chang @ 2026-10-29 17:52 UTC (permalink / raw)
To: linux-arm-kernel, kvmarm, linux-kernel
Cc: Marc Zyngier, Oliver Upton, Fuad Tabba, Joey Gouly,
Steffen Eiden, Suzuki K Poulose, Zenghui Yu, Catalin Marinas,
Will Deacon, Mark Rutland, Gavin Shan, Leonardo Bras,
Wei-Lin Chang, stable
When checking whether a memslot has dirty logging enabled, the
KVM_MEM_LOG_DIRTY_PAGES flag is the source of truth. Previously in
memslot_is_logging() we were testing the dirty bitmap only and did not
consider dirty ring.
With the ring and no bitmap, a logged memslot can still get block
mappings, so guest writes to most of a block are never logged and a
migration can copy stale memory.
Fix this by using kvm_slot_dirty_track_enabled() instead which checks
KVM_MEM_LOG_DIRTY_PAGES, within memslot_is_logging().
Fixes: 9cb1096f8590 ("KVM: arm64: Enable ring-based dirty memory tracking")
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Tested-by: Fuad Tabba <fuad.tabba@linux.dev>
Signed-off-by: Wei-Lin Chang <weilin.chang@arm.com>
Cc: stable@vger.kernel.org
---
arch/arm64/kvm/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index 705f6d84770e..c7df646af79f 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -176,7 +176,7 @@ static int kvm_mmu_split_huge_pages(struct kvm *kvm, phys_addr_t addr,
static bool memslot_is_logging(struct kvm_memory_slot *memslot)
{
- return memslot->dirty_bitmap && !(memslot->flags & KVM_MEM_READONLY);
+ return kvm_slot_dirty_track_enabled(memslot) && !(memslot->flags & KVM_MEM_READONLY);
}
static int pkvm_flush_remote_tlbs(struct kvm *kvm)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] KVM: arm64: Remove stale remark on canonical IPA alignment
2026-10-29 17:52 [PATCH v2 0/2] KVM: arm64: Dirty logging fixes/cleanups Wei-Lin Chang
2026-10-29 17:52 ` [PATCH v2 1/2] KVM: arm64: Fix dirty logging detection in ring-only mode Wei-Lin Chang
@ 2026-10-29 17:52 ` Wei-Lin Chang
2026-10-29 18:39 ` Fuad Tabba
1 sibling, 1 reply; 4+ messages in thread
From: Wei-Lin Chang @ 2026-10-29 17:52 UTC (permalink / raw)
To: linux-arm-kernel, kvmarm, linux-kernel
Cc: Marc Zyngier, Oliver Upton, Fuad Tabba, Joey Gouly,
Steffen Eiden, Suzuki K Poulose, Zenghui Yu, Catalin Marinas,
Will Deacon, Mark Rutland, Gavin Shan, Leonardo Bras,
Wei-Lin Chang
Commit 3b8ce2b5132ae ("KVM: arm64: Use a variable for the canonical IPA
in kvm_s2_fault_map()") created a variable to store the canonical IPA,
instead of calculating it when needed. It moved the aligning just before
mark_page_dirty_in_slot() to an earlier place but did not update the
comment.
Remove the stale part of the comment.
Signed-off-by: Wei-Lin Chang <weilin.chang@arm.com>
---
arch/arm64/kvm/mmu.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index c7df646af79f..695c6229a216 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -2232,11 +2232,7 @@ static int kvm_s2_fault_map(const struct kvm_s2_fault_desc *s2fd,
kvm_fault_unlock(kvm);
kfree(mapping);
- /*
- * 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).
- */
+ /* Mark the page dirty only if the fault is handled successfully. */
if (writable && !ret)
mark_page_dirty_in_slot(kvm, s2fd->memslot,
gpa_to_gfn(canonical_ipa));
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 2/2] KVM: arm64: Remove stale remark on canonical IPA alignment
2026-10-29 17:52 ` [PATCH v2 2/2] KVM: arm64: Remove stale remark on canonical IPA alignment Wei-Lin Chang
@ 2026-10-29 18:39 ` Fuad Tabba
0 siblings, 0 replies; 4+ messages in thread
From: Fuad Tabba @ 2026-10-29 18:39 UTC (permalink / raw)
To: Wei-Lin Chang
Cc: linux-arm-kernel, kvmarm, linux-kernel, Marc Zyngier,
Oliver Upton, Joey Gouly, Steffen Eiden, Suzuki K Poulose,
Zenghui Yu, Catalin Marinas, Will Deacon, Mark Rutland,
Gavin Shan, Leonardo Bras
On Thu, 29 Oct 2026 at 17:53, Wei-Lin Chang <weilin.chang@arm.com> wrote:
>
> Commit 3b8ce2b5132ae ("KVM: arm64: Use a variable for the canonical IPA
> in kvm_s2_fault_map()") created a variable to store the canonical IPA,
> instead of calculating it when needed. It moved the aligning just before
> mark_page_dirty_in_slot() to an earlier place but did not update the
> comment.
>
> Remove the stale part of the comment.
>
> Signed-off-by: Wei-Lin Chang <weilin.chang@arm.com>
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Cheers,
/fuad
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-29 18:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 17:52 [PATCH v2 0/2] KVM: arm64: Dirty logging fixes/cleanups Wei-Lin Chang
2026-10-29 17:52 ` [PATCH v2 1/2] KVM: arm64: Fix dirty logging detection in ring-only mode Wei-Lin Chang
2026-10-29 17:52 ` [PATCH v2 2/2] KVM: arm64: Remove stale remark on canonical IPA alignment Wei-Lin Chang
2026-10-29 18:39 ` Fuad Tabba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®