All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-12 14:00 ` Mihai Caraman
  0 siblings, 0 replies; 23+ messages in thread
From: Mihai Caraman @ 2014-06-12 14:00 UTC (permalink / raw)
  To: kvm-ppc; +Cc: kvm, linuxppc-dev, Mihai Caraman

On vcpu schedule, the condition checked for tlb pollution is too tight.
The tlb entries of one vcpu are polluted when a different vcpu from the
same partition runs in-between. Relax the current tlb invalidation
condition taking into account the lpid.

Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
Cc: Scott Wood <scottwood <at> freescale.com>
---
 arch/powerpc/kvm/e500mc.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 17e4562..2e0cd69 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -111,10 +111,12 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
 }
 
 static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu);
+static DEFINE_PER_CPU(int, last_lpid_on_cpu);
 
 static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
 {
 	struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
+	bool update_last = false, inval_tlb = false;
 
 	kvmppc_booke_vcpu_load(vcpu, cpu);
 
@@ -140,12 +142,24 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
 	mtspr(SPRN_GDEAR, vcpu->arch.shared->dar);
 	mtspr(SPRN_GESR, vcpu->arch.shared->esr);
 
-	if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
-	    __get_cpu_var(last_vcpu_on_cpu) != vcpu) {
-		kvmppc_e500_tlbil_all(vcpu_e500);
+	if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) {
+		/* tlb entries deprecated */
+		inval_tlb = update_last = true;
+	} else if (__get_cpu_var(last_vcpu_on_cpu) != vcpu) {
+		update_last = true;
+		/* tlb entries polluted */
+		inval_tlb = __get_cpu_var(last_lpid_on_cpu) ==
+			    vcpu->kvm->arch.lpid;
+	}
+
+	if (update_last) {
 		__get_cpu_var(last_vcpu_on_cpu) = vcpu;
+		__get_cpu_var(last_lpid_on_cpu) = vcpu->kvm->arch.lpid;
 	}
 
+	if (inval_tlb)
+		kvmppc_e500_tlbil_all(vcpu_e500);
+
 	kvmppc_load_guest_fp(vcpu);
 }
 
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-12 14:00 ` Mihai Caraman
  0 siblings, 0 replies; 23+ messages in thread
From: Mihai Caraman @ 2014-06-12 14:00 UTC (permalink / raw)
  To: kvm-ppc; +Cc: Mihai Caraman, linuxppc-dev, kvm

On vcpu schedule, the condition checked for tlb pollution is too tight.
The tlb entries of one vcpu are polluted when a different vcpu from the
same partition runs in-between. Relax the current tlb invalidation
condition taking into account the lpid.

Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
Cc: Scott Wood <scottwood <at> freescale.com>
---
 arch/powerpc/kvm/e500mc.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 17e4562..2e0cd69 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -111,10 +111,12 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
 }
 
 static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu);
+static DEFINE_PER_CPU(int, last_lpid_on_cpu);
 
 static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
 {
 	struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
+	bool update_last = false, inval_tlb = false;
 
 	kvmppc_booke_vcpu_load(vcpu, cpu);
 
@@ -140,12 +142,24 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
 	mtspr(SPRN_GDEAR, vcpu->arch.shared->dar);
 	mtspr(SPRN_GESR, vcpu->arch.shared->esr);
 
-	if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
-	    __get_cpu_var(last_vcpu_on_cpu) != vcpu) {
-		kvmppc_e500_tlbil_all(vcpu_e500);
+	if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) {
+		/* tlb entries deprecated */
+		inval_tlb = update_last = true;
+	} else if (__get_cpu_var(last_vcpu_on_cpu) != vcpu) {
+		update_last = true;
+		/* tlb entries polluted */
+		inval_tlb = __get_cpu_var(last_lpid_on_cpu) ==
+			    vcpu->kvm->arch.lpid;
+	}
+
+	if (update_last) {
 		__get_cpu_var(last_vcpu_on_cpu) = vcpu;
+		__get_cpu_var(last_lpid_on_cpu) = vcpu->kvm->arch.lpid;
 	}
 
+	if (inval_tlb)
+		kvmppc_e500_tlbil_all(vcpu_e500);
+
 	kvmppc_load_guest_fp(vcpu);
 }
 
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-12 14:00 ` Mihai Caraman
  0 siblings, 0 replies; 23+ messages in thread
From: Mihai Caraman @ 2014-06-12 14:00 UTC (permalink / raw)
  To: kvm-ppc; +Cc: kvm, linuxppc-dev, Mihai Caraman

On vcpu schedule, the condition checked for tlb pollution is too tight.
The tlb entries of one vcpu are polluted when a different vcpu from the
same partition runs in-between. Relax the current tlb invalidation
condition taking into account the lpid.

Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
Cc: Scott Wood <scottwood <at> freescale.com>
---
 arch/powerpc/kvm/e500mc.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 17e4562..2e0cd69 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -111,10 +111,12 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
 }
 
 static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu);
+static DEFINE_PER_CPU(int, last_lpid_on_cpu);
 
 static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
 {
 	struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
+	bool update_last = false, inval_tlb = false;
 
 	kvmppc_booke_vcpu_load(vcpu, cpu);
 
@@ -140,12 +142,24 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
 	mtspr(SPRN_GDEAR, vcpu->arch.shared->dar);
 	mtspr(SPRN_GESR, vcpu->arch.shared->esr);
 
-	if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
-	    __get_cpu_var(last_vcpu_on_cpu) != vcpu) {
-		kvmppc_e500_tlbil_all(vcpu_e500);
+	if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) {
+		/* tlb entries deprecated */
+		inval_tlb = update_last = true;
+	} else if (__get_cpu_var(last_vcpu_on_cpu) != vcpu) {
+		update_last = true;
+		/* tlb entries polluted */
+		inval_tlb = __get_cpu_var(last_lpid_on_cpu) =
+			    vcpu->kvm->arch.lpid;
+	}
+
+	if (update_last) {
 		__get_cpu_var(last_vcpu_on_cpu) = vcpu;
+		__get_cpu_var(last_lpid_on_cpu) = vcpu->kvm->arch.lpid;
 	}
 
+	if (inval_tlb)
+		kvmppc_e500_tlbil_all(vcpu_e500);
+
 	kvmppc_load_guest_fp(vcpu);
 }
 
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
  2014-06-12 14:00 ` Mihai Caraman
  (?)
