Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-26 Thread Wanpeng Li
Hi Eduardo, 2017-11-16 12:54 GMT+08:00 Eduardo Valentin : > Hey Radim, > > On Thu, Nov 09, 2017 at 03:17:33PM +0100, Radim Krčmář wrote: > > > >> >> This is what I'm doubting, because the patch is adding about two >> thousand cycles to every spinlock-taken path. >> Doesn't this patch yield better

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-15 Thread Eduardo Valentin
Hey Radim, On Thu, Nov 09, 2017 at 03:17:33PM +0100, Radim Krčmář wrote: > > This is what I'm doubting, because the patch is adding about two > thousand cycles to every spinlock-taken path. > Doesn't this patch yield better results? > > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-10 Thread Paolo Bonzini
On 10/11/2017 07:07, Wanpeng Li wrote: >>> You should also add a cpuid flag in kvm part. >> It is better without that. The flag has no dependency on KVM (kernel >> hypervisor) code. > Do you mean -cpu host, +,I think it will result in "warning: host > doesn't support requested feature: CPUID.4

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-10 Thread Wanpeng Li
2017-11-10 15:59 GMT+08:00 Peter Zijlstra : > On Fri, Nov 10, 2017 at 10:07:56AM +0800, Wanpeng Li wrote: > >> >> Also, you should not put cpumask_t on stack, that's 'broken'. >> >> Thanks pointing out this. I found a useful comments in arch/x86/kernel/irq.c: >> >> /* These two declarations are onl

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Peter Zijlstra
On Fri, Nov 10, 2017 at 10:07:56AM +0800, Wanpeng Li wrote: > >> Also, you should not put cpumask_t on stack, that's 'broken'. > > Thanks pointing out this. I found a useful comments in arch/x86/kernel/irq.c: > > /* These two declarations are only used in check_irq_vectors_for_cpu_disable() > *

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Wanpeng Li
2017-11-10 0:00 GMT+08:00 Radim Krcmar : > 2017-11-09 20:43+0800, Wanpeng Li: >> 2017-11-07 4:26 GMT+08:00 Eduardo Valentin : >> > Currently, the existing qspinlock implementation will fallback to >> > test-and-set if the hypervisor has not set the PV_UNHALT flag. >> > >> > This patch gives the opp

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Wanpeng Li
2017-11-10 1:15 GMT+08:00 Peter Zijlstra : > On Thu, Nov 09, 2017 at 06:12:41PM +0100, Peter Zijlstra wrote: >> On Thu, Nov 09, 2017 at 05:45:23PM +0100, Radim Krcmar wrote: >> > 2017-11-09 17:17+0100, Peter Zijlstra: >> > > On Thu, Nov 09, 2017 at 05:05:36PM +0100, Radim Krcmar wrote: >> > > > 201

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Radim Krcmar
2017-11-09 18:12+0100, Peter Zijlstra: > On Thu, Nov 09, 2017 at 05:45:23PM +0100, Radim Krcmar wrote: > > 2017-11-09 17:17+0100, Peter Zijlstra: > > > On Thu, Nov 09, 2017 at 05:05:36PM +0100, Radim Krcmar wrote: > > > > 2017-11-09 10:53-0500, Pankaj Gupta: > > > > > 2] PV TLB should also behave a

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Radim Krcmar
2017-11-09 18:28+0100, Peter Zijlstra: > On Thu, Nov 09, 2017 at 06:15:11PM +0100, Peter Zijlstra wrote: > > On Thu, Nov 09, 2017 at 06:12:41PM +0100, Peter Zijlstra wrote: > > > On Thu, Nov 09, 2017 at 05:45:23PM +0100, Radim Krcmar wrote: > > > > 2017-11-09 17:17+0100, Peter Zijlstra: > > > > > O

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Peter Zijlstra
On Thu, Nov 09, 2017 at 06:15:11PM +0100, Peter Zijlstra wrote: > On Thu, Nov 09, 2017 at 06:12:41PM +0100, Peter Zijlstra wrote: > > On Thu, Nov 09, 2017 at 05:45:23PM +0100, Radim Krcmar wrote: > > > 2017-11-09 17:17+0100, Peter Zijlstra: > > > > On Thu, Nov 09, 2017 at 05:05:36PM +0100, Radim Kr

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Peter Zijlstra
On Thu, Nov 09, 2017 at 06:12:41PM +0100, Peter Zijlstra wrote: > On Thu, Nov 09, 2017 at 05:45:23PM +0100, Radim Krcmar wrote: > > 2017-11-09 17:17+0100, Peter Zijlstra: > > > On Thu, Nov 09, 2017 at 05:05:36PM +0100, Radim Krcmar wrote: > > > > 2017-11-09 10:53-0500, Pankaj Gupta: > > > > > 2] PV

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Peter Zijlstra
On Thu, Nov 09, 2017 at 05:45:23PM +0100, Radim Krcmar wrote: > 2017-11-09 17:17+0100, Peter Zijlstra: > > On Thu, Nov 09, 2017 at 05:05:36PM +0100, Radim Krcmar wrote: > > > 2017-11-09 10:53-0500, Pankaj Gupta: > > > > 2] PV TLB should also behave as per option PV_DEDICATED for better > > > > per

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Radim Krcmar
2017-11-09 17:17+0100, Peter Zijlstra: > On Thu, Nov 09, 2017 at 05:05:36PM +0100, Radim Krcmar wrote: > > 2017-11-09 10:53-0500, Pankaj Gupta: > > > 2] PV TLB should also behave as per option PV_DEDICATED for better > > > performance. > > > > Right, > > Shouldn't KVM do flush_tlb_other() in any

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Pankaj Gupta
> Subject: Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when > PV_DEDICATED is set > > On Thu, Nov 09, 2017 at 05:05:36PM +0100, Radim Krcmar wrote: > > 2017-11-09 10:53-0500, Pankaj Gupta: > > > 2] PV TLB should also behave as per option PV_DEDICATED f

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Peter Zijlstra
On Thu, Nov 09, 2017 at 05:05:36PM +0100, Radim Krcmar wrote: > 2017-11-09 10:53-0500, Pankaj Gupta: > > 2] PV TLB should also behave as per option PV_DEDICATED for better > > performance. > > Right, Shouldn't KVM do flush_tlb_other() in any case? Not sure how PV_DEDICATED can help with that.

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Radim Krcmar
2017-11-09 10:53-0500, Pankaj Gupta: > > > > 2017-11-07 4:26 GMT+08:00 Eduardo Valentin : > > > Currently, the existing qspinlock implementation will fallback to > > > test-and-set if the hypervisor has not set the PV_UNHALT flag. > > > > > > This patch gives the opportunity to guest kernels to s

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Radim Krcmar
2017-11-09 20:43+0800, Wanpeng Li: > 2017-11-07 4:26 GMT+08:00 Eduardo Valentin : > > Currently, the existing qspinlock implementation will fallback to > > test-and-set if the hypervisor has not set the PV_UNHALT flag. > > > > This patch gives the opportunity to guest kernels to select > > between

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Pankaj Gupta
> 2017-11-07 4:26 GMT+08:00 Eduardo Valentin : > > Currently, the existing qspinlock implementation will fallback to > > test-and-set if the hypervisor has not set the PV_UNHALT flag. > > > > This patch gives the opportunity to guest kernels to select > > between test-and-set and the regular queu

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Radim Krčmář
2017-11-09 00:55-0800, Eduardo Valentin: > Hello, > > On Wed, Nov 08, 2017 at 06:36:52PM +0100, Radim Krčmář wrote: > > 2017-11-06 12:26-0800, Eduardo Valentin: > > > Currently, the existing qspinlock implementation will fallback to > > > test-and-set if the hypervisor has not set the PV_UNHALT fl

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Wanpeng Li
2017-11-07 4:26 GMT+08:00 Eduardo Valentin : > Currently, the existing qspinlock implementation will fallback to > test-and-set if the hypervisor has not set the PV_UNHALT flag. > > This patch gives the opportunity to guest kernels to select > between test-and-set and the regular queueu fair lock i

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-09 Thread Eduardo Valentin
Hello, On Wed, Nov 08, 2017 at 06:36:52PM +0100, Radim Krčmář wrote: > 2017-11-06 12:26-0800, Eduardo Valentin: > > Currently, the existing qspinlock implementation will fallback to > > test-and-set if the hypervisor has not set the PV_UNHALT flag. > > > > This patch gives the opportunity to gues

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-08 Thread Radim Krčmář
2017-11-06 12:26-0800, Eduardo Valentin: > Currently, the existing qspinlock implementation will fallback to > test-and-set if the hypervisor has not set the PV_UNHALT flag. > > This patch gives the opportunity to guest kernels to select > between test-and-set and the regular queueu fair lock impl

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-08 Thread Eduardo Valentin
Paolo, On Tue, Nov 07, 2017 at 01:43:15PM +0100, Paolo Bonzini wrote: > On 07/11/2017 13:39, Eduardo Valentin wrote: > >> is this still needed after Waiman's patch to adaptively switch between > >> tas and pvqspinlock? > > Can you please point me to it ? Is it already in tip/master? > > > > No,

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-07 Thread Paolo Bonzini
On 07/11/2017 13:39, Eduardo Valentin wrote: >> is this still needed after Waiman's patch to adaptively switch between >> tas and pvqspinlock? > Can you please point me to it ? Is it already in tip/master? > No, he just posted it: https://marc.info/?l=linux-kernel&m=150972337909996&w=2 Paolo

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-07 Thread Eduardo Valentin
On Tue, Nov 07, 2017 at 01:23:56PM +0100, Paolo Bonzini wrote: > On 06/11/2017 21:26, Eduardo Valentin wrote: > > Currently, the existing qspinlock implementation will fallback to > > test-and-set if the hypervisor has not set the PV_UNHALT flag. > > > > This patch gives the opportunity to guest k

Re: [PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-07 Thread Paolo Bonzini
On 06/11/2017 21:26, Eduardo Valentin wrote: > Currently, the existing qspinlock implementation will fallback to > test-and-set if the hypervisor has not set the PV_UNHALT flag. > > This patch gives the opportunity to guest kernels to select > between test-and-set and the regular queueu fair lock

[PATCHv3 1/1] locking/qspinlock/x86: Avoid test-and-set when PV_DEDICATED is set

2017-11-06 Thread Eduardo Valentin
Currently, the existing qspinlock implementation will fallback to test-and-set if the hypervisor has not set the PV_UNHALT flag. This patch gives the opportunity to guest kernels to select between test-and-set and the regular queueu fair lock implementation based on the PV_DEDICATED KVM feature fl