Skip to contentSkip to conversation

KVM:arm/arm64: dcache need be coherent unconditionally

PATCH [email protected] 1 participant 1 message Mar 10, 2018 KVM arm64

lore
Share & tools
lore
#0 lore raw
Quoted 39 lines · Peng Hao
Quoted 26 lines

For emulation devices just like vga, keeping coherent dcache between guest and host timely is needed.
Now the display of vnc-viewer will not update continuously and the patch can fix up.

---
 virt/kvm/arm/mmu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
virt/kvm/arm/mmu.c +1 -2
index ec62d1c..4a28395e 100644
@@ -1416,8 +1416,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
             kvm_set_pfn_dirty(pfn);
         }
 
-        if (fault_status != FSC_PERM)
-            clean_dcache_guest_page(pfn, PMD_SIZE);
+        clean_dcache_guest_page(pfn, PMD_SIZE);
 
         if (exec_fault) {
             new_pmd = kvm_s2pmd_mkexec(new_pmd);

virt/kvm/arm/mmu.c static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, · line 1443

Quoted 9 lines
virt/kvm/arm/mmu.c +1 -2
@@ -1438,8 +1437,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
             mark_page_dirty(kvm, gfn);
         }
 
-        if (fault_status != FSC_PERM)
-            clean_dcache_guest_page(pfn, PAGE_SIZE);
+        clean_dcache_guest_page(pfn, PAGE_SIZE);
 
         if (exec_fault) {
             new_pte = kvm_s2pte_mkexec(new_pte);

I'm sorry, but I have to NAK this.

Quoted 3 lines

You're papering over the fundamental issue that you're accessing a cacheable alias of a non cacheable memory. The architecture is very clear about why this doesn't work, and KVM implements the architecture.

I find that I just encounter the problem after the commit '15303ba5d1cd9b28d03a980456c0978c0ea3b208 " .
The commit contains "icache invalidation optimizations, improving VM startup time",it changes
from unconditionally calling coherent_cache_guest_page(including dcache handle) to conditionally calling clean_dcache_guest_page.
I trace the display of vnc abnormally and find it generate data abort in vga
address region with FSC_PERM,and it will not call clean_dcache_guest_page . So I think should recover to uncontionally calling clean_dcache_guest_page.

Thanks.

Quoted 9 lines

If you want this to work, map your VGA device as cacheable, add cache maintenance to QEMU, or use another frame-buffer emulation that doesn't require such a gack.

Thanks,

   M.
Signature · 1 line
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel