Re: [PATCH V4 9/15] KVM: Add flush_link and parent_pte in the struct kvm_mmu_page

From: Paolo Bonzini
Date: Mon Oct 15 2018 - 06:12:20 EST


On 13/10/2018 16:54, lantianyu1986@xxxxxxxxx wrote:
> From: Lan Tianyu <Tianyu.Lan@xxxxxxxxxxxxx>
>
> PV EPT tlb flush function will accept a list of flush ranges and
> use struct kvm_mmu_page as the list entry.
>
> Signed-off-by: Lan Tianyu <Tianyu.Lan@xxxxxxxxxxxxx>
> ---
> arch/x86/include/asm/kvm_host.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 19985c602ed6..8279235285f8 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -316,6 +316,7 @@ struct kvm_rmap_head {
>
> struct kvm_mmu_page {
> struct list_head link;
> + struct list_head flush_link;

This can be an hlist. However, you are not documenting what's the
locking here. There are many places in which KVM does a
"cond_resched_lock(&vcpu->kvm->mmu_lock);" and you need to explain how
flush_link is not live across that.

I would start from a simpler patch that just uses the list-based flush
in kvm_mmu_commit_zap_page, where you already have the list of things to
flush as invalid_list.

> struct hlist_node hash_link;
> bool unsync;
>
>

Also this is not adding parent_pte, so the subject is incorrect.

Paolo