@ 2014-06-12 17:04   ` Alexander Graf
  -1 siblings, 0 replies; 23+ messages in thread
From: Alexander Graf @ 2014-06-12 17:04 UTC (permalink / raw)
  To: Mihai Caraman; +Cc: kvm-ppc, kvm, linuxppc-dev, Scott Wood

On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> On vcpu schedule, the condition checked for tlb pollution is too tight.
> The tlb entries of one vcpu are polluted when a different vcpu from the
> same partition runs in-between. Relax the current tlb invalidation
> condition taking into account the lpid.
>
> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>

Your mailer is broken? :)
This really should be an @.

I think this should work. Scott, please ack.


Alex

> Cc: Scott Wood <scottwood <at> freescale.com>
> ---
>   arch/powerpc/kvm/e500mc.c | 20 +++++++++++++++++---
>   1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
> index 17e4562..2e0cd69 100644
> --- a/arch/powerpc/kvm/e500mc.c
> +++ b/arch/powerpc/kvm/e500mc.c
> @@ -111,10 +111,12 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
>   }
>   
>   static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu);
> +static DEFINE_PER_CPU(int, last_lpid_on_cpu);
>   
>   static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
>   {
>   	struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
> +	bool update_last = false, inval_tlb = false;
>   
>   	kvmppc_booke_vcpu_load(vcpu, cpu);
>   
> @@ -140,12 +142,24 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
>   	mtspr(SPRN_GDEAR, vcpu->arch.shared->dar);
>   	mtspr(SPRN_GESR, vcpu->arch.shared->esr);
>   
> -	if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
> -	    __get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> -		kvmppc_e500_tlbil_all(vcpu_e500);
> +	if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) {
> +		/* tlb entries deprecated */
> +		inval_tlb = update_last = true;
> +	} else if (__get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> +		update_last = true;
> +		/* tlb entries polluted */
> +		inval_tlb = __get_cpu_var(last_lpid_on_cpu) ==
> +			    vcpu->kvm->arch.lpid;
> +	}
> +
> +	if (update_last) {
>   		__get_cpu_var(last_vcpu_on_cpu) = vcpu;
> +		__get_cpu_var(last_lpid_on_cpu) = vcpu->kvm->arch.lpid;
>   	}
>   
> +	if (inval_tlb)
> +		kvmppc_e500_tlbil_all(vcpu_e500);
> +
>   	kvmppc_load_guest_fp(vcpu);
>   }
>   

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-12 17:04   ` Alexander Graf
  0 siblings, 0 replies; 23+ messages in thread
From: Alexander Graf @ 2014-06-12 17:04 UTC (permalink / raw)
  To: Mihai Caraman; +Cc: Scott Wood, linuxppc-dev, kvm, kvm-ppc

On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> On vcpu schedule, the condition checked for tlb pollution is too tight.
> The tlb entries of one vcpu are polluted when a different vcpu from the
> same partition runs in-between. Relax the current tlb invalidation
> condition taking into account the lpid.
>
> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>

Your mailer is broken? :)
This really should be an @.

I think this should work. Scott, please ack.


Alex

> Cc: Scott Wood <scottwood <at> freescale.com>
> ---
>   arch/powerpc/kvm/e500mc.c | 20 +++++++++++++++++---
>   1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
> index 17e4562..2e0cd69 100644
> --- a/arch/powerpc/kvm/e500mc.c
> +++ b/arch/powerpc/kvm/e500mc.c
> @@ -111,10 +111,12 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
>   }
>   
>   static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu);
> +static DEFINE_PER_CPU(int, last_lpid_on_cpu);
>   
>   static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
>   {
>   	struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
> +	bool update_last = false, inval_tlb = false;
>   
>   	kvmppc_booke_vcpu_load(vcpu, cpu);
>   
> @@ -140,12 +142,24 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
>   	mtspr(SPRN_GDEAR, vcpu->arch.shared->dar);
>   	mtspr(SPRN_GESR, vcpu->arch.shared->esr);
>   
> -	if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
> -	    __get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> -		kvmppc_e500_tlbil_all(vcpu_e500);
> +	if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) {
> +		/* tlb entries deprecated */
> +		inval_tlb = update_last = true;
> +	} else if (__get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> +		update_last = true;
> +		/* tlb entries polluted */
> +		inval_tlb = __get_cpu_var(last_lpid_on_cpu) ==
> +			    vcpu->kvm->arch.lpid;
> +	}
> +
> +	if (update_last) {
>   		__get_cpu_var(last_vcpu_on_cpu) = vcpu;
> +		__get_cpu_var(last_lpid_on_cpu) = vcpu->kvm->arch.lpid;
>   	}
>   
> +	if (inval_tlb)
> +		kvmppc_e500_tlbil_all(vcpu_e500);
> +
>   	kvmppc_load_guest_fp(vcpu);
>   }
>   

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-12 17:04   ` Alexander Graf
  0 siblings, 0 replies; 23+ messages in thread
From: Alexander Graf @ 2014-06-12 17:04 UTC (permalink / raw)
  To: Mihai Caraman; +Cc: kvm-ppc, kvm, linuxppc-dev, Scott Wood

On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> On vcpu schedule, the condition checked for tlb pollution is too tight.
> The tlb entries of one vcpu are polluted when a different vcpu from the
> same partition runs in-between. Relax the current tlb invalidation
> condition taking into account the lpid.
>
> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>

Your mailer is broken? :)
This really should be an @.

I think this should work. Scott, please ack.


Alex

> Cc: Scott Wood <scottwood <at> freescale.com>
> ---
>   arch/powerpc/kvm/e500mc.c | 20 +++++++++++++++++---
>   1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
> index 17e4562..2e0cd69 100644
> --- a/arch/powerpc/kvm/e500mc.c
> +++ b/arch/powerpc/kvm/e500mc.c
> @@ -111,10 +111,12 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr)
>   }
>   
>   static DEFINE_PER_CPU(struct kvm_vcpu *, last_vcpu_on_cpu);
> +static DEFINE_PER_CPU(int, last_lpid_on_cpu);
>   
>   static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
>   {
>   	struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
> +	bool update_last = false, inval_tlb = false;
>   
>   	kvmppc_booke_vcpu_load(vcpu, cpu);
>   
> @@ -140,12 +142,24 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
>   	mtspr(SPRN_GDEAR, vcpu->arch.shared->dar);
>   	mtspr(SPRN_GESR, vcpu->arch.shared->esr);
>   
> -	if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
> -	    __get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> -		kvmppc_e500_tlbil_all(vcpu_e500);
> +	if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) {
> +		/* tlb entries deprecated */
> +		inval_tlb = update_last = true;
> +	} else if (__get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> +		update_last = true;
> +		/* tlb entries polluted */
> +		inval_tlb = __get_cpu_var(last_lpid_on_cpu) =
> +			    vcpu->kvm->arch.lpid;
> +	}
> +
> +	if (update_last) {
>   		__get_cpu_var(last_vcpu_on_cpu) = vcpu;
> +		__get_cpu_var(last_lpid_on_cpu) = vcpu->kvm->arch.lpid;
>   	}
>   
> +	if (inval_tlb)
> +		kvmppc_e500_tlbil_all(vcpu_e500);
> +
>   	kvmppc_load_guest_fp(vcpu);
>   }
>   


^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
  2014-06-12 17:04   ` Alexander Graf
