[PATCH v5 1/6] qspinlock: powerpc support qspinlock

2016-06-02 Thread Pan Xinhui
Base code to enable qspinlock on powerpc. this patch add some #ifdef here and there. Although there is no paravirt related code, we can successfully build a qspinlock kernel after apply this patch. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/qspin

[PATCH v5 4/6] pv-qspinlock: powerpc support pv-qspinlock

2016-06-02 Thread Pan Xinhui
are spinning on. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/qspinlock.h | 15 +++ arch/powerpc/include/asm/qspinlock_paravirt.h | 38 +++ .../powerpc/include/asm/qspinlock_paravirt_types.h | 13 +++ arch/powerpc/kernel/para

[PATCH v5 0/6] powerPC/pSeries use pv-qpsinlock as the default spinlock implemention

2016-06-02 Thread Pan Xinhui
: Add lock holder CPU argument to pv_wait() from Waiman Some other patches in Waiman's "locking/pvqspinlock: Fix missed PV wakeup & support PPC" are not applied for now. Pan Xinhui (6): qspinlock: powerpc support qspinlock powerpc: pseries/Kconfig: Add qspinlock build config

[PATCH v5 5/6] pv-qspinlock: use cmpxchg_release in __pv_queued_spin_unlock

2016-06-02 Thread Pan Xinhui
cmpxchg_release is light-wight than cmpxchg, On some arch like ppc, barrier impact the performace too much. Suggested-by: Boqun Feng <boqun.f...@gmail.com> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- kernel/locking/qspinlock_paravirt.h | 2 +- 1 file changed, 1 ins

[PATCH v5 3/6] powerpc: lib/locks.c: Add cpu yield/wake helper function

2016-06-02 Thread Pan Xinhui
pv-qspinlock core has pv_wait/pv_kick which will give a better performace by yielding and kicking cpu at some cases. lets support them by adding two corresponding helper functions. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/spinlock.h | 4

[PATCH v5 2/6] powerpc: pseries/Kconfig: Add qspinlock build config

2016-06-02 Thread Pan Xinhui
pseries will use qspinlock by default. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/platforms/pseries/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index bec90fb..f

[PATCH v5 6/6] powerpc: pseries: Add pv-qspinlock build config/make

2016-06-02 Thread Pan Xinhui
pseries has PowerVM support, the default option is Y. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/kernel/Makefile | 1 + arch/powerpc/platforms/pseries/Kconfig | 8 2 files changed, 9 insertions(+) diff --git a/arch/powerpc/kernel/Make

[PATCH v5 0/6] powerPC/pSeries use pv-qpsinlock as the default spinlock implemention

2016-06-02 Thread Pan Xinhui
: Add lock holder CPU argument to pv_wait() from Waiman Some other patches in Waiman's "locking/pvqspinlock: Fix missed PV wakeup & support PPC" are not applied for now. Pan Xinhui (6): qspinlock: powerpc support qspinlock powerpc: pseries/Kconfig: Add qspinlock build config

[PATCH v2 4/4] kernel/locking: Drop the overload of {mutex, rwsem}_spin_on_owner

2016-06-28 Thread Pan Xinhui
essaging [kernel.vmlinux] [k] system_call 2.69% sched-messaging [kernel.vmlinux] [k] wait_consider_task Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- kernel/locking/mutex.c | 15 +-- kernel/locking/rwsem-xadd.c | 16 +--- 2 files changed, 26 in

[PATCH v2 2/4] powerpc/spinlock: support vcpu preempted check

2016-06-28 Thread Pan Xinhui
->yiled_count keeps zero on powerNV. So we can just skip the machine type. Suggested-by: Boqun Feng <boqun.f...@gmail.com> Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/includ

[PATCH v2 1/4] kernel/sched: introduce vcpu preempted check interface

2016-06-28 Thread Pan Xinhui
. Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- include/linux/sched.h | 12 1 file changed, 12 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index 6e42ada..cb

[PATCH v2 0/4] implement vcpu preempted check

2016-06-28 Thread Pan Xinhui
tem_call We introduce interface bool vcpu_is_preempted(int cpu) and use it in some spin loops of osq_lock, rwsem_spin_on_owner and mutex_spin_on_owner. These spin_on_onwer variant also cause rcu stall before we apply this patch set Pan Xinhui (4): kernel/sched: introduce vcpu preempted check i

[PATCH] arch/powerpc: use BUILD_BUG() when detect unfit {cmp}xchg, size

2016-02-23 Thread Pan Xinhui
From: pan xinhui <xinhui@linux.vnet.ibm.com> __xchg_called_with_bad_pointer() can't tell us what codes use {cmp}xchg in incorrect way. And no error will be reported until the link stage. To fix such kinds of issues in a easy way, we use BUILD_BUG() here. Signed-off-by: pan xinhui &

