Re: [RFC PATCH-tip v2 1/6] locking/osq: Make lock/unlock proper acquire/release barrier

2016-06-15 Thread Boqun Feng
On Wed, Jun 15, 2016 at 03:01:19PM -0400, Waiman Long wrote: > On 06/15/2016 04:04 AM, Boqun Feng wrote: > > Hi Waiman, > > > > On Tue, Jun 14, 2016 at 06:48:04PM -0400, Waiman Long wrote: > > > The osq_lock() and osq_unlock() function may not provide the neces

Re: [RFC PATCH-tip v2 1/6] locking/osq: Make lock/unlock proper acquire/release barrier

2016-06-15 Thread Boqun Feng
Hi Waiman, On Tue, Jun 14, 2016 at 06:48:04PM -0400, Waiman Long wrote: > The osq_lock() and osq_unlock() function may not provide the necessary > acquire and release barrier in some cases. This patch makes sure > that the proper barriers are provided when osq_lock() is successful > or when osq_un

Re: [PATCH] locking/qspinlock: Use atomic_sub_return_release in queued_spin_unlock

2016-06-13 Thread Boqun Feng
On Mon, Jun 13, 2016 at 12:45:23PM -0700, Davidlohr Bueso wrote: > On Fri, 03 Jun 2016, Pan Xinhui wrote: > > > The existing version uses a heavy barrier while only release semantics > > is required. So use atomic_sub_return_release instead. > > > > Suggested-by: Peter Zijlstra (Intel) > > Signe

[PATCH v4] powerpc: spinlock: Fix spin_unlock_wait()

2016-06-09 Thread Boqun Feng
t; spin_lock() This patch therefore fixes the issue and also cleans the arch_spin_unlock_wait() a little bit by removing superfluous memory barriers in loops and consolidating the implementations for PPC32 and PPC64 into one. Suggested-by: "Paul E. McKenney" Signed-off-by: Boqun F

Re: [PATCH v3] powerpc: spinlock: Fix spin_unlock_wait()

2016-06-09 Thread Boqun Feng
On Fri, Jun 10, 2016 at 01:25:03AM +0800, Boqun Feng wrote: > On Thu, Jun 09, 2016 at 10:23:28PM +1000, Michael Ellerman wrote: > > On Wed, 2016-06-08 at 15:59 +0200, Peter Zijlstra wrote: > > > On Wed, Jun 08, 2016 at 11:49:20PM +1000, Michael Ellerman wrote: > > > &

Re: [PATCH v3] powerpc: spinlock: Fix spin_unlock_wait()

2016-06-09 Thread Boqun Feng
On Thu, Jun 09, 2016 at 10:23:28PM +1000, Michael Ellerman wrote: > On Wed, 2016-06-08 at 15:59 +0200, Peter Zijlstra wrote: > > On Wed, Jun 08, 2016 at 11:49:20PM +1000, Michael Ellerman wrote: > > > > > > Ok; what tree does this go in? I have this dependent series which I'd > > > > like to get so

Re: [PATCH -v4 5/7] locking, arch: Update spin_unlock_wait()

2016-06-07 Thread Boqun Feng
On Tue, Jun 07, 2016 at 02:00:16PM +0200, Peter Zijlstra wrote: > On Tue, Jun 07, 2016 at 07:43:15PM +0800, Boqun Feng wrote: > > On Mon, Jun 06, 2016 at 06:08:36PM +0200, Peter Zijlstra wrote: > > > diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c > &

Re: [PATCH -v4 5/7] locking, arch: Update spin_unlock_wait()

2016-06-07 Thread Boqun Feng
On Mon, Jun 06, 2016 at 06:08:36PM +0200, Peter Zijlstra wrote: > On Thu, Jun 02, 2016 at 06:57:00PM +0100, Will Deacon wrote: > > > This 'replaces' commit: > > > > > > 54cf809b9512 ("locking,qspinlock: Fix spin_is_locked() and > > > spin_unlock_wait()") > > > > > > and seems to still work wit

Re: [v2] powerpc: spinlock: Fix spin_unlock_wait()

2016-06-05 Thread Boqun Feng
On Mon, Jun 06, 2016 at 02:52:05PM +1000, Michael Ellerman wrote: > On Fri, 2016-03-06 at 03:49:48 UTC, Boqun Feng wrote: > > There is an ordering issue with spin_unlock_wait() on powerpc, because > > the spin_lock primitive is an ACQUIRE and an ACQUIRE is only ordering > >

[PATCH v2] powerpc: spinlock: Fix spin_unlock_wait()

2016-06-02 Thread Boqun Feng
_locked_sync() -> spin_unlock() -> spin_lock() This patch therefore fixes the issue and also cleans the arch_spin_unlock_wait() a little bit by removing superfluous memory barriers in loops and consolidating the implementations for PPC32 and PPC64 into one. Suggested-by

Re: [PATCH -v4 5/7] locking, arch: Update spin_unlock_wait()

2016-06-02 Thread Boqun Feng
On Thu, Jun 02, 2016 at 11:11:07PM +0800, Boqun Feng wrote: [snip] > > OK, I will resend a new patch making spin_unlock_wait() align the > semantics in your series. > I realize that if my patch goes first then it's more safe and convenient to keep the two smp_mb()s in ppc arch

Re: [PATCH -v4 5/7] locking, arch: Update spin_unlock_wait()

2016-06-02 Thread Boqun Feng
On Thu, Jun 02, 2016 at 04:44:24PM +0200, Peter Zijlstra wrote: > On Thu, Jun 02, 2016 at 10:24:40PM +0800, Boqun Feng wrote: > > On Thu, Jun 02, 2016 at 01:52:02PM +0200, Peter Zijlstra wrote: > > About spin_unlock_wait() on ppc, I actually have a fix pending review