@ 2014-06-13 14:43     ` mihai.caraman
  -1 siblings, 0 replies; 23+ messages in thread
From: mihai.caraman @ 2014-06-13 14:43 UTC (permalink / raw)
  To: Alexander Graf, Scott Wood; +Cc: kvm-ppc, kvm, linuxppc-dev

> -----Original Message-----
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Thursday, June 12, 2014 8:05 PM
> To: Caraman Mihai Claudiu-B02008
> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
> dev@lists.ozlabs.org; Wood Scott-B07421
> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
> on vcpu schedule
> 
> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> > On vcpu schedule, the condition checked for tlb pollution is too tight.
> > The tlb entries of one vcpu are polluted when a different vcpu from the
> > same partition runs in-between. Relax the current tlb invalidation
> > condition taking into account the lpid.
> >
> > Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
> 
> Your mailer is broken? :)
> This really should be an @.
> 
> I think this should work. Scott, please ack.

Alex, you were right. I screwed up the patch description by inverting relax
and tight terms :) It should have been more like this:

KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule

On vcpu schedule, the condition checked for tlb pollution is too loose.
The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
within the same logical partition runs in-between. Optimize the tlb invalidation
condition taking into account the lpid.

-Mike

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-13 14:43     ` mihai.caraman
  0 siblings, 0 replies; 23+ messages in thread
From: mihai.caraman @ 2014-06-13 14:43 UTC (permalink / raw)
  To: Alexander Graf, Scott Wood; +Cc: linuxppc-dev, kvm, kvm-ppc

> -----Original Message-----
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Thursday, June 12, 2014 8:05 PM
> To: Caraman Mihai Claudiu-B02008
> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
> dev@lists.ozlabs.org; Wood Scott-B07421
> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
> on vcpu schedule
>=20
> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> > On vcpu schedule, the condition checked for tlb pollution is too tight.
> > The tlb entries of one vcpu are polluted when a different vcpu from the
> > same partition runs in-between. Relax the current tlb invalidation
> > condition taking into account the lpid.
> >
> > Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
>=20
> Your mailer is broken? :)
> This really should be an @.
>=20
> I think this should work. Scott, please ack.

Alex, you were right. I screwed up the patch description by inverting relax
and tight terms :) It should have been more like this:

KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule

On vcpu schedule, the condition checked for tlb pollution is too loose.
The tlb entries of a vcpu are polluted (vs stale) only when a different vcp=
u
within the same logical partition runs in-between. Optimize the tlb invalid=
ation
condition taking into account the lpid.

-Mike

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
  2014-06-13 14:43     ` mihai.caraman
  (?)
@ 2014-06-13 14:55       ` Alexander Graf
  -1 siblings, 0 replies; 23+ messages in thread
From: Alexander Graf @ 2014-06-13 14:55 UTC (permalink / raw)
  To: mihai.caraman, Scott Wood; +Cc: kvm-ppc, kvm, linuxppc-dev


On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de]
>> Sent: Thursday, June 12, 2014 8:05 PM
>> To: Caraman Mihai Claudiu-B02008
>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
>> dev@lists.ozlabs.org; Wood Scott-B07421
>> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
>> on vcpu schedule
>>
>> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
>>> On vcpu schedule, the condition checked for tlb pollution is too tight.
>>> The tlb entries of one vcpu are polluted when a different vcpu from the
>>> same partition runs in-between. Relax the current tlb invalidation
>>> condition taking into account the lpid.
>>>
>>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
>> Your mailer is broken? :)
>> This really should be an @.
>>
>> I think this should work. Scott, please ack.
> Alex, you were right. I screwed up the patch description by inverting relax
> and tight terms :) It should have been more like this:
>
> KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
>
> On vcpu schedule, the condition checked for tlb pollution is too loose.
> The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
> within the same logical partition runs in-between. Optimize the tlb invalidation
> condition taking into account the lpid.

Can't we give every vcpu its own lpid? Or don't we trap on global 
invalidates?


