Re: [PATCH] KVM: x86/mmu: Don't rebuild page when the page is synced and no tlb flushing is required

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/24/22 21:17, Sean Christopherson wrote:
+static int kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
  			 struct list_head *invalid_list)
  {
  	int ret = vcpu->arch.mmu->sync_page(vcpu, sp);
- if (ret < 0) {
+	if (ret < 0)
  		kvm_mmu_prepare_zap_page(vcpu->kvm, sp, invalid_list);
-		return false;
-	}
-
-	return !!ret;
+	return ret;
Hrm, this creates an oddity in mmu_sync_children(), which does a logical-OR of
the result into a boolean.  It doesn't actually change the functionality since
kvm_mmu_remote_flush_or_zap() will prioritize invalid_list, but it's weird.

What about checking invalid_list directly and keeping the boolean return?  Compile
tested only.

It's even better to check

        flush |= kvm_sync_page(vcpu, sp, &invalid_list) > 0;

in mmu_sync_children. If the returned value is <0, then the page is added to invalid_list and there is no need to set flush = true, just like there is no need to call kvm_flush_remote_tlbs() in kvm_mmu_get_page().

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux