RE: [PATCH V2 2/13] KVM/MMU: Add tlb flush with range helper function

From: Michael Kelley (EOSG)
Date: Wed Sep 19 2018 - 12:07:23 EST


From: Tianyu Lan Sent: Monday, September 17, 2018 8:18 PM
>
> +static void kvm_flush_remote_tlbs_with_range(struct kvm *kvm,
> + struct kvm_tlb_range *range)
> +{
> + int ret = -ENOTSUPP;
> +
> + if (range && kvm_x86_ops->tlb_remote_flush_with_range) {
> + /*
> + * Read tlbs_dirty before setting KVM_REQ_TLB_FLUSH in
> + * kvm_make_all_cpus_request.
> + */
> + long dirty_count = smp_load_acquire(&kvm->tlbs_dirty);
> +
> + ret = kvm_x86_ops->tlb_remote_flush_with_range(kvm, range);
> + cmpxchg(&kvm->tlbs_dirty, dirty_count, 0);
> + }

The comment and the code that manipulates kvm->tlbs_dirty appears
to have been copied from kvm_flush_remote_tlbs(). But the above
code doesn't call kvm_make_all_cpus_request(). I haven't traced
all the details, but it seems like the comment should be updated,
or the code isn't needed.

Michael