[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v10 5/9] KVM: Use gfn instead of hva for mmu_notifier_retry
From: |
Chao Peng |
Subject: |
Re: [PATCH v10 5/9] KVM: Use gfn instead of hva for mmu_notifier_retry |
Date: |
Fri, 9 Dec 2022 14:24:31 +0800 |
On Tue, Dec 06, 2022 at 03:48:50PM +0000, Fuad Tabba wrote:
...
> >
> > > > */
> > > > - if (unlikely(kvm->mmu_invalidate_in_progress) &&
> > > > - hva >= kvm->mmu_invalidate_range_start &&
> > > > - hva < kvm->mmu_invalidate_range_end)
> > > > - return 1;
> > > > + if (unlikely(kvm->mmu_invalidate_in_progress)) {
> > > > + /*
> > > > + * Dropping mmu_lock after bumping
> > > > mmu_invalidate_in_progress
> > > > + * but before updating the range is a KVM bug.
> > > > + */
> > > > + if (WARN_ON_ONCE(kvm->mmu_invalidate_range_start ==
> > > > INVALID_GPA ||
> > > > + kvm->mmu_invalidate_range_end ==
> > > > INVALID_GPA))
> > >
> > > INVALID_GPA is an x86-specific define in
> > > arch/x86/include/asm/kvm_host.h, so this doesn't build on other
> > > architectures. The obvious fix is to move it to
> > > include/linux/kvm_host.h.
> >
> > Hmm, INVALID_GPA is defined as ZERO for x86, not 100% confident this is
> > correct choice for other architectures, but after search it has not been
> > used for other architectures, so should be safe to make it common.
As Yu posted a patch:
https://lore.kernel.org/all/20221209023622.274715-1-yu.c.zhang@linux.intel.com/
There is a GPA_INVALID in include/linux/kvm_types.h and I see ARM has already
been using it so sounds that is exactly what I need.
Chao
>
> With this fixed,
>
> Reviewed-by: Fuad Tabba <tabba@google.com>
> And the necessary work to port to arm64 (on qemu/arm64):
> Tested-by: Fuad Tabba <tabba@google.com>
>
> Cheers,
> /fuad
- Re: [PATCH v10 3/9] KVM: Extend the memslot to support fd-based private memory, (continued)
[PATCH v10 4/9] KVM: Add KVM_EXIT_MEMORY_FAULT exit, Chao Peng, 2022/12/02
[PATCH v10 5/9] KVM: Use gfn instead of hva for mmu_notifier_retry, Chao Peng, 2022/12/02
[PATCH v10 6/9] KVM: Unmap existing mappings when change the memory attributes, Chao Peng, 2022/12/02
Re: [PATCH v10 6/9] KVM: Unmap existing mappings when change the memory attributes, Fuad Tabba, 2022/12/07