Alex


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-13 14:55       ` Alexander Graf
  0 siblings, 0 replies; 23+ messages in thread
From: Alexander Graf @ 2014-06-13 14:55 UTC (permalink / raw)
  To: mihai.caraman, Scott Wood; +Cc: linuxppc-dev, kvm, kvm-ppc


On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de]
>> Sent: Thursday, June 12, 2014 8:05 PM
>> To: Caraman Mihai Claudiu-B02008
>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
>> dev@lists.ozlabs.org; Wood Scott-B07421
>> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
>> on vcpu schedule
>>
>> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
>>> On vcpu schedule, the condition checked for tlb pollution is too tight.
>>> The tlb entries of one vcpu are polluted when a different vcpu from the
>>> same partition runs in-between. Relax the current tlb invalidation
>>> condition taking into account the lpid.
>>>
>>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
>> Your mailer is broken? :)
>> This really should be an @.
>>
>> I think this should work. Scott, please ack.
> Alex, you were right. I screwed up the patch description by inverting relax
> and tight terms :) It should have been more like this:
>
> KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
>
> On vcpu schedule, the condition checked for tlb pollution is too loose.
> The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
> within the same logical partition runs in-between. Optimize the tlb invalidation
> condition taking into account the lpid.

Can't we give every vcpu its own lpid? Or don't we trap on global 
invalidates?


Alex

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-13 14:55       ` Alexander Graf
  0 siblings, 0 replies; 23+ messages in thread
From: Alexander Graf @ 2014-06-13 14:55 UTC (permalink / raw)
  To: mihai.caraman, Scott Wood; +Cc: kvm-ppc, kvm, linuxppc-dev


On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de]
>> Sent: Thursday, June 12, 2014 8:05 PM
>> To: Caraman Mihai Claudiu-B02008
>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
>> dev@lists.ozlabs.org; Wood Scott-B07421
>> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
>> on vcpu schedule
>>
>> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
>>> On vcpu schedule, the condition checked for tlb pollution is too tight.
>>> The tlb entries of one vcpu are polluted when a different vcpu from the
>>> same partition runs in-between. Relax the current tlb invalidation
>>> condition taking into account the lpid.
>>>
>>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
>> Your mailer is broken? :)
>> This really should be an @.
>>
>> I think this should work. Scott, please ack.
> Alex, you were right. I screwed up the patch description by inverting relax
> and tight terms :) It should have been more like this:
>
> KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
>
> On vcpu schedule, the condition checked for tlb pollution is too loose.
> The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
> within the same logical partition runs in-between. Optimize the tlb invalidation
> condition taking into account the lpid.

Can't we give every vcpu its own lpid? Or don't we trap on global 
invalidates?


Alex


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
  2014-06-13 14:55       ` Alexander Graf
  (?)
@ 2014-06-13 19:42         ` Scott Wood
  -1 siblings, 0 replies; 23+ messages in thread
From: Scott Wood @ 2014-06-13 19:42 UTC (permalink / raw)
  To: Alexander Graf; +Cc: mihai.caraman, kvm-ppc, kvm, linuxppc-dev

On Fri, 2014-06-13 at 16:55 +0200, Alexander Graf wrote:
> On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
> >> -----Original Message-----
> >> From: Alexander Graf [mailto:agraf@suse.de]
> >> Sent: Thursday, June 12, 2014 8:05 PM
> >> To: Caraman Mihai Claudiu-B02008
> >> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
> >> dev@lists.ozlabs.org; Wood Scott-B07421
> >> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
> >> on vcpu schedule
> >>
> >> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> >>> On vcpu schedule, the condition checked for tlb pollution is too tight.
> >>> The tlb entries of one vcpu are polluted when a different vcpu from the
> >>> same partition runs in-between. Relax the current tlb invalidation
> >>> condition taking into account the lpid.

Can you quantify the performance improvement from this?  We've had bugs
in this area before, so let's make sure it's worth it before making this
more complicated.

> >>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
> >> Your mailer is broken? :)
> >> This really should be an @.
> >>
> >> I think this should work. Scott, please ack.
> > Alex, you were right. I screwed up the patch description by inverting relax
> > and tight terms :) It should have been more like this:
> >
> > KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
> >
> > On vcpu schedule, the condition checked for tlb pollution is too loose.
> > The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
> > within the same logical partition runs in-between. Optimize the tlb invalidation
> > condition taking into account the lpid.
> 
> Can't we give every vcpu its own lpid? Or don't we trap on global 
> invalidates?

That would significantly increase the odds of exhausting LPIDs,
especially on large chips like t4240 with similarly large VMs.  If we
were to do that, the LPIDs would need to be dynamically assigned (like
PIDs), and should probably be a separate numberspace per physical core.

-Scott

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-13 19:42         ` Scott Wood
  0 siblings, 0 replies; 23+ messages in thread
From: Scott Wood @ 2014-06-13 19:42 UTC (permalink / raw)
  To: Alexander Graf; +Cc: mihai.caraman, linuxppc-dev, kvm, kvm-ppc

On Fri, 2014-06-13 at 16:55 +0200, Alexander Graf wrote:
> On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
> >> -----Original Message-----
> >> From: Alexander Graf [mailto:agraf@suse.de]
> >> Sent: Thursday, June 12, 2014 8:05 PM
> >> To: Caraman Mihai Claudiu-B02008
> >> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
> >> dev@lists.ozlabs.org; Wood Scott-B07421
> >> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
> >> on vcpu schedule
> >>
> >> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> >>> On vcpu schedule, the condition checked for tlb pollution is too tight.
> >>> The tlb entries of one vcpu are polluted when a different vcpu from the
> >>> same partition runs in-between. Relax the current tlb invalidation
> >>> condition taking into account the lpid.

Can you quantify the performance improvement from this?  We've had bugs
in this area before, so let's make sure it's worth it before making this
more complicated.

> >>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
> >> Your mailer is broken? :)
> >> This really should be an @.
> >>
> >> I think this should work. Scott, please ack.
> > Alex, you were right. I screwed up the patch description by inverting relax
> > and tight terms :) It should have been more like this:
> >
> > KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
> >
> > On vcpu schedule, the condition checked for tlb pollution is too loose.
> > The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
> > within the same logical partition runs in-between. Optimize the tlb invalidation
> > condition taking into account the lpid.
> 
> Can't we give every vcpu its own lpid? Or don't we trap on global 
> invalidates?

That would significantly increase the odds of exhausting LPIDs,
especially on large chips like t4240 with similarly large VMs.  If we
were to do that, the LPIDs would need to be dynamically assigned (like
PIDs), and should probably be a separate numberspace per physical core.

-Scott

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-13 19:42         ` Scott Wood
  0 siblings, 0 replies; 23+ messages in thread