[PATCH V2] arch/powerpc: use BUILD_BUG_ON_MSG() when detect unfit {cmp}xchg size

2016-02-23 Thread Pan Xinhui
From: pan xinhui <xinhui@linux.vnet.ibm.com> __xchg_called_with_bad_pointer() can't tell us what codes use {cmp}xchg in incorrect way. And no error will be reported until the link stage. To fix such a kind of issues easily, we use BUILD_BUG_ON_MSG() here. Signed-off-by: pan xinhui &

[PATCH V2] arch/powerpc: use BUILD_BUG_ON_MSG() when detect unfit {cmp}xchg size

2016-02-23 Thread Pan Xinhui
From: pan xinhui <xinhui@linux.vnet.ibm.com> __xchg_called_with_bad_pointer() can't tell us what codes use {cmp}xchg in incorrect way. And no error will be reported until the link stage. To fix such a kind of issues easily, we use BUILD_BUG_ON_MSG() here. Signed-off-by: pan xinhui &

Re: [PATCH] powerpc: introduce {cmp}xchg for u8 and u16

2016-04-13 Thread Pan Xinhui
Hello Peter, On 2016年04月12日 22:30, Peter Zijlstra wrote: > On Sun, Apr 10, 2016 at 10:17:28PM +0800, Pan Xinhui wrote: >> >> On 2016年04月08日 15:47, Peter Zijlstra wrote: >>> On Fri, Apr 08, 2016 at 02:41:46PM +0800, Pan Xinhui wrote: >>>> From: pan x

Re: [PATCH] powerpc: introduce {cmp}xchg for u8 and u16

2016-04-10 Thread Pan Xinhui
On 2016年04月08日 15:47, Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 02:41:46PM +0800, Pan Xinhui wrote: >> From: pan xinhui <xinhui@linux.vnet.ibm.com> >> >> Implement xchg{u8,u16}{local,relaxed}, and >> cmpxchg{u8,u16}{,local,acquire,relaxed}. >>

[PATCH] powerpc: introduce {cmp}xchg for u8 and u16

2016-04-08 Thread Pan Xinhui
From: pan xinhui <xinhui@linux.vnet.ibm.com> Implement xchg{u8,u16}{local,relaxed}, and cmpxchg{u8,u16}{,local,acquire,relaxed}. Atomic operation on 8-bit and 16-bit data type is supported from power7 Signed-off-by: pan xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc

Re: [PATCH V4] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-28 Thread Pan Xinhui
On 2016年04月27日 22:59, Boqun Feng wrote: > On Wed, Apr 27, 2016 at 10:50:34PM +0800, Boqun Feng wrote: >> >> Sorry, my bad, we can't implement cmpxchg like this.. please ignore >> this, I should really go to bed soon... >> >> But still, we can save the "tmp" for xchg() I think. >> > > No.. we

Re: [PATCH V4] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-28 Thread Pan Xinhui
On 2016年04月28日 15:59, Peter Zijlstra wrote: > On Wed, Apr 27, 2016 at 05:16:45PM +0800, Pan Xinhui wrote: >> From: Pan Xinhui <xinhui@linux.vnet.ibm.com> >> >> Implement xchg{u8,u16}{local,relaxed}, and >> cmpxchg{u8,u16}{,local,acquire,relaxed}. >&g

[PATCH resend] powerpc: enable qspinlock and its virtualization support

2016-04-28 Thread Pan Xinhui
From: Pan Xinhui <xinhui@linux.vnet.ibm.com> This patch aims to enable qspinlock on PPC. And on pseries platform, it also support paravirt qspinlock. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/qspinlock.h | 37 +

[PATCH] powerpc: enable qspinlock and its virtualization support

2016-04-28 Thread Pan Xinhui
From: Pan Xinhui <xinhui@linux.vnet.ibm.com> This path aims to enable qspinlock on PPC. And on pseries platform, it also support paravirt qspinlock. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/qspinlock.h | 37 +

Re: [PATCH V3] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-26 Thread Pan Xinhui
On 2016年04月25日 23:37, Peter Zijlstra wrote: > On Mon, Apr 25, 2016 at 06:10:51PM +0800, Pan Xinhui wrote: >>> So I'm not actually _that_ familiar with the PPC LL/SC implementation; >>> but there are things a CPU can do to optimize these loops. >>> >&

[PATCH V4] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-27 Thread Pan Xinhui
From: Pan Xinhui <xinhui@linux.vnet.ibm.com> Implement xchg{u8,u16}{local,relaxed}, and cmpxchg{u8,u16}{,local,acquire,relaxed}. It works on all ppc. remove volatile of first parameter in __cmpxchg_local and __cmpxchg Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org>

