KVM: PPC: Book3S HV: Fix bug causing loss of page dirty state
Subsystems (3)
PATCH 1/1 KVM: PPC: Book3S HV: Fix bug causing loss of page dirty state
This fixes a bug where adding a new guest HPT entry via the H_ENTER hcall would lose the "changed" bit in the reverse map information for the guest physical page being mapped. The result was that the KVM_GET_DIRTY_LOG could return a zero bit for the page even though the page had been modified by the guest.
This fixes it by only modifying the index and present bits in the reverse map entry, thus preserving the reference and change bits. We were also unnecessarily setting the reference bit, and this fixes that too.
---
This is against Alex Graf's kvm-ppc-next branch plus the series of three patches I just sent, but it should be independent of that series.
arch/powerpc/kvm/book3s_hv_rm_mmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kvm/book3s_hv_rm_mmu.c +3 -3
@@ -59,10 +59,10 @@ void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev, head->back = pte_index; }else { rev->forw = rev->back = pte_index; - i = pte_index; + *rmap = (*rmap & ~KVMPPC_RMAP_INDEX ) | + pte_index |KVMPPC_RMAP_PRESENT ; } -smp_wmb (); - *rmap = i |KVMPPC_RMAP_REFERENCED |KVMPPC_RMAP_PRESENT ;/* unlock */ +unlock_rmap (rmap); }EXPORT_SYMBOL_GPL (kvmppc_add_revmap_chain);
Signature · 1 line
1.7.10.4
Alexander Graf
AppliedQuoted 6 lines · Paul Mackerras
This fixes a bug where adding a new guest HPT entry via the
H_ENTERhcall would lose the "changed" bit in the reverse map information for the guest physical page being mapped. The result was that theKVM_GET_DIRTY_LOGcould return a zero bit for the page even though the page had been modified by the guest.
Quoted 6 lines
This fixes it by only modifying the index and present bits in the reverse map entry, thus preserving the reference and change bits. We were also unnecessarily setting the reference bit, and this fixes that too.
Signed-off-by Paul Mackerras <[email protected]>
Thanks, applied to kvm-ppc-next.
Alex
Quoted 32 lines
---
This is against Alex Graf's kvm-ppc-next branch plus the series of three patches I just sent, but it should be independent of that series.
arch/powerpc/kvm/book3s_hv_rm_mmu.c| 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)arch/powerpc/kvm/book3s_hv_rm_mmu.c +3
-3@@ -59,10 +59,10 @@ void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev, head->back = pte_index; }else { rev->forw = rev->back = pte_index; - i = pte_index; + *rmap = (*rmap & ~KVMPPC_RMAP_INDEX ) | + pte_index |KVMPPC_RMAP_PRESENT ; } -smp_wmb (); - *rmap = i |KVMPPC_RMAP_REFERENCED |KVMPPC_RMAP_PRESENT ;/* unlock */ +unlock_rmap (rmap); }EXPORT_SYMBOL_GPL (kvmppc_add_revmap_chain);Signature · 6 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html