From: Scott Wood @ 2014-06-13 19:42 UTC (permalink / raw)
  To: Alexander Graf; +Cc: mihai.caraman, kvm-ppc, kvm, linuxppc-dev

On Fri, 2014-06-13 at 16:55 +0200, Alexander Graf wrote:
> On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
> >> -----Original Message-----
> >> From: Alexander Graf [mailto:agraf@suse.de]
> >> Sent: Thursday, June 12, 2014 8:05 PM
> >> To: Caraman Mihai Claudiu-B02008
> >> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
> >> dev@lists.ozlabs.org; Wood Scott-B07421
> >> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
> >> on vcpu schedule
> >>
> >> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> >>> On vcpu schedule, the condition checked for tlb pollution is too tight.
> >>> The tlb entries of one vcpu are polluted when a different vcpu from the
> >>> same partition runs in-between. Relax the current tlb invalidation
> >>> condition taking into account the lpid.

Can you quantify the performance improvement from this?  We've had bugs
in this area before, so let's make sure it's worth it before making this
more complicated.

> >>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
> >> Your mailer is broken? :)
> >> This really should be an @.
> >>
> >> I think this should work. Scott, please ack.
> > Alex, you were right. I screwed up the patch description by inverting relax
> > and tight terms :) It should have been more like this:
> >
> > KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
> >
> > On vcpu schedule, the condition checked for tlb pollution is too loose.
> > The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
> > within the same logical partition runs in-between. Optimize the tlb invalidation
> > condition taking into account the lpid.
> 
> Can't we give every vcpu its own lpid? Or don't we trap on global 
> invalidates?

That would significantly increase the odds of exhausting LPIDs,
especially on large chips like t4240 with similarly large VMs.  If we
were to do that, the LPIDs would need to be dynamically assigned (like
PIDs), and should probably be a separate numberspace per physical core.

-Scott



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
  2014-06-13 19:42         ` Scott Wood
  (?)
@ 2014-06-17  9:08           ` Alexander Graf
  -1 siblings, 0 replies; 23+ messages in thread
From: Alexander Graf @ 2014-06-17  9:08 UTC (permalink / raw)
  To: Scott Wood; +Cc: mihai.caraman, kvm-ppc, kvm, linuxppc-dev


On 13.06.14 21:42, Scott Wood wrote:
> On Fri, 2014-06-13 at 16:55 +0200, Alexander Graf wrote:
>> On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
>>>> -----Original Message-----
>>>> From: Alexander Graf [mailto:agraf@suse.de]
>>>> Sent: Thursday, June 12, 2014 8:05 PM
>>>> To: Caraman Mihai Claudiu-B02008
>>>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
>>>> dev@lists.ozlabs.org; Wood Scott-B07421
>>>> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
>>>> on vcpu schedule
>>>>
>>>> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
>>>>> On vcpu schedule, the condition checked for tlb pollution is too tight.
>>>>> The tlb entries of one vcpu are polluted when a different vcpu from the
>>>>> same partition runs in-between. Relax the current tlb invalidation
>>>>> condition taking into account the lpid.
> Can you quantify the performance improvement from this?  We've had bugs
> in this area before, so let's make sure it's worth it before making this
> more complicated.
>
>>>>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
>>>> Your mailer is broken? :)
>>>> This really should be an @.
>>>>
>>>> I think this should work. Scott, please ack.
>>> Alex, you were right. I screwed up the patch description by inverting relax
>>> and tight terms :) It should have been more like this:
>>>
>>> KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
>>>
>>> On vcpu schedule, the condition checked for tlb pollution is too loose.
>>> The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
>>> within the same logical partition runs in-between. Optimize the tlb invalidation
>>> condition taking into account the lpid.
>> Can't we give every vcpu its own lpid? Or don't we trap on global
>> invalidates?
> That would significantly increase the odds of exhausting LPIDs,
> especially on large chips like t4240 with similarly large VMs.  If we
> were to do that, the LPIDs would need to be dynamically assigned (like
> PIDs), and should probably be a separate numberspace per physical core.

True, I didn't realize we only have so few of them. It would however 
save us from most flushing as long as we have spare LPIDs available :).