Re: [PATCH V3] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-25 Thread Pan Xinhui
On 2016年04月22日 00:13, Peter Zijlstra wrote: > On Thu, Apr 21, 2016 at 11:35:07PM +0800, Pan Xinhui wrote: >> yes, you are right. more load/store will be done in C code. >> However such xchg_u8/u16 is just used by qspinlock now. and I did not see >> any performance regress

Re: [PATCH resend] powerpc: enable qspinlock and its virtualization support

2016-04-28 Thread Pan Xinhui
On 2016年04月29日 05:07, Waiman Long wrote: > On 04/28/2016 06:55 AM, Pan Xinhui wrote: >> From: Pan Xinhui<xinhui@linux.vnet.ibm.com> >> >> This patch aims to enable qspinlock on PPC. And on pseries platform, it also >> support >> paravirt qspinlock.

Re: [PATCH V3] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-21 Thread Pan Xinhui
On 2016年04月21日 23:52, Boqun Feng wrote: > On Thu, Apr 21, 2016 at 11:35:07PM +0800, Pan Xinhui wrote: >> On 2016年04月20日 22:24, Peter Zijlstra wrote: >>> On Wed, Apr 20, 2016 at 09:24:00PM +0800, Pan Xinhui wrote: >>> >>>> +#de

[PATCH v3 0/6] powerpc use pv-qpsinlock instead of spinlock

