diff mbox series

[V4,6/15] KVM/MMU: Flush tlb directly in the kvm_set_pte_rmapp()

Message ID 20181013145406.4911-7-Tianyu.Lan@microsoft.com (mailing list archive)
State New, archived
Headers show
Series x86/KVM/Hyper-v: Add HV ept tlb range flush hypercall support in KVM | expand

Commit Message

Tianyu Lan Oct. 13, 2018, 2:53 p.m. UTC
From: Lan Tianyu <Tianyu.Lan@microsoft.com>

This patch is to flush tlb directly in the kvm_set_pte_rmapp()
and return 0.

Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com>
---
 arch/x86/kvm/mmu.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Paolo Bonzini Oct. 15, 2018, 11:52 a.m. UTC | #1
On 13/10/2018 16:53, lantianyu1986@gmail.com wrote:
> @@ -1781,6 +1781,11 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head,
>  		}
>  	}
>  
> +	if (need_flush && kvm_available_flush_tlb_with_range()) {
> +		kvm_flush_remote_tlbs_with_address(kvm, gfn, 1);
> +		return 0;
> +	}
> +

Here you're passing an L1 GPA, not an L2 GPA.  Is it correct?

Paolo
Paolo Bonzini Oct. 15, 2018, 2:57 p.m. UTC | #2
On 15/10/2018 16:46, Tianyu Lan wrote:
> On Mon, Oct 15, 2018 at 7:52 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> On 13/10/2018 16:53, lantianyu1986@gmail.com wrote:
>>> @@ -1781,6 +1781,11 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head,
>>>               }
>>>       }
>>>
>>> +     if (need_flush && kvm_available_flush_tlb_with_range()) {
>>> +             kvm_flush_remote_tlbs_with_address(kvm, gfn, 1);
>>> +             return 0;
>>> +     }
>>> +
>>
>> Here you're passing an L1 GPA, not an L2 GPA.  Is it correct?
>>
> 
> For our case, L0 is Hyper-V and L1 is KVM. So L2 GPA is for KVM''s L1 GPA.

Ok, so this is what confused me.  Fortunately most of my remarks on the
second part still stand, but the first part looks good now.  Adding back
the list so that people understand my stupidity. :)

To recap:

0) I'll apply patch 14/15 immediately

1) for v5, change the callback structure to pass an opaque void*

2) move the hyperv_* implementation first

3) for the flush list part (which almost certainly won't make it into
4.20, so you might as well post it later), please separate each use of
the flush list into a separate patch.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 5d3a180c57e2..f3742ff4ec18 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1781,6 +1781,11 @@  static int kvm_set_pte_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head,
 		}
 	}
 
+	if (need_flush && kvm_available_flush_tlb_with_range()) {
+		kvm_flush_remote_tlbs_with_address(kvm, gfn, 1);
+		return 0;
+	}
+
 	return need_flush;
 }