Alex

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-17  9:08           ` Alexander Graf
  0 siblings, 0 replies; 23+ messages in thread
From: Alexander Graf @ 2014-06-17  9:08 UTC (permalink / raw)
  To: Scott Wood; +Cc: mihai.caraman, linuxppc-dev, kvm, kvm-ppc


On 13.06.14 21:42, Scott Wood wrote:
> On Fri, 2014-06-13 at 16:55 +0200, Alexander Graf wrote:
>> On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
>>>> -----Original Message-----
>>>> From: Alexander Graf [mailto:agraf@suse.de]
>>>> Sent: Thursday, June 12, 2014 8:05 PM
>>>> To: Caraman Mihai Claudiu-B02008
>>>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
>>>> dev@lists.ozlabs.org; Wood Scott-B07421
>>>> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
>>>> on vcpu schedule
>>>>
>>>> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
>>>>> On vcpu schedule, the condition checked for tlb pollution is too tight.
>>>>> The tlb entries of one vcpu are polluted when a different vcpu from the
>>>>> same partition runs in-between. Relax the current tlb invalidation
>>>>> condition taking into account the lpid.
> Can you quantify the performance improvement from this?  We've had bugs
> in this area before, so let's make sure it's worth it before making this
> more complicated.
>
>>>>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
>>>> Your mailer is broken? :)
>>>> This really should be an @.
>>>>
>>>> I think this should work. Scott, please ack.
>>> Alex, you were right. I screwed up the patch description by inverting relax
>>> and tight terms :) It should have been more like this:
>>>
>>> KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
>>>
>>> On vcpu schedule, the condition checked for tlb pollution is too loose.
>>> The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
>>> within the same logical partition runs in-between. Optimize the tlb invalidation
>>> condition taking into account the lpid.
>> Can't we give every vcpu its own lpid? Or don't we trap on global
>> invalidates?
> That would significantly increase the odds of exhausting LPIDs,
> especially on large chips like t4240 with similarly large VMs.  If we
> were to do that, the LPIDs would need to be dynamically assigned (like
> PIDs), and should probably be a separate numberspace per physical core.

True, I didn't realize we only have so few of them. It would however 
save us from most flushing as long as we have spare LPIDs available :).


Alex

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-17  9:08           ` Alexander Graf
  0 siblings, 0 replies; 23+ messages in thread
From: Alexander Graf @ 2014-06-17  9:08 UTC (permalink / raw)
  To: Scott Wood; +Cc: mihai.caraman, kvm-ppc, kvm, linuxppc-dev


On 13.06.14 21:42, Scott Wood wrote:
> On Fri, 2014-06-13 at 16:55 +0200, Alexander Graf wrote:
>> On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
>>>> -----Original Message-----
>>>> From: Alexander Graf [mailto:agraf@suse.de]
>>>> Sent: Thursday, June 12, 2014 8:05 PM
>>>> To: Caraman Mihai Claudiu-B02008
>>>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
>>>> dev@lists.ozlabs.org; Wood Scott-B07421
>>>> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
>>>> on vcpu schedule
>>>>
>>>> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
>>>>> On vcpu schedule, the condition checked for tlb pollution is too tight.
>>>>> The tlb entries of one vcpu are polluted when a different vcpu from the
>>>>> same partition runs in-between. Relax the current tlb invalidation
>>>>> condition taking into account the lpid.
> Can you quantify the performance improvement from this?  We've had bugs
> in this area before, so let's make sure it's worth it before making this
> more complicated.
>
>>>>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
>>>> Your mailer is broken? :)
>>>> This really should be an @.
>>>>
>>>> I think this should work. Scott, please ack.
>>> Alex, you were right. I screwed up the patch description by inverting relax
>>> and tight terms :) It should have been more like this:
>>>
>>> KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
>>>
>>> On vcpu schedule, the condition checked for tlb pollution is too loose.
>>> The tlb entries of a vcpu are polluted (vs stale) only when a different vcpu
>>> within the same logical partition runs in-between. Optimize the tlb invalidation
>>> condition taking into account the lpid.
>> Can't we give every vcpu its own lpid? Or don't we trap on global
>> invalidates?
> That would significantly increase the odds of exhausting LPIDs,
> especially on large chips like t4240 with similarly large VMs.  If we
> were to do that, the LPIDs would need to be dynamically assigned (like
> PIDs), and should probably be a separate numberspace per physical core.

True, I didn't realize we only have so few of them. It would however 
save us from most flushing as long as we have spare LPIDs available :).


Alex


^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
  2014-06-17  9:08           ` Alexander Graf
  (?)
@ 2014-06-17 12:00             ` mihai.caraman
  -1 siblings, 0 replies; 23+ messages in thread
From: mihai.caraman @ 2014-06-17 12:00 UTC (permalink / raw)
  To: Alexander Graf, Scott Wood; +Cc: kvm-ppc, kvm, linuxppc-dev

> -----Original Message-----
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Tuesday, June 17, 2014 12:09 PM
> To: Wood Scott-B07421
> Cc: Caraman Mihai Claudiu-B02008; kvm-ppc@vger.kernel.org;
> kvm@vger.kernel.org; linuxppc-dev@lists.ozlabs.org
> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition
> on vcpu schedule
> 
> 
> On 13.06.14 21:42, Scott Wood wrote:
> > On Fri, 2014-06-13 at 16:55 +0200, Alexander Graf wrote:
> >> On 13.06.14 16:43, mihai.caraman@freescale.com wrote:
> >>>> -----Original Message-----
> >>>> From: Alexander Graf [mailto:agraf@suse.de]
> >>>> Sent: Thursday, June 12, 2014 8:05 PM
> >>>> To: Caraman Mihai Claudiu-B02008
> >>>> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; linuxppc-
> >>>> dev@lists.ozlabs.org; Wood Scott-B07421
> >>>> Subject: Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation
> condition
> >>>> on vcpu schedule
> >>>>
> >>>> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> >>>>> On vcpu schedule, the condition checked for tlb pollution is too
> tight.
> >>>>> The tlb entries of one vcpu are polluted when a different vcpu from
> the
> >>>>> same partition runs in-between. Relax the current tlb invalidation
> >>>>> condition taking into account the lpid.
> > Can you quantify the performance improvement from this?  We've had bugs
> > in this area before, so let's make sure it's worth it before making
> this
> > more complicated.
> >
> >>>>> Signed-off-by: Mihai Caraman <mihai.caraman <at> freescale.com>
> >>>> Your mailer is broken? :)
> >>>> This really should be an @.
> >>>>
> >>>> I think this should work. Scott, please ack.
> >>> Alex, you were right. I screwed up the patch description by inverting
> relax
> >>> and tight terms :) It should have been more like this:
> >>>
> >>> KVM: PPC: e500mc: Enhance tlb invalidation condition on vcpu schedule
> >>>
> >>> On vcpu schedule, the condition checked for tlb pollution is too
> loose.
> >>> The tlb entries of a vcpu are polluted (vs stale) only when a
> different vcpu
> >>> within the same logical partition runs in-between. Optimize the tlb
> invalidation
> >>> condition taking into account the lpid.
> >> Can't we give every vcpu its own lpid? Or don't we trap on global
> >> invalidates?
> > That would significantly increase the odds of exhausting LPIDs,
> > especially on large chips like t4240 with similarly large VMs.  If we
> > were to do that, the LPIDs would need to be dynamically assigned (like
> > PIDs), and should probably be a separate numberspace per physical core.
> 
> True, I didn't realize we only have so few of them. It would however
> save us from most flushing as long as we have spare LPIDs available :).

