From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Zyngier Date: Sat, 14 Dec 2019 10:37:10 +0000 Subject: Re: [PATCH 1/7] KVM: Pass mmu_notifier_range down to kvm_unmap_hva_range() Message-Id: <86fthni46h.wl-maz@kernel.org> List-Id: References: <20191213182503.14460-1-maz@kernel.org> <20191213182503.14460-2-maz@kernel.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Suzuki Kuruppassery Poulose Cc: James Morse , Julien Thierry , James Hogan , Paul Mackerras , Paolo Bonzini , Radim =?UTF-8?B?S3LEjW3DocWZ?= , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org Hi Suzuki, On Fri, 13 Dec 2019 18:59:32 +0000, Suzuki Kuruppassery Poulose 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 > > > > 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.