Subject: Re: [PATCH 1/7] KVM: Pass mmu_notifier_range down to kvm_unmap_hva_range()

From: Marc Zyngier <[email-masked]>
Date: Sat, 14 Dec 2019 10:37:10 +0000

Hi Suzuki,

On Fri, 13 Dec 2019 18:59:32 +0000,
Suzuki Kuruppassery Poulose <[email-masked]> wrote:
> 
> Hi Marc,
> 
> 
> On 13/12/2019 18:24, Marc Zyngier wrote:
> > kvm_unmap_hva_range() is currently passed both start and end
> > fields from the mmu_notifier_range structure. As this struct
> > now contains important information about the reason of the
> > unmap (the event field), replace the start/end parameters
> > with the range struct, and update all architectures.
> > 
> > No functionnal change.
> > 
> > Signed-off-by: Marc Zyngier <[email-masked]>
> 
> 
> > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> > index 00268290dcbd..7c3665ad1035 100644
> > --- a/virt/kvm/kvm_main.c
> > +++ b/virt/kvm/kvm_main.c
> > @@ -158,7 +158,7 @@ static unsigned long long kvm_createvm_count;
> >   static unsigned long long kvm_active_vms;
> >     __weak int kvm_arch_mmu_notifier_invalidate_range(struct kvm
> > *kvm,
> > -		unsigned long start, unsigned long end, bool blockable)
> > +		const struct mmu_notifier_range *range, bool blockable)
> >   {
> >   	return 0;
> >   }
> > @@ -415,7 +415,7 @@ static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
> >   	 * count is also read inside the mmu_lock critical section.
> >   	 */
> >   	kvm->mmu_notifier_count++;
> > -	need_tlb_flush = kvm_unmap_hva_range(kvm, range->start, range->end);
> > +	need_tlb_flush = kvm_unmap_hva_range(kvm, range);
> >   	need_tlb_flush |= kvm->tlbs_dirty;
> >   	/* we've to flush the tlb before the pages can be freed */
> >   	if (need_tlb_flush)
> > @@ -423,8 +423,7 @@ static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
> >     	spin_unlock(&kvm->mmu_lock);
> >   -	ret = kvm_arch_mmu_notifier_invalidate_range(kvm,
> > range->start,
> > -					range->end,
> > +	ret = kvm_arch_mmu_notifier_invalidate_range(kvm, range,
> >   					mmu_notifier_range_blockable(range));
> 
> minor nit:
> 
> Since we now have the range passed on to the arch hooks, we could get
> rid of the "blockable" too, as it is something you can deduce from the
> range.

Absolutely. That'd be a nice cleanup.

> Otherwise looks good to me.

Thanks,

	M.

-- 
Jazz is not dead, it just smells funny.

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