Yes, we had this proposal on the table for e6500 multithreaded core. This
core lacks tlb write conditional instruction, so an OS needs to use locks
to protect itself against concurrent tlb writes executed from sibling threads.
When we expose hw treads as single-threaded vcpus (useful when the user opt
not to pin vcpus), the guest can't no longer protect itself optimally
(it can protect tlb writes across all threads but this is not acceptable).
So instead, we found a solution at hypervisor level by assigning different
logical partition ids to guest's vcpus running simultaneous on sibling hw
threads. Currently in FSL SDK we allocate two lpids to each guest.

I am also a proponent for using all LPID space (63 values) per (multi-threaded)
physical core, which will lead to fewer invalidates on vcpu schedule and will
accommodate the solution described above.

-Mike

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-17 12:00             ` mihai.caraman
  0 siblings, 0 replies; 23+ messages in thread
From: mihai.caraman @ 2014-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RoZSB1c2VyIG9wdA0Kbm90IHRvIHBpbiB2Y3B1cyks
IHRoZSBndWVzdCBjYW4ndCBubyBsb25nZXIgcHJvdGVjdCBpdHNlbGYgb3B0aW1hbGx5DQooaXQg
Y2FuIHByb3RlY3QgdGxiIHdyaXRlcyBhY3Jvc3MgYWxsIHRocmVhZHMgYnV0IHRoaXMgaXMgbm90
IGFjY2VwdGFibGUpLg0KU28gaW5zdGVhZCwgd2UgZm91bmQgYSBzb2x1dGlvbiBhdCBoeXBlcnZp
c29yIGxldmVsIGJ5IGFzc2lnbmluZyBkaWZmZXJlbnQNCmxvZ2ljYWwgcGFydGl0aW9uIGlkcyB0
byBndWVzdCdzIHZjcHVzIHJ1bm5pbmcgc2ltdWx0YW5lb3VzIG9uIHNpYmxpbmcgaHcNCnRocmVh
ZHMuIEN1cnJlbnRseSBpbiBGU0wgU0RLIHdlIGFsbG9jYXRlIHR3byBscGlkcyB0byBlYWNoIGd1
ZXN0Lg0KDQpJIGFtIGFsc28gYSBwcm9wb25lbnQgZm9yIHVzaW5nIGFsbCBMUElEIHNwYWNlICg2
MyB2YWx1ZXMpIHBlciAobXVsdGktdGhyZWFkZWQpDQpwaHlzaWNhbCBjb3JlLCB3aGljaCB3aWxs
IGxlYWQgdG8gZmV3ZXIgaW52YWxpZGF0ZXMgb24gdmNwdSBzY2hlZHVsZSBhbmQgd2lsbA0KYWNj
b21tb2RhdGUgdGhlIHNvbHV0aW9uIGRlc2NyaWJlZCBhYm92ZS4NCg0KLU1pa2UNCg==

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-17 12:00             ` mihai.caraman
  0 siblings, 0 replies; 23+ messages in thread
From: mihai.caraman @ 2014-06-17 12:00 UTC (permalink / raw)
  To: Alexander Graf, Scott Wood; +Cc: kvm-ppc, kvm, linuxppc-dev

PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPi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DQooaXQg
Y2FuIHByb3RlY3QgdGxiIHdyaXRlcyBhY3Jvc3MgYWxsIHRocmVhZHMgYnV0IHRoaXMgaXMgbm90
IGFjY2VwdGFibGUpLg0KU28gaW5zdGVhZCwgd2UgZm91bmQgYSBzb2x1dGlvbiBhdCBoeXBlcnZp
c29yIGxldmVsIGJ5IGFzc2lnbmluZyBkaWZmZXJlbnQNCmxvZ2ljYWwgcGFydGl0aW9uIGlkcyB0
byBndWVzdCdzIHZjcHVzIHJ1bm5pbmcgc2ltdWx0YW5lb3VzIG9uIHNpYmxpbmcgaHcNCnRocmVh
ZHMuIEN1cnJlbnRseSBpbiBGU0wgU0RLIHdlIGFsbG9jYXRlIHR3byBscGlkcyB0byBlYWNoIGd1
ZXN0Lg0KDQpJIGFtIGFsc28gYSBwcm9wb25lbnQgZm9yIHVzaW5nIGFsbCBMUElEIHNwYWNlICg2
MyB2YWx1ZXMpIHBlciAobXVsdGktdGhyZWFkZWQpDQpwaHlzaWNhbCBjb3JlLCB3aGljaCB3aWxs
IGxlYWQgdG8gZmV3ZXIgaW52YWxpZGF0ZXMgb24gdmNwdSBzY2hlZHVsZSBhbmQgd2lsbA0KYWNj
b21tb2RhdGUgdGhlIHNvbHV0aW9uIGRlc2NyaWJlZCBhYm92ZS4NCg0KLU1pa2UNCg=

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
  2014-06-12 17:04   ` Alexander Graf
  (?)
@ 2014-06-17 15:33     ` Scott Wood
  -1 siblings, 0 replies; 23+ messages in thread
From: Scott Wood @ 2014-06-17 15:33 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Mihai Caraman, linuxppc-dev, kvm, kvm-ppc