2016-05-17 Thread Pan Xinhui
] __pv_queued_spin_lock_slowpath 3.66% sched-messaging [kernel.vmlinux][k] __pv_queued_spin_unlock 3.37% sched-messaging [kernel.vmlinux][k] __slab_free 3.06% sched-messaging [kernel.vmlinux][k] unix_stream_read_generic Pan Xinhui (6

[PATCH v2 4/6] pv-qspinlock: powerpc support pv-qspinlock

2016-05-17 Thread Pan Xinhui
callbacks to pv version. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/qspinlock.h | 17 + arch/powerpc/include/asm/qspinlock_paravirt.h | 38 +++ .../powerpc/include/asm/qspinlock_paravirt_types.h | 13 +++

[PATCH v2 5/6] pv-qspinlock: use cmpxchg_release in __pv_queued_spin_unlock

2016-05-17 Thread Pan Xinhui
cmpxchg_release is lighter, we can gain a better performace then. Suggested-by: Boqun Feng <boqun.f...@gmail.com> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- kernel/locking/qspinlock_paravirt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ke

[PATCH v2 6/6] powerpc: pseries: pv-qspinlock build config/make

2016-05-17 Thread Pan Xinhui
pseries can use pv-qspinlock. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/kernel/Makefile | 1 + arch/powerpc/platforms/pseries/Kconfig | 8 2 files changed, 9 insertions(+) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/

[PATCH v2 1/6] qspinlock: powerpc support qspinlock

2016-05-17 Thread Pan Xinhui
Base code to enable qspinlock on powerpc. this patch add some #ifdef here and there. Although there is no paravirt related code, we can successfully build a qspinlock kernel after apply this patch. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/qspin

[PATCH v2 3/6] powerpc: lib/locks.c: cpu yield/wake helper function

2016-05-17 Thread Pan Xinhui
pv-qspinlock core has pv_wait/pv_kick which will give a better performace by yielding and kicking cpu at some cases. lets support them by adding two corresponding helper functions. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/spinlock.h | 4

[PATCH v2 2/6] powerpc: pseries/Kconfig: qspinlock build config

2016-05-17 Thread Pan Xinhui
pseries will use qspinlock by default. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/platforms/pseries/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index bec90fb..f

Re: [PATCH] powerpc: introduce {cmp}xchg for u8 and u16

2016-04-18 Thread Pan Xinhui
On 2016年04月17日 03:43, Arnd Bergmann wrote: > On Wednesday 13 April 2016 19:15:17 Pan Xinhui wrote: >> Hello Peter, >> >> On 2016年04月12日 22:30, Peter Zijlstra wrote: >>> On Sun, Apr 10, 2016 at 10:17:28PM +0800, Pan Xinhui wrote: >>>> >>>> On

Re: [PATCH V2] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-19 Thread Pan Xinhui
Hello, boqun On 2016年04月19日 17:18, Boqun Feng wrote: > Hi Xinhui, > > On Tue, Apr 19, 2016 at 02:29:34PM +0800, Pan Xinhui wrote: >> From: Pan Xinhui <xinhui@linux.vnet.ibm.com> >> >> Implement xchg{u8,u16}{local,relaxed}, and >> cmpxchg{u8,u16}{

[PATCH V3] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-20 Thread Pan Xinhui
From: Pan Xinhui <xinhui@linux.vnet.ibm.com> Implement xchg{u8,u16}{local,relaxed}, and cmpxchg{u8,u16}{,local,acquire,relaxed}. It works on all ppc. The basic idea is from commit 3226aad81aa6 ("sh: support 1 and 2 byte xchg") Suggested-by: Peter Zijlstra (Intel) <p

Re: [PATCH] powerpc: introduce {cmp}xchg for u8 and u16

2016-04-14 Thread Pan Xinhui
Hello, Waiman On 2016年04月13日 23:53, Waiman Long wrote: > On 04/13/2016 07:15 AM, Pan Xinhui wrote: >> Hello Peter, >> >> On 2016年04月12日 22:30, Peter Zijlstra wrote: >> >>>> I am working on the qspinlock implementation on PPC. >>>> Your and Waiman

Re: [PATCH V3] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-21 Thread Pan Xinhui
On 2016年04月20日 22:24, Peter Zijlstra wrote: > On Wed, Apr 20, 2016 at 09:24:00PM +0800, Pan Xinhui wrote: > >> +#define __XCHG_GEN(cmp, type, sfx, skip, v) \ >> +static __always_inline unsigned long >> \

[PATCH V2] powerpc: Implement {cmp}xchg for u8 and u16

2016-04-19 Thread Pan Xinhui
From: Pan Xinhui <xinhui@linux.vnet.ibm.com> Implement xchg{u8,u16}{local,relaxed}, and cmpxchg{u8,u16}{,local,acquire,relaxed}. It works on all ppc. Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com>

[PATCH v3 3/6] powerpc: lib/locks.c: Add cpu yield/wake helper function

2016-05-25 Thread Pan Xinhui
pv-qspinlock core has pv_wait/pv_kick which will give a better performace by yielding and kicking cpu at some cases. lets support them by adding two corresponding helper functions. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/spinlock.h | 4

[PATCH v3 1/6] qspinlock: powerpc support qspinlock

2016-05-25 Thread Pan Xinhui
Base code to enable qspinlock on powerpc. this patch add some #ifdef here and there. Although there is no paravirt related code, we can successfully build a qspinlock kernel after apply this patch. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/qspin

[PATCH v3 2/6] powerpc: pseries/Kconfig: Add qspinlock build config

2016-05-25 Thread Pan Xinhui
pseries will use qspinlock by default. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/platforms/pseries/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index bec90fb..f

[PATCH v3 4/6] pv-qspinlock: powerpc support pv-qspinlock

2016-05-25 Thread Pan Xinhui
pv_lock_ops callbacks to pv version. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/qspinlock.h | 17 arch/powerpc/include/asm/qspinlock_paravirt.h | 38 ++ .../powerpc/include/asm/qspinlock_paravirt_types.

[PATCH v3 6/6] powerpc: pseries: Add pv-qspinlock build config/make

2016-05-25 Thread Pan Xinhui
pseries has PowerVM support, the default option is Y. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/kernel/Makefile | 1 + arch/powerpc/platforms/pseries/Kconfig | 8 2 files changed, 9 insertions(+) diff --git a/arch/powerpc/kernel/Make

[PATCH v3 0/6] powerpc use pv-qpsinlock as the default spinlock implemention

2016-05-25 Thread Pan Xinhui
| 311449290 | kernel compiling test: build a linux kernel image to see how long it took _testspinlcok__pv-qspinlcok_ | compiling takes| 22m | 22m | Pan Xinhui (6): qspinlock: powerpc support qspinlock powerpc

[PATCH v3 5/6] pv-qspinlock: use cmpxchg_release in __pv_queued_spin_unlock

2016-05-25 Thread Pan Xinhui
cmpxchg_release is light-wight than cmpxchg, we can gain a better performace then. On some arch like ppc, barrier impact the performace too much. Suggested-by: Boqun Feng <boqun.f...@gmail.com> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- kernel/locking/qspinlock_pa

[PATCH v3 1/4] kernel/sched: introduce vcpu preempted check interface

2016-07-21 Thread Pan Xinhui
check. Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- include/linux/sched.h | 12 1 file changed, 12 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index 6e42ada..cb

[PATCH v3 3/4] locking/osq: Drop the overhead of osq_lock()

2016-07-21 Thread Pan Xinhui
call_common 2.83% sched-messaging [kernel.vmlinux] [k] copypage_power7 2.64% sched-messaging [kernel.vmlinux] [k] rwsem_spin_on_owner 2.00% sched-messaging [kernel.vmlinux] [k] osq_lock Suggested-by: Boqun Feng <boqun.f...@gmail.com> Signed-off-by: Pan Xinhui <xinhui...

[PATCH v3 4/4] kernel/locking: Drop the overhead of {mutex, rwsem}_spin_on_owner

2016-07-21 Thread Pan Xinhui
essaging [kernel.vmlinux] [k] system_call 2.69% sched-messaging [kernel.vmlinux] [k] wait_consider_task Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- kernel/locking/mutex.c | 15 +-- kernel/locking/rwsem-xadd.c | 16 +--- 2 files changed, 26 in

[PATCH v3 0/4] implement vcpu preempted check

2016-07-21 Thread Pan Xinhui
ace bool vcpu_is_preempted(int cpu) and use it in some spin loops of osq_lock, rwsem_spin_on_owner and mutex_spin_on_owner. These spin_on_onwer variant also cause rcu stall before we apply this patch set Pan Xinhui (4): kernel/sched: introduce vcpu preempted check interface powerpc/spinlock: support vcpu p

[PATCH v3 2/4] powerpc/spinlock: support vcpu preempted check

2016-07-21 Thread Pan Xinhui
->yield_count keeps zero on powerNV. So we can just skip the machine type check. Suggested-by: Boqun Feng <boqun.f...@gmail.com> Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/includ

Re: [PATCH v2 2/4] powerpc/spinlock: support vcpu preempted check

2016-07-15 Thread Pan Xinhui
Hi, Baibir sorry for late responce, I missed reading your mail. 在 16/7/6 18:54, Balbir Singh 写道: On Tue, 2016-06-28 at 10:43 -0400, Pan Xinhui wrote: This is to fix some lock holder preemption issues. Some other locks implementation do a spin loop before acquiring the lock itself

[PATCH 1/3] kernel/sched: introduce vcpu preempted check interface

2016-06-27 Thread Pan Xinhui
pteempted check. archs can implement it by define arch_vcpu_is_preempted(). Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- include/linux/sched.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index 6e42ada..dc0a9c3

[PATCH 0/3] implement vcpu preempted check

2016-06-27 Thread Pan Xinhui
so need fix other XXX_spin_on_owner later based on this patch set. these spin_on_onwer variant cause rcu stall. Pan Xinhui (3): powerpc/spinlock: support vcpu preempted check locking/osq: Drop the overload of osq_lock() kernel/sched: introduce vcpu preempted check interface arch/powerpc/

[PATCH 2/3] powerpc/spinlock: support vcpu preempted check

2016-06-27 Thread Pan Xinhui
n.f...@gmail.com> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/lppaca.h | 6 ++ arch/powerpc/include/asm/spinlock.h | 15 +++ 2 files changed, 21 insertions(+) diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/

[PATCH 3/3] locking/osq: Drop the overload of osq_lock()

2016-06-27 Thread Pan Xinhui
mlinux] [k] copypage_power7 2.64% sched-messaging [kernel.vmlinux] [k] rwsem_spin_on_owner 2.00% sched-messaging [kernel.vmlinux] [k] osq_lock Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- kernel/locking/osq_lock.c | 16 +++- 1 file changed, 15 insertio

Re: [PATCH v3 3/3] powerpc/xmon: add debugfs entry for xmon

2017-02-20 Thread Pan Xinhui
在 2017/2/21 09:58, Guilherme G. Piccoli 写道: Currently the xmon debugger is set only via kernel boot command-line. It's disabled by default, and can be enabled with "xmon=on" on the command-line. Also, xmon may be accessed via sysrq mechanism. But we cannot enable/disable xmon in runtime, it

Re: [PATCH] powerpc/xmon: add debugfs entry for xmon

2017-02-13 Thread Pan Xinhui
在 2017/2/14 10:35, Nicholas Piggin 写道: On Mon, 13 Feb 2017 19:00:42 -0200 "Guilherme G. Piccoli" wrote: Currently the xmon debugger is set only via kernel boot command-line. It's disabled by default, and can be enabled with "xmon=on" on the command-line. Also,

[PATCH] powerpc/xmon: Fix an unexpected xmon onoff state change

2017-02-14 Thread Pan Xinhui
Once xmon is triggered by sysrq-x, it is enabled always afterwards even if it is disabled during boot. This will cause a system reset interrut fail to dump. So keep xmon in its original state after exit. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/xmon/xmon

[PATCH] powerpc/xmon: add turn off xmon option

2017-02-12 Thread Pan Xinhui
commands. Turn xmon off if 'z' is following. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/xmon/xmon.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 9c0e17c..2f4e7b1

Re: [PATCH] powerpc/xmon: Fix an unexpected xmon onoff state change

2017-02-16 Thread Pan Xinhui
在 2017/2/16 18:57, Guilherme G. Piccoli 写道: On 16/02/2017 03:09, Michael Ellerman wrote: Pan Xinhui <xinhui@linux.vnet.ibm.com> writes: Once xmon is triggered by sysrq-x, it is enabled always afterwards even if it is disabled during boot. This will cause a system reset interru

Re: [PATCH] powerpc/xmon: Fix an unexpected xmon onoff state change

2017-02-17 Thread Pan Xinhui
在 2017/2/17 14:05, Michael Ellerman 写道: Pan Xinhui <xin...@linux.vnet.ibm.com> writes: diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 9c0e17c..f6e5c3d 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -76,6 +76,7 @@ static int xmon_gate;

Re: [PATCH v3 0/4] implement vcpu preempted check

2016-09-29 Thread Pan Xinhui
在 2016/9/29 18:10, Peter Zijlstra 写道: On Thu, Jul 21, 2016 at 07:45:10AM -0400, Pan Xinhui wrote: change from v2: no code change, fix typos, update some comments change from v1: a simplier definition of default vcpu_is_preempted skip mahcine type check on ppc, and add

Re: [PATCH v3 0/4] implement vcpu preempted check

2016-09-29 Thread Pan Xinhui
在 2016/9/29 18:31, Peter Zijlstra 写道: On Thu, Sep 29, 2016 at 12:23:19PM +0200, Christian Borntraeger wrote: On 09/29/2016 12:10 PM, Peter Zijlstra wrote: On Thu, Jul 21, 2016 at 07:45:10AM -0400, Pan Xinhui wrote: change from v2: no code change, fix typos, update some comments

Re: [PATCH v3 0/4] implement vcpu preempted check

2016-09-30 Thread Pan Xinhui
hi, Paolo thanks for your reply. 在 2016/9/30 14:58, Paolo Bonzini 写道: Please consider s390 and (x86/arm) KVM. Once we have a few, more can follow later, but I think its important to not only have PPC support for this. Actually the s390 preemted check via sigp sense running is

Re: [PATCH v3 0/4] implement vcpu preempted check

2016-09-30 Thread Pan Xinhui
在 2016/9/30 17:08, Paolo Bonzini 写道: On 30/09/2016 10:52, Pan Xinhui wrote: x86 has no hypervisor support, and I'd like to understand the desired semantics first, so I don't think it should block this series. In Once a guest do a hypercall or something similar, IOW

[PATCH v7 6/6] powerpc: pSeries: Add pv-qspinlock build config/make

2016-09-18 Thread Pan Xinhui
pSeries run as a guest and might need pv-qspinlock. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/kernel/Makefile | 1 + arch/powerpc/platforms/pseries/Kconfig | 8 2 files changed, 9 insertions(+) diff --git a/arch/powerpc/kernel/Makefile

[PATCH v7 2/6] powerpc/qspinlock: powerpc support qspinlock

2016-09-18 Thread Pan Xinhui
two endianness system. We override some arch_spin_xxx as powerpc has io_sync stuff which makes sure the io operations are protected by the lock correctly. There is another special case, see commit 2c610022711 ("locking/qspinlock: Fix spin_unlock_wait() some more") Signed-off-by: Pan X

[PATCH v7 3/6] powerpc: pseries/Kconfig: Add qspinlock build config

2016-09-18 Thread Pan Xinhui
pseries will use qspinlock by default. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/platforms/pseries/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index bec90fb..f

[PATCH v7 1/6] pv-qspinlock: use cmpxchg_release in __pv_queued_spin_unlock

2016-09-18 Thread Pan Xinhui
-by: Boqun Feng <boqun.f...@gmail.com> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- kernel/locking/qspinlock_paravirt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h index 8a99

[PATCH v7 0/6] Implement qspinlock/pv-qspinlock on ppc

2016-09-18 Thread Pan Xinhui
1008.3 1122.61134.2 = System Benchmarks Index Score 1072.0 1108.91050.6 -------- Pan Xinhui (6): pv-qspin

[PATCH v7 5/6] powerpc/pv-qspinlock: powerpc support pv-qspinlock

2016-09-18 Thread Pan Xinhui
in the hash table might not be the correct lock holder, as for performace issue, we does not take care of hash conflict. Also introduce spin_lock_holder, which tells who owns the lock now. currently the only user is spin_unlock_wait. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.

[PATCH v7 4/6] powerpc: lib/locks.c: Add cpu yield/wake helper function

2016-09-18 Thread Pan Xinhui
will introduce latency and a little overhead. And we do NOT want to suffer any latency on some cases, e.g. in interrupt handler. The second parameter *confer* can indicate such case. __spin_wake_cpu is simpiler, it will wake up one vcpu regardless of its current vcpu state. Signed-off-by: Pan

[PATCH v4 2/5] locking/osq: Drop the overload of osq_lock()

2016-10-19 Thread Pan Xinhui
call_common 2.83% sched-messaging [kernel.vmlinux] [k] copypage_power7 2.64% sched-messaging [kernel.vmlinux] [k] rwsem_spin_on_owner 2.00% sched-messaging [kernel.vmlinux] [k] osq_lock Suggested-by: Boqun Feng <boqun.f...@gmail.com> Signed-off-by: Pan Xinhui <xinhui...

[PATCH v4 5/5] x86, kvm: support vcpu preempted check

2016-10-19 Thread Pan Xinhui
Scripts (1 concurrent) |23224.3 lpm |22607.4 lpm Shell Scripts (8 concurrent) | 3531.4 lpm | 3211.9 lpm System Call Overhead | 10385653.0 lps | 10419979.0 lps Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/x86/inclu

[PATCH v4 1/5] kernel/sched: introduce vcpu preempted check interface

2016-10-19 Thread Pan Xinhui
. Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- include/linux/sched.h | 12 1 file changed, 12 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index 348f51b..44

[PATCH v4 0/5] implement vcpu preempted check

2016-10-19 Thread Pan Xinhui
ncurrent) |23224.3 lpm |22607.4 lpm Shell Scripts (8 concurrent) | 3531.4 lpm | 3211.9 lpm System Call Overhead | 10385653.0 lps | 10419979.0 lps Pan Xinhui (5): kernel/sched: introduce vcpu preempted check interface locking/osq: Drop the