Re: [PATCH -v4 5/7] locking, arch: Update spin_unlock_wait()

2016-06-02 Thread Boqun Feng
On Thu, Jun 02, 2016 at 01:52:02PM +0200, Peter Zijlstra wrote: [snip] > --- a/arch/powerpc/include/asm/spinlock.h > +++ b/arch/powerpc/include/asm/spinlock.h > @@ -27,6 +27,8 @@ > #include > #include > #include > +#include > +#include > > #ifdef CONFIG_PPC64 > /* use 0x80yy when lo

Re: [PATCH -v3 3/8] locking: Introduce smp_acquire__after_ctrl_dep

2016-06-01 Thread Boqun Feng
On Wed, Jun 01, 2016 at 06:22:55PM +0200, Peter Zijlstra wrote: > On Wed, Jun 01, 2016 at 09:52:14PM +0800, Boqun Feng wrote: > > On Tue, May 31, 2016 at 11:41:37AM +0200, Peter Zijlstra wrote: > > > > @@ -292,7 +282,7 @@ static void sem_wait_array(struct sem_ar >

Re: [PATCH -v3 3/8] locking: Introduce smp_acquire__after_ctrl_dep

2016-06-01 Thread Boqun Feng
On Tue, May 31, 2016 at 11:41:37AM +0200, Peter Zijlstra wrote: [snip] > @@ -260,16 +260,6 @@ static void sem_rcu_free(struct rcu_head > } > > /* > - * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they > - * are only control barriers. > - * The code must pair with spin_unlo

Re: [PATCH -v2 19/33] locking,powerpc: Implement atomic{,64}_fetch_{add,sub,and,or,xor}{,_relaxed,_acquire,_release}()

2016-05-31 Thread Boqun Feng
On Wed, Jun 01, 2016 at 11:11:38AM +0800, Boqun Feng wrote: > Hi Peter, > > On Tue, May 31, 2016 at 12:19:44PM +0200, Peter Zijlstra wrote: > [snip] > > > > @@ -329,20 +361,53 @@ atomic64_##op##_return_relaxed(lo

Re: [PATCH -v2 19/33] locking,powerpc: Implement atomic{,64}_fetch_{add,sub,and,or,xor}{,_relaxed,_acquire,_release}()

2016-05-31 Thread Boqun Feng
Hi Peter, On Tue, May 31, 2016 at 12:19:44PM +0200, Peter Zijlstra wrote: [snip] > > @@ -329,20 +361,53 @@ atomic64_##op##_return_relaxed(long a, a > return t; \ > } > > +#define ATOMIC64_FETCH_OP_RELAXED(op, asm_op)

Re: [PATCH 1/2] locking/pvqspinlock: Fix missed PV wakeup problem

2016-05-27 Thread Boqun Feng
Hi Waiman, On Thu, May 26, 2016 at 02:21:57PM -0400, Waiman Long wrote: > Currently, calling pv_hash() and setting _Q_SLOW_VAL is only > done once for any pv_node. It is either in pv_kick_node() or in > pv_wait_head_or_lock(). Because of lock stealing, a pv_kick'ed node is > not guaranteed to get

Re: sem_lock() vs qspinlocks

2016-05-24 Thread Boqun Feng
On Mon, May 23, 2016 at 10:52:09AM -0700, Linus Torvalds wrote: > On Mon, May 23, 2016 at 5:25 AM, Peter Zijlstra wrote: > > > > Paul has smp_mb__after_unlock_lock() for the RCpc 'upgrade'. How about > > something like: > > > > smp_mb__after_lock() > > I'd much rather make the naming be h

Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep

2016-05-24 Thread Boqun Feng
On Tue, May 24, 2016 at 09:53:29PM -0700, Paul E. McKenney wrote: > On Tue, May 24, 2016 at 11:01:21PM -0400, Waiman Long wrote: > > On 05/24/2016 10:27 AM, Peter Zijlstra wrote: > > >Introduce smp_acquire__after_ctrl_dep(), this construct is not > > >uncommen, but the lack of this barrier is. > >

[PATCH] rcuperf: Don't treat gp_exp mis-setting as a WARN

2016-05-24 Thread Boqun Feng
tions by default. Suggested-by: Paul E. McKenney Signed-off-by: Boqun Feng Fixes: http://lkml.kernel.org/r/57411b10.mfvg0+agcrmxgtcj%fengguang...@intel.com --- kernel/rcu/rcuperf.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/r

Re: [rcutorture] 8704baab9b: WARNING: CPU: 0 PID: 30 at kernel/rcu/rcuperf.c:363 rcu_perf_writer

2016-05-24 Thread Boqun Feng
On Tue, May 24, 2016 at 11:06:52AM -0700, Paul E. McKenney wrote: > On Mon, May 23, 2016 at 12:35:35PM +0800, Boqun Feng wrote: > > On Sun, May 22, 2016 at 08:28:06AM -0700, Paul E. McKenney wrote: > > > On Sun, May 22, 2016 at 02:26:49PM +0800, Boqun Feng wrot

Re: [rcutorture] 8704baab9b: WARNING: CPU: 0 PID: 30 at kernel/rcu/rcuperf.c:363 rcu_perf_writer

2016-05-22 Thread Boqun Feng
On Sun, May 22, 2016 at 08:28:06AM -0700, Paul E. McKenney wrote: > On Sun, May 22, 2016 at 02:26:49PM +0800, Boqun Feng wrote: > > Hi Paul, > > > > On Sat, May 21, 2016 at 10:24:22PM -0700, Paul E. McKenney wrote: > > > On Sun, May 22, 2016 at 10:36:00AM

Re: [rcutorture] 8704baab9b: WARNING: CPU: 0 PID: 30 at kernel/rcu/rcuperf.c:363 rcu_perf_writer

2016-05-21 Thread Boqun Feng
Hi Paul, On Sat, May 21, 2016 at 10:24:22PM -0700, Paul E. McKenney wrote: > On Sun, May 22, 2016 at 10:36:00AM +0800, kernel test robot wrote: > > Greetings, > > > > 0day kernel testing robot got the below dmesg and the first bad commit is > > > > https://git.kernel.org/pub/scm/linux/kernel/git

Re: sem_lock() vs qspinlocks

2016-05-20 Thread Boqun Feng
Hi Peter, On Fri, May 20, 2016 at 01:58:19PM +0200, Peter Zijlstra wrote: > On Thu, May 19, 2016 at 10:39:26PM -0700, Davidlohr Bueso wrote: > > As such, the following restores the behavior of the ticket locks and 'fixes' > > (or hides?) the bug in sems. Naturally incorrect approach: > > > > @@ -

[PATCH 3/4] rcutorture: Make -soundhw a x86 specific option

2016-05-18 Thread Boqun Feng
The option "-soundhw pcspk" gives me a error on PPC as follow: qemu-system-ppc64: ISA bus not available for pcspk , which means this option doesn't work on ppc by default. So simply make this an x86-specific option via identify_qemu_args(). Signed-off-by: Boqun Feng ---

[PATCH 4/4] rcutorture: Don't specify the cpu type of QEMU on PPC

2016-05-18 Thread Boqun Feng
Do not restrict the cpu type to POWER7 for QEMU as we have POWER8 now. Signed-off-by: Boqun Feng --- tools/testing/selftests/rcutorture/bin/functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing

[PATCH 2/4] rcutorture: Use vmlinux as the fallback kernel image

2016-05-18 Thread Boqun Feng
${TORTURE_BOOT_IMAGE} is not set on non-x86 architectures, also fixes several places that hard-code "bzImage" as $KERNEL. This also fixes a problem that PPC doesn't have a bzImage file as build results. Signed-off-by: Boqun Feng --- tools/testing/selftests/rcutorture/bin/functio

[PATCH 1/4] rcutorture/doc: Add a new way to create initrd using dracut

2016-05-18 Thread Boqun Feng
tions where host's initramfs couldn't be used. Signed-off-by: Boqun Feng --- tools/testing/selftests/rcutorture/doc/initrd.txt | 22 ++ 1 file changed, 22 insertions(+) diff --git a/tools/testing/selftests/rcutorture/doc/initrd.txt b/tools/testing/selftests

[PATCH 0/4] rcutorture: Several fixes to run selftest scripts on PPC

2016-05-18 Thread Boqun Feng
x27;m certainly not an expert of qemu or bash programming, there may be something I am missing in those patches. So tests and comments are welcome ;-) Regards, Boqun Boqun Feng (4): rcutorture/doc: Add a new way to create initrd using dracut rcutorture: Use vmlinux as the fallback kernel

[RFC rcu/next] torture: Stop onoff task if there is only one cpu

2016-05-01 Thread Boqun Feng
If the whole system has only one cpu, that cpu won't be able to be offlined, so there is no need onoff task is stil running. Signed-off-by: Boqun Feng --- I hit something like the following while I was running rcutorture in a guest with only one vCPU: [ 31.197457] rcu-torture:torture_

Re: [RESEND PATCH v3] locking/pvqspinlock: Add lock holder CPU argument to pv_wait()

2016-04-28 Thread Boqun Feng
Hi Waiman, On Thu, Apr 21, 2016 at 11:02:05AM -0400, Waiman Long wrote: > Pan Xinhui was asking for a lock holder cpu argument in pv_wait() > to help the porting of pvqspinlock to PPC. The new argument will can > help hypervisor expediate the execution of the critical section by > the lock holder,

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

2016-04-27 Thread Boqun Feng
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 can't. Sorr

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

2016-04-27 Thread Boqun Feng
On Wed, Apr 27, 2016 at 09:58:17PM +0800, Boqun Feng wrote: > On Wed, Apr 27, 2016 at 05:16:45PM +0800, Pan Xinhui wrote: > > From: Pan Xinhui > > > > Implement xchg{u8,u16}{local,relaxed}, and > > cmpxchg{u8,u16}{,local,acquire,relaxed}. > > > > It works

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

2016-04-27 Thread Boqun Feng
On Wed, Apr 27, 2016 at 09:58:17PM +0800, Boqun Feng wrote: > On Wed, Apr 27, 2016 at 05:16:45PM +0800, Pan Xinhui wrote: > > From: Pan Xinhui > > > > Implement xchg{u8,u16}{local,relaxed}, and > > cmpxchg{u8,u16}{,local,acquire,relaxed}. > > > > It works

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

2016-04-27 Thread Boqun Feng
On Wed, Apr 27, 2016 at 05:16:45PM +0800, Pan Xinhui wrote: > From: Pan Xinhui > > 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 Zijl

[tip:locking/urgent] locking/lockdep: Fix ->irq_context calculation

2016-04-23 Thread tip-bot for Boqun Feng
Commit-ID: c24697566298df04cac9913e0601501b5ee2b3f5 Gitweb: http://git.kernel.org/tip/c24697566298df04cac9913e0601501b5ee2b3f5 Author: Boqun Feng AuthorDate: Tue, 16 Feb 2016 13:57:40 +0800 Committer: Ingo Molnar CommitDate: Sat, 23 Apr 2016 13:53:03 +0200 locking/lockdep: Fix

Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait()

2016-04-22 Thread Boqun Feng
On Fri, Apr 22, 2016 at 05:53:11PM +0100, Will Deacon wrote: > On Sat, Apr 23, 2016 at 12:08:57AM +0800, Boqun Feng wrote: > > On Tue, Apr 12, 2016 at 05:59:41PM +0100, Will Deacon wrote: > > [...] > > > > +static inline void __cmpwait(volatile void *ptr, unsigned

Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait()

2016-04-22 Thread Boqun Feng
On Sat, Apr 23, 2016 at 04:37:36AM +0200, Peter Zijlstra wrote: > On Sat, Apr 23, 2016 at 12:08:57AM +0800, Boqun Feng wrote: > > How about replace smp_rmb() with a smp_acquire_barrier__after_cmpwait()? > > This barrier is designed to provide an ACQUIRE ordering when combinin

Re: [RFC][PATCH 18/31] locking,powerpc: Implement atomic{,64}_fetch_{add,sub,and,or,xor}{,_relaxed,_acquire,_release}()

2016-04-22 Thread Boqun Feng
On Fri, Apr 22, 2016 at 11:04:31AM +0200, Peter Zijlstra wrote: > Implement FETCH-OP atomic primitives, these are very similar to the > existing OP-RETURN primitives we already have, except they return the > value of the atomic variable _before_ modification. > > This is especially useful for irre

Re: [RFC][PATCH 3/3] locking,arm64: Introduce cmpwait()

2016-04-22 Thread Boqun Feng
On Tue, Apr 12, 2016 at 05:59:41PM +0100, Will Deacon wrote: [...] > > +static inline void __cmpwait(volatile void *ptr, unsigned long val, int > > size) > > +{ > > + switch (size) { > > + case 1: return __cmpwait_case_1(ptr, val); > > + case 2: return __cmpwait_case_2(ptr, val); > > + cas

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

2016-04-21 Thread Boqun Feng
On Fri, Apr 22, 2016 at 09:59:22AM +0800, Pan Xinhui wrote: > 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:2

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

2016-04-21 Thread Boqun Feng
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: > > > >> +#define __XCHG_GEN(cmp, type, sfx, skip, v) > >> \ > >> +static __always_inline unsigne

[PATCH powerpc/next RESEND] powerpc: spinlock: Fix spin_unlock_wait()

2016-04-19 Thread Boqun Feng
barriers in loops and consolidating the implementations for PPC32 and PPC64 into one. Suggested-by: "Paul E. McKenney" Signed-off-by: Boqun Feng Reviewed-by: "Paul E. McKenney" --- arch/powerpc/include/asm/spinlock.h | 48 - arch/powerpc/l

[PATCH powerpc/next] powerpc: spinlock: Fix spin_unlock_wait()

2016-04-19 Thread Boqun Feng
barriers in loops and consolidating the implementations for PPC32 and PPC64 into one. Suggested-by: "Paul E. McKenney" Signed-off-by: Boqun Feng Reviewed-by: "Paul E. McKenney" --- arch/powerpc/include/asm/spinlock.h | 48 - arch/powerpc/l

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

2016-04-19 Thread Boqun Feng
Hi Xinhui, On Tue, Apr 19, 2016 at 02:29:34PM +0800, Pan Xinhui wrote: > From: Pan Xinhui > > Implement xchg{u8,u16}{local,relaxed}, and > cmpxchg{u8,u16}{,local,acquire,relaxed}. > > It works on all ppc. > Nice work! AFAICT, your work doesn't depend on anything that ppc-specific, right? So

Re: [PATCH tip/core/rcu 10/10] documentation: Add documentation for RCU's major data structures

2016-04-16 Thread Boqun Feng
Hi Paul, On Tue, Apr 12, 2016 at 08:18:21AM -0700, Paul E. McKenney wrote: > This commit adds documentation for RCU's major data structures, > including rcu_state, rcu_node, rcu_data, rcu_dynticks, and rcu_head. > One small thing, you are using term TREE_PREEMPT_RCU throughout the whole document

Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks

2016-04-14 Thread Boqun Feng
On Wed, Apr 13, 2016 at 01:38:33PM -0400, Waiman Long wrote: > On 04/12/2016 10:09 PM, Boqun Feng wrote: > > Hi Waiman, > > > > On Tue, Apr 12, 2016 at 06:54:43PM -0400, Waiman Long wrote: > > [...] > > > + > > > +/* > > > + *

Re: [PATCH v7 1/4] lib/percpu-list: Per-cpu list with associated per-cpu locks

2016-04-12 Thread Boqun Feng
my code reading skills, I think the following patch helps ;-) Also it can resolve several splats of sparse when running 'make C=1 lib/'. Thoughts? Regards, Boqun >8 From: Boqun Feng Date: Wed, 13 Apr 2016 09:49:13 +0800 Subject: [PATCH]

Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260

2016-03-31 Thread Boqun Feng
On Thu, Mar 31, 2016 at 05:42:34PM +0200, Peter Zijlstra wrote: > On Wed, Mar 30, 2016 at 05:59:54PM +0800, Boqun Feng wrote: > > So we should use macro like current_hardirq_context() here? Or > > considering the two helpers introduced in my RFC: > > > > http://lkml.ke

Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260

2016-03-30 Thread Boqun Feng
Hi Peter, On Wed, Mar 30, 2016 at 11:36:59AM +0200, Peter Zijlstra wrote: > On Tue, Mar 29, 2016 at 10:47:02AM +0200, Ingo Molnar wrote: > > > > You are right; this is lockdep running into a hash collision; which is a > > > new > > > DEBUG_LOCKDEP test. See 9e4e7554e755 ("locking/lockdep: Detec

Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260

2016-03-27 Thread Boqun Feng
On Sun, Mar 27, 2016 at 10:59:00PM +0200, Sedat Dilek wrote: > On Sun, Mar 27, 2016 at 10:48 PM, Peter Zijlstra wrote: > > On Sun, Mar 27, 2016 at 05:03:44AM -0700, Linus Torvalds wrote: > >> Anyway, I don't think that DEBUG_LOCKS_WARN_ON() in > >> > >> kernel/locking/lockdep.c:2017 __lock_acqui

Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260

2016-03-27 Thread Boqun Feng
On Sun, Mar 27, 2016 at 05:03:44AM -0700, Linus Torvalds wrote: > On Sun, Mar 27, 2016 at 1:57 AM, Sedat Dilek wrote: > > > > I pulled ext4.git#dev on top of Linux v4.6-rc1... > > > > ... and did not see the call-trace. > > Unless you're using overlayfs or per-file encryption, I'm not seeing > th

Re: [PATCH] rcu: Remove superfluous versions of rcu_read_lock_sched_held()

2016-03-23 Thread Boqun Feng
On Wed, Mar 23, 2016 at 09:38:46AM -0700, Paul E. McKenney wrote: > On Wed, Mar 23, 2016 at 11:11:48PM +0800, Boqun Feng wrote: > > Currently, we have four versions of rcu_read_lock_sched_held(), > > depending on the combined choices on PREEMPT_COUNT and DEBUG_LOCK_ALLOC. > >

[PATCH] rcu: Remove superfluous versions of rcu_read_lock_sched_held()

2016-03-23 Thread Boqun Feng
ng as expected and save several lines of code. Signed-off-by: Boqun Feng --- include/linux/rcupdate.h | 17 + kernel/rcu/update.c | 4 ++-- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index b5d48bd..e3

Re: [PATCH] sched: Add preempt checks in preempt_schedule() code

2016-03-19 Thread Boqun Feng
On Sat, Mar 19, 2016 at 12:10:30PM +0800, Boqun Feng wrote: > Hi Steven, > > On Fri, Mar 18, 2016 at 01:06:02PM -0400, Steven Rostedt wrote: > > While testing the tracer preemptoff, I hit this strange trace: > > > > # cmd p

Re: [PATCH] sched: Add preempt checks in preempt_schedule() code

2016-03-18 Thread Boqun Feng
Hi Steven, On Fri, Mar 18, 2016 at 01:06:02PM -0400, Steven Rostedt wrote: > While testing the tracer preemptoff, I hit this strange trace: > > # cmd pid | time | caller > # \ / | \| / ><...>-259 0...10us : schedule <-worker_thread >

Re: [RFC v2 0/6] Track RCU dereferences in RCU read-side critical sections

2016-03-01 Thread Boqun Feng
On Tue, Mar 01, 2016 at 11:01:34AM +0100, Peter Zijlstra wrote: > On Tue, Mar 01, 2016 at 10:57:07AM +0100, Peter Zijlstra wrote: > > On Tue, Mar 01, 2016 at 05:32:42PM +0800, Boqun Feng wrote: > > > > One could for example allow something like: > > > &g

Re: [RFC v2 0/6] Track RCU dereferences in RCU read-side critical sections

2016-03-01 Thread Boqun Feng
On Mon, Feb 29, 2016 at 01:43:18PM +0100, Peter Zijlstra wrote: > On Mon, Feb 29, 2016 at 09:12:20AM +0800, Boqun Feng wrote: > > > The problem is: > > > > Currently there is no way to know which rcu_dereference() and its > > friends a rcu_read_lock() or one of

Re: [RFC v2 0/6] Track RCU dereferences in RCU read-side critical sections

2016-02-28 Thread Boqun Feng
On Fri, Feb 26, 2016 at 12:25:21PM +0100, Peter Zijlstra wrote: > On Fri, Feb 26, 2016 at 11:06:27AM +0800, Boqun Feng wrote: > > On Thu, Feb 25, 2016 at 07:37:24AM -0800, Paul E. McKenney wrote: > > > On Thu, Feb 25, 2016 at 03:32:43PM +0100, Peter Zijlstra wrote: > > >

Re: [RFC v2 0/6] Track RCU dereferences in RCU read-side critical sections

2016-02-25 Thread Boqun Feng
On Thu, Feb 25, 2016 at 07:37:24AM -0800, Paul E. McKenney wrote: > On Thu, Feb 25, 2016 at 03:32:43PM +0100, Peter Zijlstra wrote: > > On Tue, Feb 16, 2016 at 01:57:39PM +0800, Boqun Feng wrote: > > > As a characteristic of RCU, read-side critical sections have a very > >

Re: [PATCH v3 1/3] lib/percpu-list: Per-cpu list with associated per-cpu locks

2016-02-23 Thread Boqun Feng
Hi Waiman, On Tue, Feb 23, 2016 at 02:04:30PM -0500, Waiman Long wrote: > Linked list is used everywhere in the Linux kernel. However, if many > threads are trying to add or delete entries into the same linked list, > it can create a performance bottleneck. > > This patch introduces a new per-cpu

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

2016-02-23 Thread Boqun Feng
+ BUILD_BUG(); Maybe we can use BUILD_BUG_ON_MSG(1, "Unsupported size for xchg"), which could provide more information. With or without this verbosity: Acked-by: Boqun Feng Regards, Boqun > return x; > } > > @@ -124,7 +119,7 @@ __xchg_local(volatile void *ptr

[RFC v2 4/6] lockdep: LOCKED_ACCESS: Introduce locked_access_point()

2016-02-15 Thread Boqun Feng
LOCKED_ACCESS. Signed-off-by: Boqun Feng --- include/linux/lockdep.h | 29 kernel/locking/lockdep.c | 121 +++ 2 files changed, 150 insertions(+) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 2ffe6c3..cf7b6c8 100644

[RFC v2 5/6] lockdep: LOCKED_ACCESS: Add proc interface for locked access class

2016-02-15 Thread Boqun Feng
Provide the proc filesystem interface for LOCKED_ACCESS, for a locked access class whose name is , there will be a file at /proc/locked_access/ containing all the information the LOCKED_ACCESS has collected so far. Also add a macro to define a locked access class. Signed-off-by: Boqun Feng

[RFC v2 6/6] RCU: Track rcu_dereference() in RCU read-side critical section

2016-02-15 Thread Boqun Feng
option RCU_LOCKED_ACCESS. Also clean up the initialization code of lockdep_maps for different flavors of RCU a little bit. Signed-off-by: Boqun Feng --- include/linux/rcupdate.h | 12 include/linux/srcu.h | 2 +- kernel/locking/lockdep.c | 3 +++ kernel/rcu/update.c | 25

[RFC v2 0/6] Track RCU dereferences in RCU read-side critical sections

2016-02-15 Thread Boqun Feng
Hi all, This is the v2 for RCU_LOCKED_ACCESS. Link of v1: http://article.gmane.org/gmane.linux.kernel/2143674 Changes since v1: * Define newly introduced irq_context helpers as macros when lockdep doesn't trace irq_context, because these helpers will be quite simple then a

[RFC v2 3/6] lockdep: LOCKED_ACCESS: Maintain the keys of acqchains

2016-02-15 Thread Boqun Feng
Add held_lock::prev_acqchain_key and task_struct::curr_acqchain_key to maintain the keys of acqchains as the same as what lockdep does for keys of lock classes. Signed-off-by: Boqun Feng --- include/linux/lockdep.h | 3 +++ include/linux/sched.h| 3 +++ kernel/fork.c| 3

[RFC v2 1/6] lockdep: Add helper functions of irq_context

2016-02-15 Thread Boqun Feng
a lock is acquired, so it needs another way than getting the value from held_lock::irq_context Signed-off-by: Boqun Feng --- kernel/locking/lockdep.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c ind

[RFC v2 2/6] lockdep: LOCKED_ACCESS: Introduce locked access class and acqchain

2016-02-15 Thread Boqun Feng
ons. This patch defines the structures for those concepts, along with the manipulation operations. Besides, config option CONFIG_LOCKED_ACCESS is introduced in this patch, too. Signed-off-by: Boqun Feng --- include/linux/lockdep.h| 17 kernel/locking/lockdep.c

Re: [RFC 6/6] RCU: Track rcu_dereference() in RCU read-side critical section

2016-02-15 Thread Boqun Feng
On Mon, Feb 15, 2016 at 08:08:40PM -0800, Paul E. McKenney wrote: > On Tue, Feb 16, 2016 at 11:01:43AM +0800, Boqun Feng wrote: > > On Mon, Feb 15, 2016 at 05:05:53PM -0800, Paul E. McKenney wrote: > > > On Thu, Feb 04, 2016 at 12:45:12AM +0800, Boqun Feng wrote: > > > &

Re: [RFC 6/6] RCU: Track rcu_dereference() in RCU read-side critical section

2016-02-15 Thread Boqun Feng
On Mon, Feb 15, 2016 at 05:05:53PM -0800, Paul E. McKenney wrote: > On Thu, Feb 04, 2016 at 12:45:12AM +0800, Boqun Feng wrote: > > The variables protected by an RCU read-side critical section are > > sometimes hard to figure out, especially when the critical section is >

[RFC 0/6] Track RCU dereferences in RCU read-side critical sections

2016-02-03 Thread Boqun Feng
As a characteristic of RCU, read-side critical sections have a very loose connection with rcu_dereference()s, which is you can only be sure about an rcu_dereference() might be called in some read-side critical section, but if code gets complex, you may not be sure which read-side critical section e

[RFC 6/6] RCU: Track rcu_dereference() in RCU read-side critical section

2016-02-03 Thread Boqun Feng
option RCU_LOCKED_ACCESS. Also clean up the initialization code of lockdep_maps for different flavors of RCU a little bit. Signed-off-by: Boqun Feng --- include/linux/rcupdate.h | 8 include/linux/srcu.h | 8 +++- kernel/locking/lockdep.c | 3 +++ kernel/rcu/update.c

[RFC 3/6] lockdep: LOCKED_ACCESS: Maintain the keys of acqchains

2016-02-03 Thread Boqun Feng
Add held_lock::prev_acqchain_key and task_struct::curr_acqchain_key to maintain the keys of acqchains as the same as what lockdep does for keys of lock classes. Signed-off-by: Boqun Feng --- include/linux/lockdep.h | 3 +++ include/linux/sched.h| 3 +++ kernel/fork.c| 3

[RFC 1/6] lockdep: Add helper functions of irq_context

2016-02-03 Thread Boqun Feng
a lock is acquired, so it needs another way than getting the value from held_lock::irq_context Signed-off-by: Boqun Feng --- kernel/locking/lockdep.c | 23 +-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lock

[RFC 5/6] lockdep: LOCKED_ACCESS: Add proc interface for locked access class

2016-02-03 Thread Boqun Feng
Provide the proc filesystem interface for LOCKED_ACCESS, for a locked access class whose name is , there will be a file at /proc/locked_access/ containing all the information the LOCKED_ACCESS has collected so far. Also add a macro to define a locked access class. Signed-off-by: Boqun Feng

[RFC 2/6] lockdep: LOCKED_ACCESS: Introduce locked access class and acqchain

2016-02-03 Thread Boqun Feng
ons. This patch defines the structures for those concepts, along with the manipulation operations. Besides, config option CONFIG_LOCKED_ACCESS is introduced in this patch, too. Signed-off-by: Boqun Feng --- include/linux/lockdep.h| 17 kernel/locking/lockdep.c

[RFC 4/6] lockdep: LOCKED_ACCESS: Introduce locked_access_point()

2016-02-03 Thread Boqun Feng
LOCKED_ACCESS. Signed-off-by: Boqun Feng --- include/linux/lockdep.h | 29 kernel/locking/lockdep.c | 121 +++ 2 files changed, 150 insertions(+) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 2ffe6c3..cf7b6c8 100644

Re: [RFC][PATCH] mips: Fix arch_spin_unlock()

2016-02-02 Thread Boqun Feng
On Tue, Feb 02, 2016 at 12:20:25PM +, Will Deacon wrote: [...] > > > > > > > > Besides, Will, what's the reason of having a locally transitive chain > > > > termination? Because on some architectures RELEASE->DEPENDENCY pairs may > > > > not be locally transitive? > > > > > > Well, the follow

Re: [RFC][PATCH] mips: Fix arch_spin_unlock()

2016-02-02 Thread Boqun Feng
On Tue, Feb 02, 2016 at 11:45:59AM +, Will Deacon wrote: > On Tue, Feb 02, 2016 at 01:19:04PM +0800, Boqun Feng wrote: > > On Mon, Feb 01, 2016 at 07:54:58PM -0800, Paul E. McKenney wrote: > > > On Mon, Feb 01, 2016 at 01:56:22PM +, Will Deacon wrote: > > > >

Re: [RFC][PATCH] mips: Fix arch_spin_unlock()

2016-02-02 Thread Boqun Feng
Hello Linus, On Tue, Feb 02, 2016 at 12:19:04AM -0800, Linus Torvalds wrote: > On Tue, Feb 2, 2016 at 12:07 AM, Linus Torvalds > wrote: > > > > So we *absolutely* should say that *OF COURSE* these things work: > > > > - CPU A: > > > >.. initialize data structure -> smp_wmb() -> WRITE_ONCE(pt

Re: [RFC][PATCH] mips: Fix arch_spin_unlock()

2016-02-01 Thread Boqun Feng
Hi Paul, On Mon, Feb 01, 2016 at 07:54:58PM -0800, Paul E. McKenney wrote: > On Mon, Feb 01, 2016 at 01:56:22PM +, Will Deacon wrote: > > On Fri, Jan 29, 2016 at 02:22:53AM -0800, Paul E. McKenney wrote: > > > On Fri, Jan 29, 2016 at 09:59:59AM +, Will Deacon wrote: > > > > On Thu, Jan 28,

Re: [PATCH v3] barriers: introduce smp_mb__release_acquire and update documentation

2016-01-27 Thread Boqun Feng
ory barrier, implying global transitivity. This could give the readers an overview of the usage of this barrier. > Cc: Boqun Feng > Cc: Paul E. McKenney > Cc: Peter Zijlstra > Signed-off-by: Will Deacon > --- > > Based on Paul's patch to describe local vs global

Re: [RFC][PATCH] mips: Fix arch_spin_unlock()

2016-01-27 Thread Boqun Feng
Hi Maciej, On Wed, Jan 27, 2016 at 12:41:29PM +, Maciej W. Rozycki wrote: > On Wed, 27 Jan 2016, Will Deacon wrote: > > > > Overall I think it should be safe after all to use SYNC_RELEASE and > > > other > > > modern lightweight barriers uncondtionally under the assumption that > > > arch

Re: [v3,11/41] mips: reuse asm-generic/barrier.h

2016-01-26 Thread Boqun Feng
On Tue, Jan 26, 2016 at 03:29:21PM -0800, Paul E. McKenney wrote: > On Tue, Jan 26, 2016 at 02:33:40PM -0800, Linus Torvalds wrote: > > On Tue, Jan 26, 2016 at 2:15 PM, Linus Torvalds > > wrote: > > > > > > You might as well just write it as > > > > > > struct foo x = READ_ONCE(*ptr); > > >

Re: [v3,11/41] mips: reuse asm-generic/barrier.h

2016-01-26 Thread Boqun Feng
Hi Paul, On Mon, Jan 18, 2016 at 07:46:29AM -0800, Paul E. McKenney wrote: > On Mon, Jan 18, 2016 at 04:19:29PM +0800, Herbert Xu wrote: > > Paul E. McKenney wrote: > > > > > > You could use SYNC_ACQUIRE() to implement read_barrier_depends() and > > > smp_read_barrier_depends(), but SYNC_RMB prob

Re: [v3,11/41] mips: reuse asm-generic/barrier.h

2016-01-26 Thread Boqun Feng
Hi Will, On Tue, Jan 26, 2016 at 12:16:09PM +, Will Deacon wrote: > On Mon, Jan 25, 2016 at 10:03:22PM -0800, Paul E. McKenney wrote: > > On Mon, Jan 25, 2016 at 04:42:43PM +, Will Deacon wrote: > > > On Fri, Jan 15, 2016 at 01:58:53PM -0800, Paul E. McKenney wrote: > > > > PPC Overlapping

Re: [PATCH v2 15/32] powerpc: define __smp_xxx

2016-01-06 Thread Boqun Feng
elease(). > > > > > > But I think removing smp_lwsync() is a good idea and actually I think we > > can go further to remove __smp_lwsync() and let __smp_load_acquire and > > __smp_store_release call __lwsync() directly, but that is another thing. > > > > Anyway, I will

[PATCH RESEND v6 2/4] powerpc: atomic: Implement atomic{,64}_*_return_* variants

2016-01-05 Thread Boqun Feng
therwise. Implement atomic{,64}_{add,sub,inc,dec}_return_relaxed, and build other variants with these helpers. Signed-off-by: Boqun Feng --- arch/powerpc/include/asm/atomic.h | 147 ++ 1 file changed, 85 insertions(+), 62 deletions(-) diff --git a/arch/powerpc/incl

Re: [PATCH v6 2/4] powerpc: atomic: Implement atomic{,64}_*_return_* variants

2016-01-05 Thread Boqun Feng
Hi all, I will resend this one to avoid a potential conflict with: http://article.gmane.org/gmane.linux.kernel/2116880 by open coding smp_lwsync() with: __asm__ __volatile__(PPC_ACQUIRE_BARRIER "" : : : "memory"); Regards, Boqun signature.asc Description: PGP signature

Re: [PATCH v2 15/32] powerpc: define __smp_xxx

2016-01-05 Thread Boqun Feng
On Tue, Jan 05, 2016 at 06:16:48PM +0200, Michael S. Tsirkin wrote: [snip] > > > > Another thing is that smp_lwsync() may have a third user(other than > > > > smp_load_acquire() and smp_store_release()): > > > > > > > > http://article.gmane.org/gmane.linux.ports.ppc.embedded/89877 > > > > > > > >

Re: [PATCH v2 15/32] powerpc: define __smp_xxx

2016-01-05 Thread Boqun Feng
On Tue, Jan 05, 2016 at 10:51:17AM +0200, Michael S. Tsirkin wrote: > On Tue, Jan 05, 2016 at 09:36:55AM +0800, Boqun Feng wrote: > > Hi Michael, > > > > On Thu, Dec 31, 2015 at 09:07:42PM +0200, Michael S. Tsirkin wrote: > > > This defines __smp_xxx barrier

Re: [PATCH v2 15/32] powerpc: define __smp_xxx

2016-01-04 Thread Boqun Feng
Hi Michael, On Thu, Dec 31, 2015 at 09:07:42PM +0200, Michael S. Tsirkin wrote: > This defines __smp_xxx barriers for powerpc > for use by virtualization. > > smp_xxx barriers are removed as they are > defined correctly by asm-generic/barriers.h > > This reduces the amount of arch-specific boile

[RFC v2 3/3] irq: Privatize irq_common_data::state_use_accessors

2015-12-28 Thread Boqun Feng
irq_common_data::state_use_accessors is not designed for public use. Therefore make it private so that people who write code accessing it directly will get blamed by sparse. Also #undef the macro __irqd_to_state after used in header files, so that the macro can't be misused. Signed-off-by:

[RFC v2 1/3] sparse: Add __private to privatize members of structs

2015-12-28 Thread Boqun Feng
w_spinlock [usertype] *lock | kernel/rcu/tree.c:4453:25:got struct raw_spinlock [noderef] * Also, this patch improves compiler.h a little bit by adding comments for "#else" and "#endif". Signed-off-by: Boqun Feng --- include/linux/compiler.h | 12 scripts/chec

[RFC v2 2/3] RCU: Privatize rcu_node::lock

2015-12-28 Thread Boqun Feng
replaced with those wrappers. Signed-off-by: Boqun Feng --- kernel/rcu/tree.c| 103 --- kernel/rcu/tree.h| 42 ++- kernel/rcu/tree_plugin.h | 26 ++-- 3 files changed, 96 insertions(+), 75 deletions(-) diff --git a

[RFC v2 0/3] sparse: Introduce __private to privatize members of structs

2015-12-28 Thread Boqun Feng
Hi all, This is v2 of __private. Link for v1: http://marc.info/?l=linux-sparse&m=144988906932520&w=2 Change since v1: * #undef __irqd_to_state after used (Peter Zijlstra) This patchset introduces a __private modifier for sparse to detect misuses of private members of structs. This could

Re: [PATCH powerpc/next v6 0/4] atomics: powerpc: Implement relaxed/acquire/release variants

2015-12-27 Thread Boqun Feng
On Sun, Dec 27, 2015 at 06:53:39PM +1100, Michael Ellerman wrote: > On Wed, 2015-12-23 at 18:54 +0800, Boqun Feng wrote: > > On Wed, Dec 23, 2015 at 01:40:05PM +1100, Michael Ellerman wrote: > > > On Tue, 2015-12-15 at 22:24 +0800, Boqun Feng wrote: > > > > Hi all,

Re: [PATCH powerpc/next v6 0/4] atomics: powerpc: Implement relaxed/acquire/release variants

2015-12-23 Thread Boqun Feng
On Wed, Dec 23, 2015 at 01:40:05PM +1100, Michael Ellerman wrote: > On Tue, 2015-12-15 at 22:24 +0800, Boqun Feng wrote: > > > Hi all, > > > > This is v6 of the series. > > > > Link for v1: https://lkml.org/lkml/2015/8/27/798 > > Link for v2: https://l

<    3   4   5   6   7   8   9   10   >