On Fri, Oct 07, 2022, Sean Christopherson wrote: > On Thu, Sep 15, 2022, Shivam Kumar wrote: > Let's keep kvm_vcpu_check_dirty_quota(), IMO that's still the least awful name. > > [*] https://lore.kernel.org/all/Yo+82LjHSOdyxKzT@xxxxxxxxxx Actually, I take that back. The code snippet itself is also flawed. If userspace increases the quota (or disables it entirely) between KVM snapshotting the quota and making the request, then there's no need for KVM to exit to userspace. So I think this can be: static void kvm_vcpu_is_dirty_quota_exchausted(struct kvm_vcpu *vcpu) { #ifdef CONFIG_HAVE_KVM_DIRTY_QUOTA u64 dirty_quota = READ_ONCE(vcpu->run->dirty_quota); return dirty_quota && (vcpu->stat.generic.pages_dirtied >= dirty_quota); #else return false; #endif } and the usage becomes: if (kvm_vcpu_is_dirty_quota_exhausted(vcpu)) kvm_make_request(KVM_REQ_DIRTY_QUOTA_EXIT, vcpu); More thoughts in the x86 patch.