On Thu, 2014-06-12 at 19:04 +0200, Alexander Graf wrote:
> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> > @@ -140,12 +142,24 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
> >   	mtspr(SPRN_GDEAR, vcpu->arch.shared->dar);
> >   	mtspr(SPRN_GESR, vcpu->arch.shared->esr);
> >   
> > -	if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
> > -	    __get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> > -		kvmppc_e500_tlbil_all(vcpu_e500);
> > +	if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) {
> > +		/* tlb entries deprecated */
> > +		inval_tlb = update_last = true;
> > +	} else if (__get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> > +		update_last = true;
> > +		/* tlb entries polluted */
> > +		inval_tlb = __get_cpu_var(last_lpid_on_cpu) ==
> > +			    vcpu->kvm->arch.lpid;
> > +	}

What about the following sequence on one CPU:

LPID 1, vcpu A
LPID 2, vcpu C
LPID 1, vcpu B
LPID 2, vcpu C	doesn't invalidate
LPID 1, vcpu A  doesn't invalidate

In the last line, vcpu A last ran on this cpu (oldpir matches), but LPID
2 last ran on this cpu (last_lpid_on_cpu does not match) -- but an
invalidation has never happened since vcpu B from LPID 1 ran on this
cpu.

-Scott


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-17 15:33     ` Scott Wood
  0 siblings, 0 replies; 23+ messages in thread
From: Scott Wood @ 2014-06-17 15:33 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Mihai Caraman, linuxppc-dev, kvm, kvm-ppc

On Thu, 2014-06-12 at 19:04 +0200, Alexander Graf wrote:
> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> > @@ -140,12 +142,24 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
> >   	mtspr(SPRN_GDEAR, vcpu->arch.shared->dar);
> >   	mtspr(SPRN_GESR, vcpu->arch.shared->esr);
> >   
> > -	if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
> > -	    __get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> > -		kvmppc_e500_tlbil_all(vcpu_e500);
> > +	if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) {
> > +		/* tlb entries deprecated */
> > +		inval_tlb = update_last = true;
> > +	} else if (__get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> > +		update_last = true;
> > +		/* tlb entries polluted */
> > +		inval_tlb = __get_cpu_var(last_lpid_on_cpu) ==
> > +			    vcpu->kvm->arch.lpid;
> > +	}

What about the following sequence on one CPU:

LPID 1, vcpu A
LPID 2, vcpu C
LPID 1, vcpu B
LPID 2, vcpu C	doesn't invalidate
LPID 1, vcpu A  doesn't invalidate

In the last line, vcpu A last ran on this cpu (oldpir matches), but LPID
2 last ran on this cpu (last_lpid_on_cpu does not match) -- but an
invalidation has never happened since vcpu B from LPID 1 ran on this
cpu.

-Scott

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule
@ 2014-06-17 15:33     ` Scott Wood
  0 siblings, 0 replies; 23+ messages in thread
From: Scott Wood @ 2014-06-17 15:33 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Mihai Caraman, linuxppc-dev, kvm, kvm-ppc

On Thu, 2014-06-12 at 19:04 +0200, Alexander Graf wrote:
> On 06/12/2014 04:00 PM, Mihai Caraman wrote:
> > @@ -140,12 +142,24 @@ static void kvmppc_core_vcpu_load_e500mc(struct kvm_vcpu *vcpu, int cpu)
> >   	mtspr(SPRN_GDEAR, vcpu->arch.shared->dar);
> >   	mtspr(SPRN_GESR, vcpu->arch.shared->esr);
> >   
> > -	if (vcpu->arch.oldpir != mfspr(SPRN_PIR) ||
> > -	    __get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> > -		kvmppc_e500_tlbil_all(vcpu_e500);
> > +	if (vcpu->arch.oldpir != mfspr(SPRN_PIR)) {
> > +		/* tlb entries deprecated */
> > +		inval_tlb = update_last = true;
> > +	} else if (__get_cpu_var(last_vcpu_on_cpu) != vcpu) {
> > +		update_last = true;
> > +		/* tlb entries polluted */
> > +		inval_tlb = __get_cpu_var(last_lpid_on_cpu) =
> > +			    vcpu->kvm->arch.lpid;
> > +	}

What about the following sequence on one CPU:

LPID 1, vcpu A
LPID 2, vcpu C
LPID 1, vcpu B
LPID 2, vcpu C	doesn't invalidate
LPID 1, vcpu A  doesn't invalidate

In the last line, vcpu A last ran on this cpu (oldpir matches), but LPID
2 last ran on this cpu (last_lpid_on_cpu does not match) -- but an
invalidation has never happened since vcpu B from LPID 1 ran on this
cpu.

-Scott



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-06-17 15:33 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 14:00 [PATCH] KVM: PPC: e500mc: Relax tlb invalidation condition on vcpu schedule Mihai Caraman
2014-06-12 14:00 ` Mihai Caraman
2014-06-12 14:00 ` Mihai Caraman
2014-06-12 17:04 ` Alexander Graf
2014-06-12 17:04   ` Alexander Graf
2014-06-12 17:04   ` Alexander Graf
2014-06-13 14:43   ` mihai.caraman
2014-06-13 14:43     ` mihai.caraman
2014-06-13 14:55     ` Alexander Graf
2014-06-13 14:55       ` Alexander Graf
2014-06-13 14:55       ` Alexander Graf
2014-06-13 19:42       ` Scott Wood
2014-06-13 19:42         ` Scott Wood
2014-06-13 19:42         ` Scott Wood
2014-06-17  9:08         ` Alexander Graf
2014-06-17  9:08           ` Alexander Graf
2014-06-17  9:08           ` Alexander Graf
2014-06-17 12:00           ` mihai.caraman
2014-06-17 12:00             ` mihai.caraman
2014-06-17 12:00             ` mihai.caraman
2014-06-17 15:33   ` Scott Wood
2014-06-17 15:33     ` Scott Wood
2014-06-17 15:33     ` Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.