Skip to content

Commit 37e9d1a

Browse files
bibo-maochenhuacai
authored andcommitted
LoongArch: KVM: Set page with write attribute if dirty track disabled
With secondary MMU page table, if there is a read page fault, the page's write attribute will not set even if it is writable from master MMU page table. This logic only works if dirty tracking is enabled, so page table should be set with _PAGE_WRITE if dirty tracking is disabled. It reduces extra page fault on secondary MMU page table if a VM finishes migration, when the master MMU page table is ready and the secondary MMU page is fresh. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 62cda5e commit 37e9d1a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/loongarch/kvm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ static int kvm_map_page(struct kvm_vcpu *vcpu, unsigned long gpa, bool write)
857857

858858
if (writeable) {
859859
prot_bits = kvm_pte_mkwriteable(prot_bits);
860-
if (write)
860+
if (write || !kvm_slot_dirty_track_enabled(memslot))
861861
prot_bits = kvm_pte_mkdirty(prot_bits);
862862
}
863863

0 commit comments

Comments
 (0)