[PATCH v4 3/5] kernel/locking: Drop the overload of {mutex, rwsem}_spin_on_owner

2016-10-19 Thread Pan Xinhui
essaging [kernel.vmlinux] [k] system_call 2.69% sched-messaging [kernel.vmlinux] [k] wait_consider_task Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- kernel/locking/mutex.c | 15 +-- kernel/locking/rwsem-xadd.c | 16 +--- 2 files changed, 26 in

[PATCH v4 4/5] powerpc/spinlock: support vcpu preempted check

2016-10-19 Thread Pan Xinhui
->yiled_count keeps zero on powerNV. So we can just skip the machine type check. Suggested-by: Boqun Feng <boqun.f...@gmail.com> Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/spinl

[PATCH v5 0/9] implement vcpu preempted check

2016-10-20 Thread Pan Xinhui
ripts (8 concurrent) | 3531.4 lpm | 3211.9 lpm System Call Overhead | 10385653.0 lps | 10419979.0 lps Christian Borntraeger (1): s390/spinlock: Provide vcpu_is_preempted Juergen Gross (1): x86, xen: support vcpu preempted check Pan Xinhui (7): kernel/sched: i

Re: [PATCH v4 5/5] x86, kvm: support vcpu preempted check

2016-10-24 Thread Pan Xinhui
在 2016/10/24 23:18, Paolo Bonzini 写道: On 24/10/2016 17:14, Radim Krčmář wrote: 2016-10-24 16:39+0200, Paolo Bonzini: On 19/10/2016 19:24, Radim Krčmář wrote: + if (vcpu->arch.st.msr_val & KVM_MSR_ENABLED) + if (kvm_read_guest_cached(vcpu->kvm, >arch.st.stime, +

[PATCH v5 4/9] powerpc/spinlock: support vcpu preempted check

2016-10-20 Thread Pan Xinhui
->yiled_count keeps zero on powerNV. So we can just skip the machine type check. Suggested-by: Boqun Feng <boqun.f...@gmail.com> Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/powerpc/include/asm/spinl

[PATCH v5 8/9] s390/spinlock: Provide vcpu_is_preempted

2016-10-20 Thread Pan Xinhui
From: Christian Borntraeger this implements the s390 backend for commit "kernel/sched: introduce vcpu preempted check interface" by reworking the existing smp_vcpu_scheduled into arch_vcpu_is_preempted. We can then also get rid of the local cpu_is_preempted function by

[PATCH v5 6/9] x86, kvm: support vcpu preempted check

2016-10-20 Thread Pan Xinhui
Call Overhead | 10385653.0 lps | 10419979.0 lps Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/x86/include/uapi/asm/kvm_para.h | 3 ++- arch/x86/kernel/kvm.c| 12 arch/x86/kvm/x86.c | 18 +++

[PATCH v5 2/9] locking/osq: Drop the overload of osq_lock()

2016-10-20 Thread Pan Xinhui
call_common 2.83% sched-messaging [kernel.vmlinux] [k] copypage_power7 2.64% sched-messaging [kernel.vmlinux] [k] rwsem_spin_on_owner 2.00% sched-messaging [kernel.vmlinux] [k] osq_lock Suggested-by: Boqun Feng <boqun.f...@gmail.com> Signed-off-by: Pan Xinhui <xinhui@linux

[PATCH v5 9/9] Documentation: virtual: kvm: Support vcpu preempted check

2016-10-20 Thread Pan Xinhui
n preempted. Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- Documentation/virtual/kvm/msr.txt | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/virtual/kvm/msr.txt b/Documentation/virtual/kvm/msr.txt index 2a71c8f..3376f13 100644 --- a

[PATCH v5 3/9] kernel/locking: Drop the overload of {mutex, rwsem}_spin_on_owner

2016-10-20 Thread Pan Xinhui
essaging [kernel.vmlinux] [k] system_call 2.69% sched-messaging [kernel.vmlinux] [k] wait_consider_task Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntrae...@de.ibm.com> Tested-by: Juergen Gross <jgr...@suse.com> --- kernel

[PATCH v5 5/9] x86, paravirt: Add interface to support kvm/xen vcpu preempted check

2016-10-20 Thread Pan Xinhui
the spin loops upon on the retval of vcpu_is_preempted. As kernel has used this interface, So lets support it. To deal with kernel and kvm/xen, add vcpu_is_preempted into struct pv_lock_ops. Then kvm or xen could provide their own implementation to support vcpu_is_preempted. Signed-off-by: Pan

[PATCH v5 7/9] x86, xen: support vcpu preempted check

2016-10-20 Thread Pan Xinhui
early yielding. A quick test (4 vcpus on 1 physical cpu doing a parallel build job with "make -j 8") reduced system time by about 5% with this patch. Signed-off-by: Juergen Gross <jgr...@suse.com> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- arch/x86/xe

[PATCH v5 1/9] kernel/sched: introduce vcpu preempted check interface

2016-10-20 Thread Pan Xinhui
. Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntrae...@de.ibm.com> Tested-by: Juergen Gross <jgr...@suse.com> --- include/linux/sched.h | 12 1 fil

Re: [PATCH v5 9/9] Documentation: virtual: kvm: Support vcpu preempted check

2016-10-20 Thread Pan Xinhui
在 2016/10/21 09:23, Boqun Feng 写道: On Thu, Oct 20, 2016 at 05:27:54PM -0400, Pan Xinhui wrote: Commit ("x86, kvm: support vcpu preempted check") add one field "__u8 preempted" into struct kvm_steal_time. This field tells if one vcpu is running or not. It is zero if

Re: [PATCH v4 0/5] implement vcpu preempted check

2016-10-19 Thread Pan Xinhui
在 2016/10/19 23:58, Juergen Gross 写道: On 19/10/16 12:20, Pan Xinhui wrote: change from v3: add x86 vcpu preempted check patch change from v2: no code change, fix typos, update some comments change from v1: a simplier definition of default vcpu_is_preempted skip

Re: [PATCH v4 0/5] implement vcpu preempted check

2016-10-19 Thread Pan Xinhui
在 2016/10/19 14:47, Christian Borntraeger 写道: On 10/19/2016 12:20 PM, Pan Xinhui wrote: change from v3: add x86 vcpu preempted check patch If you want you could add the s390 patch that I provided for your last version. I also gave my Acked-by for all previous patches. hi

Re: [PATCH v4 5/5] x86, kvm: support vcpu preempted check

2016-10-19 Thread Pan Xinhui
在 2016/10/20 01:24, Radim Krčmář 写道: 2016-10-19 06:20-0400, Pan Xinhui: This is to fix some lock holder preemption issues. Some other locks implementation do a spin loop before acquiring the lock itself. Currently kernel has an interface of bool vcpu_is_preempted(int cpu). It takes the cpu

Re: [PATCH] powerpc: Fix __cmpxchg() to take a volatile ptr again

2016-11-24 Thread Pan Xinhui
在 2016/11/25 11:07, Michael Ellerman 写道: In commit d0563a1297e2 ("powerpc: Implement {cmp}xchg for u8 and u16") we removed the volatile from __cmpxchg(). This is leading to warnings such as: drivers/gpu/drm/drm_lock.c: In function ‘drm_lock_take’:

Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen vcpu preempted check

2016-11-16 Thread Pan Xinhui
在 2016/11/16 18:23, Peter Zijlstra 写道: On Wed, Nov 16, 2016 at 12:19:09PM +0800, Pan Xinhui wrote: Hi, Peter. I think we can avoid a function call in a simpler way. How about below static inline bool vcpu_is_preempted(int cpu) { /* only set in pv case

Re: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen vcpu preempted check

2016-11-15 Thread Pan Xinhui
在 2016/11/15 23:47, Peter Zijlstra 写道: On Wed, Nov 02, 2016 at 05:08:33AM -0400, Pan Xinhui wrote: diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 0f400c0..38c3bb7 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm

[PATCH v6 01/11] kernel/sched: introduce vcpu preempted check interface

2016-10-27 Thread Pan Xinhui
. Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntrae...@de.ibm.com> Tested-by: Juergen Gross <jgr...@suse.com> --- include/linux/sched.h | 12 1 fil

[PATCH v6 02/11] locking/osq: Drop the overload of osq_lock()

2016-10-27 Thread Pan Xinhui
call_common 2.83% sched-messaging [kernel.vmlinux] [k] copypage_power7 2.64% sched-messaging [kernel.vmlinux] [k] rwsem_spin_on_owner 2.00% sched-messaging [kernel.vmlinux] [k] osq_lock Suggested-by: Boqun Feng <boqun.f...@gmail.com> Signed-off-by: Pan Xinhui <xinhui@linux

  1   2   >