Re: [PATCH v3 0/6] KVM: MMU: fast invalidate all mmio sptes

From: Marcelo Tosatti
Date: Thu Jun 13 2013 - 21:59:35 EST


On Fri, Jun 07, 2013 at 04:51:22PM +0800, Xiao Guangrong wrote:
> Changelog:
> V3:
> All of these changes are from Gleb's review:
> 1) rename RET_MMIO_PF_EMU to RET_MMIO_PF_EMULATE.
> 2) smartly adjust kvm generation number in kvm_current_mmio_generatio()
> to avoid kvm_memslots->generation overflow.
>
> V2:
> - rename kvm_mmu_invalid_mmio_spte to kvm_mmu_invalid_mmio_sptes
> - use kvm->memslots->generation as kvm global generation-number
> - fix comment and codestyle
> - init kvm generation close to mmio wrap-around value
> - keep kvm_mmu_zap_mmio_sptes
>
> The current way is holding hot mmu-lock and walking all shadow pages, this
> is not scale. This patchset tries to introduce a very simple and scale way
> to fast invalidate all mmio sptes - it need not walk any shadow pages and hold
> any locks.

Hi Xiao,

- Where is the generation number increased?
- Should use spinlock breakable code in kvm_mmu_zap_mmio_sptes()
(picture guest with 512GB of RAM, even walking all those pages is
expensive) (ah, patch to remove kvm_mmu_zap_mmio_sptes does that).
- Is -13 enough to test wraparound? Its highly likely the guest has
not began executing by the time 13 kvm_set_memory_calls are made
(so no sptes around). Perhaps -2000 is more sensible (should confirm
though).
- Why remove "if (change == KVM_MR_CREATE) || (change
== KVM_MR_MOVE)" from kvm_arch_commit_memory_region?
Its instructive.

Otherwise looks good.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/