Re: [PATCH] vfs: avoid recopying filename in getname_flags

2015-03-20 Thread Boqun Feng
Hi Al, Ping and sorry to bother you. Could you please have a look at my question? Thank you! Regards, Boqun Feng On Wed, Mar 18, 2015 at 01:27:24PM +0800, Boqun Feng wrote: On Fri, Mar 13, 2015 at 09:45:59AM -0400, Paul Moore wrote: On Monday, March 09, 2015 04:24:32 PM Boqun Feng wrote

Re: [PATCH] vfs: avoid recopying filename in getname_flags

2015-03-09 Thread Boqun Feng
Ping. Any opinion? Thanks, Boqun Feng On Wed, Feb 25, 2015 at 8:31 PM, Boqun Feng boqun.f...@gmail.com wrote: In the current implementation of getname_flags, filename in the user-space will be recopied if it takes more space that EMBEDDED_NAME_MAX, however, at this moment, EMBEDDED_NAME_MAX

[PATCH v2] vfs: avoid recopying file names in getname_flags

2015-03-25 Thread Boqun Feng
`, is not needed anymore. Signed-off-by: Boqun Feng boqun.f...@gmail.com --- v1 -- v2: Rebase the patch onto the for-next branch of Al's vfs repo. fs/namei.c | 45 - include/linux/fs.h | 1 - 2 files changed, 28 insertions(+), 18 deletions(-) diff

Re: [PATCH v2] vfs: avoid recopying file names in getname_flags

2015-03-29 Thread Boqun Feng
Hi Richard, On Sun, Mar 29, 2015 at 12:13:29PM +0200, Richard Weinberger wrote: On Wed, Mar 25, 2015 at 7:45 PM, Boqun Feng boqun.f...@gmail.com wrote: In the current implementation of getname_flags, a file name in the user-space will be recopied if it takes more space

Re: [PATCH v2] vfs: avoid recopying file names in getname_flags

2015-03-29 Thread Boqun Feng
On Sun, Mar 29, 2015 at 12:14:24PM +0200, Richard Weinberger wrote: On Sun, Mar 29, 2015 at 6:27 AM, Boqun Feng boqun.f...@gmail.com wrote: Ping. This patch has been tested by 0day test bot. I hope you did more than build test this patch... I did, I boot the new kernel and ran some

Re: [PATCH v2] vfs: avoid recopying file names in getname_flags

2015-03-28 Thread Boqun Feng
Ping. This patch has been tested by 0day test bot. Thanks, Boqun Feng On Thu, Mar 26, 2015 at 02:45:52AM +0800, Boqun Feng wrote: In the current implementation of getname_flags, a file name in the user-space will be recopied if it takes more space that EMBEDDED_NAME_MAX, however

[PATCH] vfs: avoid recopying filename in getname_flags

2015-02-25 Thread Boqun Feng
...@zeniv.linux.org.uk Cc: Paul Moore pmo...@redhat.com Signed-off-by: Boqun Feng boqun.f...@gmail.com --- fs/namei.c | 50 +++--- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index c83145a..3be372b 100644 --- a/fs/namei.c

Re: [PATCH] vfs: avoid recopying filename in getname_flags

2015-03-17 Thread Boqun Feng
On Fri, Mar 13, 2015 at 09:45:59AM -0400, Paul Moore wrote: On Monday, March 09, 2015 04:24:32 PM Boqun Feng wrote: Ping. Any opinion? You might want to look at some of the recent changes to Al's vfs.git#for-next branch; at the very least it looks like your patch should be rebased

Re: Is it OK to export symbols 'getname' and 'putname'?

2015-04-21 Thread Boqun Feng
Hi, On Mon, Apr 20, 2015 at 05:55:07PM +0200, Jan Kara wrote: On Fri 17-04-15 20:35:30, Boqun Feng wrote: Hi Al, I'm trying to clean that part of code you mentioned, and I found I have to export the symbols 'getname' and 'putname' as follow to replace that __getname() caller

[PATCH 2/2] staging: lustre: replace ll_{get,put}name() with {get,put}name()

2015-04-21 Thread Boqun Feng
...@zeniv.linux.org.uk Signed-off-by: Boqun Feng boqun.f...@gmail.com --- drivers/staging/lustre/lustre/llite/dir.c | 60 ++ .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/namei.c| 2 +- 3 files changed, 18

[PATCH 0/2] staging: lustre: Replace ll_getname with vfs' getname

2015-04-21 Thread Boqun Feng
tests are welcome. Thank you. ;-) Regards, Boqun Feng Boqun Feng (2): vfs: Export symbol 'getname' and 'putname' staging: lustre: replace ll_{get,put}name() with {get,put}name() drivers/staging/lustre/lustre/llite/dir.c | 60 ++ .../staging/lustre/lustre/llite

[PATCH 1/2] vfs: export symbol 'getname' and 'putname'

2015-04-21 Thread Boqun Feng
-off-by: Boqun Feng boqun.f...@gmail.com --- fs/namei.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/fs/namei.c b/fs/namei.c index c83145a..472911c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -199,11 +199,23 @@ error: return err; } +/** + * getname() - Get a file

Re: Is it OK to export symbols 'getname' and 'putname'?

2015-04-22 Thread Boqun Feng
and these idiotic ioctls were something we had to live with. But lustre is in staging code, and we shouldn't export symbols just for shitty staging code. Intead lustre should clean up their mess and get rid of these ioctls that do path name lookups. OK, good point. Thank you! Regards, Boqun Feng

Is it OK to export symbols 'getname' and 'putname'?

2015-04-17 Thread Boqun Feng
Hi Al, On Sun, Apr 12, 2015 at 02:13:18AM +0100, Al Viro wrote: BTW, looking at the __getname() callers... Lustre one sure as hell looks bogus: char *tmp = __getname(); if (!tmp) return ERR_PTR(-ENOMEM); len = strncpy_from_user(tmp, filename,

Re: [PATCH v2] vfs: avoid recopying file names in getname_flags

2015-04-13 Thread Boqun Feng
Hi Al, On Sun, Apr 12, 2015 at 12:56:55AM +0100, Al Viro wrote: On Tue, Apr 07, 2015 at 04:38:26PM +0800, Boqun Feng wrote: Ping again... What exactly does it buy us? You need a pathname just a bit under 4Kb, which, with all due respect, is an extremely rare case. Resulting code is more

Re: [PATCH v2] vfs: avoid recopying file names in getname_flags

2015-04-13 Thread Boqun Feng
filename, iname[1]), GFP_KERNEL); and we are done - result-iname+1 will be within the allocated object, no matter what. Thank you for your response. As long as the actual size of result is not a power of 2, the problem will not happen.(Maybe add a comment before struct filename) Regards, Boqun

Re: Is it OK to export symbols 'getname' and 'putname'?

2015-04-17 Thread Boqun Feng
On Fri, Apr 17, 2015 at 08:35:30PM +0800, Boqun Feng wrote: Hi Al, On Sun, Apr 12, 2015 at 02:13:18AM +0100, Al Viro wrote: BTW, looking at the __getname() callers... Lustre one sure as hell looks bogus: char *tmp = __getname(); if (!tmp) return

Re: [PATCH v2] vfs: avoid recopying file names in getname_flags

2015-04-07 Thread Boqun Feng
Ping again... Thanks, Boqun Feng On Sun, Mar 29, 2015 at 12:27:44PM +0800, Boqun Feng wrote: Ping. This patch has been tested by 0day test bot. Thanks, Boqun Feng On Thu, Mar 26, 2015 at 02:45:52AM +0800, Boqun Feng wrote: In the current implementation of getname_flags, a file

Re: [PATCH v8 2/4] sched: Rewrite runnable load and utilization average tracking

2015-06-19 Thread Boqun Feng
Hi Yuyang, On Tue, Jun 16, 2015 at 03:26:05AM +0800, Yuyang Du wrote: @@ -5977,36 +5786,6 @@ static void attach_tasks(struct lb_env *env) } #ifdef CONFIG_FAIR_GROUP_SCHED -/* - * update tg-load_weight by folding this cpu's load_avg - */ -static void

Re: [PATCH v8 2/4] sched: Rewrite runnable load and utilization average tracking

2015-06-19 Thread Boqun Feng
Hi Yuyang, On Fri, Jun 19, 2015 at 11:11:16AM +0800, Yuyang Du wrote: On Fri, Jun 19, 2015 at 03:57:24PM +0800, Boqun Feng wrote: This rewrite patch does not NEED to aggregate entity's load to cfs_rq, but rather directly update the cfs_rq's load (both runnable and blocked), so

Re: [PATCH v8 2/4] sched: Rewrite runnable load and utilization average tracking

2015-06-19 Thread Boqun Feng
Hi Yuyang, On Fri, Jun 19, 2015 at 07:05:54AM +0800, Yuyang Du wrote: On Fri, Jun 19, 2015 at 02:00:38PM +0800, Boqun Feng wrote: However, update_cfs_rq_load_avg() only updates cfs_rq-avg, the change won't be contributed or aggregated to cfs_rq's parent in the for_each_leaf_cfs_rq loop

Re: [PATCH v8 0/4] sched: Rewrite runnable load and utilization average tracking

2015-06-15 Thread Boqun Feng
Hi Yuyang, We have tested your V7 patchset as follow: On Intel(R) Xeon(R) CPU X5690 (12 cores), run 12 stress and 6 dbench. Results show that usages of some CPUs are less than 50% sometimes. We would like to test your V8 patchset, but I can neither find it in a lkml archive, nor in my lkml

Re: [Resend PATCH v8 0/4] sched: Rewrite runnable load and utilization average tracking

2015-06-16 Thread Boqun Feng
On Wed, Jun 17, 2015 at 11:06:50AM +0800, Boqun Feng wrote: Hi Yuyang, I've run the test as follow on tip/master without and with your patchset: On a 12-core system (Intel(R) Xeon(R) CPU X5690 @ 3.47GHz) run stress --cpu 12 run dbench 1 Sorry, I forget to say that `stress --cpu 12

Re: [Resend PATCH v8 0/4] sched: Rewrite runnable load and utilization average tracking

2015-06-17 Thread Boqun Feng
Hi Yuyang, On Wed, Jun 17, 2015 at 11:11:01AM +0800, Yuyang Du wrote: Hi, The sched_debug is informative, lets first give it some analysis. The workload is 12 CPU hogging tasks (always runnable) and 1 dbench task doing fs ops (70% runnable) running at the same time. Actually, these 13

[PATCH] sched/fair: code clean up for __sched_period()

2015-07-02 Thread Boqun Feng
-by: Boqun Feng boqun.f...@gmail.com --- kernel/sched/fair.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4b6e5f6..341a51f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -616,15 +616,10 @@ static inline u64

Re: [PATCH] sched/fair: code clean up for __sched_period()

2015-07-06 Thread Boqun Feng
Ping. Any idea on this one? On Thu, Jul 02, 2015 at 10:25:52PM +0800, Boqun Feng wrote: Since commit: 4bf0b77158 (sched: remove do_div() from __sched_slice()), the logic of __sched_period() can be implemented as a single if-else without any local variable, so this patch cleans it up

Re: [PATCH] sched/fair: code clean up for __sched_period()

2015-07-06 Thread Boqun Feng
Hi Peter, On Mon, Jul 06, 2015 at 02:49:59PM +0200, Peter Zijlstra wrote: On Mon, Jul 06, 2015 at 08:41:26PM +0800, Boqun Feng wrote: Ping. Any idea on this one? I think I queued this one. Sorry, I only had looked up in the tip tree.. just found it on your tree. Thank you! Regards, Boqun

Re: [PATCH] sched/fair: code clean up for __sched_period()

2015-07-06 Thread Boqun Feng
Hi Ingo, On Mon, Jul 06, 2015 at 02:53:50PM +0200, Ingo Molnar wrote: * Peter Zijlstra pet...@infradead.org wrote: On Mon, Jul 06, 2015 at 08:41:26PM +0800, Boqun Feng wrote: Ping. Any idea on this one? I think I queued this one. Yeah, and I applied it from you earlier today

[PATCH 2/2] rcu: Use call_rcu_func_to to replace explicit type equivalents

2015-07-28 Thread Boqun Feng
We have call_rcu_func_t for a quite while, but we still use explicit function pointer type equivalents in some places, this patch replace these equivalent types with call_rcu_func_t to gain better readability. Signed-off-by: Boqun Feng boqun.f...@gmail.com --- kernel/rcu/rcutorture.c | 2

[PATCH 1/2] rcu: Use rcu_callback_t in call_rcu*() and friends

2015-07-28 Thread Boqun Feng
, this can also help cscope to generate a better database for code reading. Signed-off-by: Boqun Feng boqun.f...@gmail.com --- include/linux/rcupdate.h | 10 +- include/linux/rcutiny.h | 2 +- include/linux/rcutree.h | 2 +- kernel/rcu/rcutorture.c | 4 ++-- kernel/rcu/srcu.c| 2

[PATCH 0/2] Replace explicit function pointer types with rcu_callback_t and call_rcu_func_t

2015-07-28 Thread Boqun Feng
Commit (rcu: Create a synchronize_rcu_mult()) in linux-rcu.git#rcu/next branch has introduced rcu_callback_t as the type for rcu callback functions and call_rcu_func_t has been introduced for a while. This patch series uses the rcu_callback_t and call_rcu_func_t to save a few lines of code. This

Re: [Question] lockdep: Is nested lock handled correctly?

2015-08-10 Thread Boqun Feng
Hi Peter, On Mon, Aug 10, 2015 at 04:24:17PM +0200, Peter Zijlstra wrote: On Mon, Aug 10, 2015 at 09:49:24PM +0800, Boqun Feng wrote: snip Though I don't want to have a locking order like that either, we can't stop others from using that order(maybe a good design review will) and lockdep

[Question] lockdep: Is nested lock handled correctly?

2015-08-10 Thread Boqun Feng
Hi Peter and Ingo, I'm now learning the code of lockdep and find that nested lock may not be handled correctly because we fail to take held_lock merging into consideration. I come up with an example and hope that could explain my concern. Please consider this lock/unlock sequence, I also put a

Re: [Question] lockdep: Is nested lock handled correctly?

2015-08-10 Thread Boqun Feng
Hi Peter, On Mon, Aug 10, 2015 at 01:42:28PM +0200, Peter Zijlstra wrote: On Mon, Aug 10, 2015 at 05:52:47PM +0800, Boqun Feng wrote: Hi Peter and Ingo, I'm now learning the code of lockdep and find that nested lock may not be handled correctly because we fail to take held_lock merging

Re: [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq

2015-07-26 Thread Boqun Feng
Hi Yuyang, On Mon, Jul 27, 2015 at 03:56:34AM +0800, Yuyang Du wrote: On Mon, Jul 27, 2015 at 11:21:15AM +0800, Boqun Feng wrote: Hi Yuyang, On Mon, Jul 27, 2015 at 02:43:25AM +0800, Yuyang Du wrote: Hi Boqun, On Tue, Jul 21, 2015 at 06:29:56PM +0800, Boqun Feng wrote

Re: [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq

2015-07-26 Thread Boqun Feng
Hi Yuyang, On Mon, Jul 27, 2015 at 02:43:25AM +0800, Yuyang Du wrote: Hi Boqun, On Tue, Jul 21, 2015 at 06:29:56PM +0800, Boqun Feng wrote: The point is that you have already tracked the sum of runnable_load_avg and blocked_load_avg in cfs_rq-avg.load_avg. If you're going to track part

Re: [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq

2015-07-26 Thread Boqun Feng
On Mon, Jul 27, 2015 at 11:21:15AM +0800, Boqun Feng wrote: Hi Yuyang, On Mon, Jul 27, 2015 at 02:43:25AM +0800, Yuyang Du wrote: Hi Boqun, On Tue, Jul 21, 2015 at 06:29:56PM +0800, Boqun Feng wrote: The point is that you have already tracked the sum of runnable_load_avg

Re: [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq

2015-07-26 Thread Boqun Feng
Hi Yuyang, On Mon, Jul 27, 2015 at 04:34:09AM +0800, Yuyang Du wrote: On Mon, Jul 27, 2015 at 12:04:20PM +0800, Boqun Feng wrote: ~~~ 1) blocked load is more difficult to track, hint, migrate

Re: [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq

2015-07-21 Thread Boqun Feng
On Wed, Jul 15, 2015 at 08:04:41AM +0800, Yuyang Du wrote: The cfs_rq's load_avg is composed of runnable_load_avg and blocked_load_avg. Before this series, sometimes the runnable_load_avg is used, and sometimes the load_avg is used. Completely replacing all uses of runnable_load_avg with

Re: [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq

2015-07-20 Thread Boqun Feng
Hi Yuyang, On Wed, Jul 15, 2015 at 08:04:41AM +0800, Yuyang Du wrote: The cfs_rq's load_avg is composed of runnable_load_avg and blocked_load_avg. Before this series, sometimes the runnable_load_avg is used, and sometimes the load_avg is used. Completely replacing all uses of runnable_load_avg

Re: [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq

2015-07-21 Thread Boqun Feng
On Tue, Jul 21, 2015 at 08:44:01AM +0800, Yuyang Du wrote: On Tue, Jul 21, 2015 at 09:08:07AM +0800, Boqun Feng wrote: Hi Yuyang, On Wed, Jul 15, 2015 at 08:04:41AM +0800, Yuyang Du wrote: The cfs_rq's load_avg is composed of runnable_load_avg and blocked_load_avg. Before

Re: [PATCH v10 6/7] sched: Provide runnable_load_avg back to cfs_rq

2015-07-21 Thread Boqun Feng
On Tue, Jul 21, 2015 at 06:18:46PM +0800, Boqun Feng wrote: On Tue, Jul 21, 2015 at 08:44:01AM +0800, Yuyang Du wrote: On Tue, Jul 21, 2015 at 09:08:07AM +0800, Boqun Feng wrote: Hi Yuyang, On Wed, Jul 15, 2015 at 08:04:41AM +0800, Yuyang Du wrote: The cfs_rq's load_avg

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-25 Thread Boqun Feng
On Sat, Oct 24, 2015 at 07:53:56PM +0800, Boqun Feng wrote: > On Sat, Oct 24, 2015 at 12:26:27PM +0200, Peter Zijlstra wrote: > > > > Right, futexes are a pain; and I think we all agreed we didn't want to > > go rely on implementation details unless we absolutely _have_

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-22 Thread Boqun Feng
On Wed, Oct 21, 2015 at 09:48:25PM +0200, Peter Zijlstra wrote: > On Wed, Oct 21, 2015 at 12:35:23PM -0700, Paul E. McKenney wrote: > > > > > > I ask this because I recall Peter once bought up a discussion: > > > > > > > > > > > > https://lkml.org/lkml/2015/8/26/596 > > > > So a full barrier on

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-25 Thread Boqun Feng
On Wed, Oct 21, 2015 at 12:36:38PM -0700, Paul E. McKenney wrote: > On Wed, Oct 21, 2015 at 10:18:33AM +0200, Peter Zijlstra wrote: > > On Tue, Oct 20, 2015 at 02:28:35PM -0700, Paul E. McKenney wrote: > > > I am not seeing a sync there, but I really have to defer to the > > > maintainers on this

[PATCH tip/locking/core v5 5/6] powerpc: atomic: Implement xchg_* and atomic{,64}_xchg_* variants

2015-10-26 Thread Boqun Feng
Implement xchg_relaxed and atomic{,64}_xchg_relaxed, based on these _relaxed variants, release/acquire variants and fully ordered versions can be built. Note that xchg_relaxed and atomic_{,64}_xchg_relaxed are not compiler barriers. Signed-off-by: Boqun Feng <boqun.f...@gmail.com> ---

[PATCH tip/locking/core v5 3/6] atomics: Allow architectures to define their own __atomic_op_* helpers

2015-10-26 Thread Boqun Feng
-by: Boqun Feng <boqun.f...@gmail.com> --- include/linux/atomic.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 27e580d..947c1dc 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h @@ -43,20 +43,29 @@ static

[PATCH tip/locking/core v5 1/6] powerpc: atomic: Make _return atomics and *{cmp}xchg fully ordered

2015-10-26 Thread Boqun Feng
RIER and PPC_ATOMIC_EXIT_BARRIER in __{cmp,}xchg_{u32,u64} respectively to guarantee fully ordered semantics of atomic{,64}_{cmp,}xchg() and {cmp,}xchg(), as a complement of commit b97021f85517 ("powerpc: Fix atomic_xxx_return barrier semantics"). Cc: <sta...@vger.kernel.org> # 3.4+ Sig

[PATCH RESEND tip/locking/core v5 1/6] powerpc: atomic: Make _return atomics and *{cmp}xchg fully ordered

2015-10-26 Thread Boqun Feng
RIER and PPC_ATOMIC_EXIT_BARRIER in __{cmp,}xchg_{u32,u64} respectively to guarantee fully ordered semantics of atomic{,64}_{cmp,}xchg() and {cmp,}xchg(), as a complement of commit b97021f85517 ("powerpc: Fix atomic_xxx_return barrier semantics"). Cc: <sta...@vger.kernel.org> # 3.4+ Sig

[PATCH tip/locking/core v5 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and atomic{,64}_cmpxchg_* variants

2015-10-26 Thread Boqun Feng
barriers. Signed-off-by: Boqun Feng <boqun.f...@gmail.com> --- arch/powerpc/include/asm/atomic.h | 10 +++ arch/powerpc/include/asm/cmpxchg.h | 149 - 2 files changed, 158 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/atomic.h

[PATCH tip/locking/core v5 2/6] atomics: Add test for atomic operations with _relaxed variants

2015-10-26 Thread Boqun Feng
that we can examine their assembly code. Signed-off-by: Boqun Feng <boqun.f...@gmail.com> --- lib/atomic64_test.c | 120 ++-- 1 file changed, 79 insertions(+), 41 deletions(-) diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c index 83

[PATCH tip/locking/core v5 0/6] atomics: powerpc: Implement relaxed/acquire/release variants of some atomics

2015-10-26 Thread Boqun Feng
Hi all, This is v5 of the series. Link for v1: https://lkml.org/lkml/2015/8/27/798 Link for v2: https://lkml.org/lkml/2015/9/16/527 Link for v3: https://lkml.org/lkml/2015/10/12/368 Link for v4: https://lkml.org/lkml/2015/10/14/670 Changes since v4: * define PPC_ATOMIC_ENTRY_BARRIER as

[PATCH tip/locking/core v5 4/6] powerpc: atomic: Implement atomic{,64}_*_return_* variants

2015-10-26 Thread Boqun Feng
on the platform without "lwsync", we can use "isync" rather than "sync" as an acquire barrier. Therefore in __atomic_op_acquire() we use PPC_ACQUIRE_BARRIER, which is barrier() on UP, "lwsync" if available and "isync" otherwise. Implement atomic{

Re: [PATCH tip/locking/core v5 1/6] powerpc: atomic: Make _return atomics and *{cmp}xchg fully ordered

2015-10-26 Thread Boqun Feng
On Mon, Oct 26, 2015 at 05:50:52PM +0800, Boqun Feng wrote: > This patch fixes two problems to make value-returning atomics and > {cmp}xchg fully ordered on PPC. > > According to memory-barriers.txt: > > > Any atomic operation that modifies some state in memory and returns

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-26 Thread Boqun Feng
On Mon, Oct 26, 2015 at 11:20:01AM +0900, Michael Ellerman wrote: > > Sorry guys, these threads are so long I tend not to read them very actively :} > > Looking at the system call path, the straight line path does not include any > barriers. I can't see any hidden in macros either. > > We also

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-26 Thread Boqun Feng
On Mon, Oct 26, 2015 at 02:20:21PM +1100, Paul Mackerras wrote: > On Wed, Oct 21, 2015 at 10:18:33AM +0200, Peter Zijlstra wrote: > > On Tue, Oct 20, 2015 at 02:28:35PM -0700, Paul E. McKenney wrote: > > > I am not seeing a sync there, but I really have to defer to the > > > maintainers on this

Re: [RESEND, tip/locking/core, v5, 1/6] powerpc: atomic: Make _return atomics and *{cmp}xchg fully ordered

2015-10-26 Thread Boqun Feng
On Tue, Oct 27, 2015 at 01:33:47PM +1100, Michael Ellerman wrote: > On Mon, 2015-26-10 at 10:15:36 UTC, Boqun Feng wrote: > > This patch fixes two problems to make value-returning atomics and > > {cmp}xchg fully ordered on PPC. > > Hi Boqun, > > Can you please split

Re: [RESEND, tip/locking/core, v5, 1/6] powerpc: atomic: Make _return atomics and *{cmp}xchg fully ordered

2015-10-29 Thread Boqun Feng
On Tue, Oct 27, 2015 at 11:06:52AM +0800, Boqun Feng wrote: > On Tue, Oct 27, 2015 at 01:33:47PM +1100, Michael Ellerman wrote: > > On Mon, 2015-26-10 at 10:15:36 UTC, Boqun Feng wrote: > > > This patch fixes two problems to make value-returning atomics and > > > {cm

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-24 Thread Boqun Feng
On Sat, Oct 24, 2015 at 12:26:27PM +0200, Peter Zijlstra wrote: > On Thu, Oct 22, 2015 at 08:07:16PM +0800, Boqun Feng wrote: > > On Wed, Oct 21, 2015 at 09:48:25PM +0200, Peter Zijlstra wrote: > > > On Wed, Oct 21, 2015 at 12:35:23PM -0700, Paul E. McKenney wrote: >

Re: [PATCH v3 1/4] wait.[ch]: Introduce the simple waitqueue (swait) implementation

2015-10-26 Thread Boqun Feng
On Mon, Oct 26, 2015 at 02:26:01PM +0100, Peter Zijlstra wrote: > On Mon, Oct 26, 2015 at 01:59:44PM +0100, Daniel Wagner wrote: > > Hi Boqun, > > > > On 10/26/2015 01:04 PM, Boqun Feng wrote: > > > On Tue, Oct 20, 2015 at 09:28:0

Re: [PATCH v3 1/4] wait.[ch]: Introduce the simple waitqueue (swait) implementation

2015-10-26 Thread Boqun Feng
Hi Daniel, On Tue, Oct 20, 2015 at 09:28:07AM +0200, Daniel Wagner wrote: > + > +/* > + * The thing about the wake_up_state() return value; I think we can ignore > it. > + * > + * If for some reason it would return 0, that means the previously waiting > + * task is already running, so it will

Re: [PATCH 4/4] locking: Introduce smp_cond_acquire()

2015-11-11 Thread Boqun Feng
Hi Oleg, On Tue, Nov 03, 2015 at 06:59:58PM +0100, Oleg Nesterov wrote: [snip] > > Unfortunately this doesn't look exactly right... > > spin_unlock_wait() is not equal to "while (locked) relax", the latter > is live-lockable or at least sub-optimal: we do not really need to spin Just be

Re: [PATCH 4/4] locking: Introduce smp_cond_acquire()

2015-11-11 Thread Boqun Feng
On Wed, Nov 11, 2015 at 05:39:40PM +0800, Boqun Feng wrote: > Hi Oleg, > > On Tue, Nov 03, 2015 at 06:59:58PM +0100, Oleg Nesterov wrote: > [snip] > > > > Unfortunately this doesn't look exactly right... > > > > spin_unlock_wait() is not equal to "whil

Re: [PATCH 4/4] locking: Introduce smp_cond_acquire()

2015-11-11 Thread Boqun Feng
On Wed, Nov 11, 2015 at 08:39:53PM +0100, Oleg Nesterov wrote: > On 11/11, Peter Zijlstra wrote: > > > > On Wed, Nov 11, 2015 at 05:39:40PM +0800, Boqun Feng wrote: > > > > > Just be curious, should spin_unlock_wait() semantically be an ACQUIRE? > > >

Re: [PATCH 4/4] locking: Introduce smp_cond_acquire()

2015-11-12 Thread Boqun Feng
On Thu, Nov 12, 2015 at 06:40:04AM -0800, Paul E. McKenney wrote: [snip] > > I cannot resist suggesting that any lock that interacts with > spin_unlock_wait() must have all relevant acquisitions followed by > smp_mb__after_unlock_lock(). > But 1. This would expand the purpose of

Re: [PATCH 4/4] locking: Introduce smp_cond_acquire()

2015-11-12 Thread Boqun Feng
On Thu, Nov 12, 2015 at 04:00:58PM +0100, Oleg Nesterov wrote: > On 11/12, Boqun Feng wrote: [snip] > > > > Hmm.. probably incorrect.. because the ACQUIRE semantics of spin_lock() > > only guarantees that the memory operations following spin_lock() can't > > be reo

Re: [RESEND, tip/locking/core, v5, 1/6] powerpc: atomic: Make _return atomics and *{cmp}xchg fully ordered

2015-11-01 Thread Boqun Feng
On Fri, Oct 30, 2015 at 08:56:33AM +0800, Boqun Feng wrote: > On Tue, Oct 27, 2015 at 11:06:52AM +0800, Boqun Feng wrote: > > On Tue, Oct 27, 2015 at 01:33:47PM +1100, Michael Ellerman wrote: > > > On Mon, 2015-26-10 at 10:15:36 UTC, Boqun Feng wrote: > > > > This pa

[PATCH powerpc/next 2/2] powerpc: Make {cmp}xchg* and their atomic_ versions fully ordered

2015-11-01 Thread Boqun Feng
s fully ordered" for PPC_ATOMIC_ENTRY_BARRIER definition. Cc: <sta...@vger.kernel.org> # 3.4+ Signed-off-by: Boqun Feng <boqun.f...@gmail.com> --- arch/powerpc/include/asm/cmpxchg.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/inclu

[PATCH powerpc/next 1/2] powerpc: Make value-returning atomics fully ordered

2015-11-01 Thread Boqun Feng
0/14/970 To fix this, we define PPC_ATOMIC_ENTRY_BARRIER as "sync" to guarantee the fully-ordered semantics. This also makes futex atomics fully ordered, which can avoid possible memory ordering problems if userspace code relies on futex system call for fully ordered semantics. Cc: <sta...@vger

Re: [RESEND, tip/locking/core, v5, 1/6] powerpc: atomic: Make _return atomics and *{cmp}xchg fully ordered

2015-11-03 Thread Boqun Feng
On Mon, Nov 02, 2015 at 09:22:40AM +0800, Boqun Feng wrote: > > On Tue, Oct 27, 2015 at 11:06:52AM +0800, Boqun Feng wrote: > > > To summerize: > > > > > > patch 1(split to two), 3, 4(remove inc/dec implementation), 5, 6 sent as > > > powerpc patches

[PATCH tip/locking/core] atomics: Add test for atomic operations with _relaxed variants

2015-11-04 Thread Boqun Feng
that we can examine their assembly code. Signed-off-by: Boqun Feng <boqun.f...@gmail.com> --- This is separated from the patchset of powerpc atomic variants implementation, whose link is: https://lkml.org/lkml/2015/10/26/141 Based on locking/core branch of the tip tree, tested by 0day.

[PATCH tip/locking/core v4 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and atomic{,64}_cmpxchg_* variants

2015-10-14 Thread Boqun Feng
barriers. Signed-off-by: Boqun Feng <boqun.f...@gmail.com> --- arch/powerpc/include/asm/atomic.h | 10 +++ arch/powerpc/include/asm/cmpxchg.h | 149 - 2 files changed, 158 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/atomic.h

[PATCH tip/locking/core v4 5/6] powerpc: atomic: Implement xchg_* and atomic{,64}_xchg_* variants

2015-10-14 Thread Boqun Feng
Implement xchg_relaxed and atomic{,64}_xchg_relaxed, based on these _relaxed variants, release/acquire variants and fully ordered versions can be built. Note that xchg_relaxed and atomic_{,64}_xchg_relaxed are not compiler barriers. Signed-off-by: Boqun Feng <boqun.f...@gmail.com> ---

[PATCH tip/locking/core v4 4/6] powerpc: atomic: Implement atomic{,64}_*_return_* variants

2015-10-14 Thread Boqun Feng
defined as smp_lwsync() + _relaxed + smp_mb__after_atomic() to guarantee a full barrier. Implement atomic{,64}_{add,sub,inc,dec}_return_relaxed, and build other variants with these helpers. Signed-off-by: Boqun Feng <boqun.f...@gmail.com> --- arch/powerpc/include/asm/atomic.h | 116

[PATCH tip/locking/core v4 0/6] atomics: powerpc: Implement relaxed/acquire/release variants of some atomics

2015-10-14 Thread Boqun Feng
Hi all, This is v4 of the series. Link for v1: https://lkml.org/lkml/2015/8/27/798 Link for v2: https://lkml.org/lkml/2015/9/16/527 Link for v3: https://lkml.org/lkml/2015/10/12/368 Changes since v3: * avoid to introduce smp_acquire_barrier__after_atomic() (Will Deacon) *

[PATCH tip/locking/core v4 2/6] atomics: Add test for atomic operations with _relaxed variants

2015-10-14 Thread Boqun Feng
that we can examine their assembly code. Signed-off-by: Boqun Feng <boqun.f...@gmail.com> --- lib/atomic64_test.c | 120 ++-- 1 file changed, 79 insertions(+), 41 deletions(-) diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c index 83

[PATCH tip/locking/core v4 3/6] atomics: Allow architectures to define their own __atomic_op_* helpers

2015-10-14 Thread Boqun Feng
-by: Boqun Feng <boqun.f...@gmail.com> --- include/linux/atomic.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 27e580d..947c1dc 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h @@ -43,20 +43,29 @@ static

[PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-14 Thread Boqun Feng
.au> Cc: <sta...@vger.kernel.org> # 3.4+ Signed-off-by: Boqun Feng <boqun.f...@gmail.com> --- arch/powerpc/include/asm/cmpxchg.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/include/asm/cmpxchg.h b/arch/powerpc/include/asm/cmpxchg.h i

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

2015-10-18 Thread Boqun Feng
On Fri, Oct 09, 2015 at 10:40:39AM +0100, Will Deacon wrote: > On Fri, Oct 09, 2015 at 10:31:38AM +0200, Peter Zijlstra wrote: [snip] > > > > So lots of little confusions added up to complete fail :-{ > > > > Mostly I think it was the UNLOCK x + LOCK x are fully ordered (where I > > forgot: but

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-18 Thread Boqun Feng
On Thu, Oct 15, 2015 at 09:30:40AM -0700, Paul E. McKenney wrote: > On Thu, Oct 15, 2015 at 12:48:03PM +0800, Boqun Feng wrote: > > On Wed, Oct 14, 2015 at 08:07:05PM -0700, Paul E. McKenney wrote: [snip] > > > > > Why not try creating a longer litmus test

Re: [PATCH RESEND v3 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-14 Thread Boqun Feng
On Wed, Oct 14, 2015 at 10:06:13AM +0200, Peter Zijlstra wrote: > On Wed, Oct 14, 2015 at 08:51:34AM +0800, Boqun Feng wrote: > > On Wed, Oct 14, 2015 at 11:10:00AM +1100, Michael Ellerman wrote: > > > > Thanks for fixing this. In future you should send a patch like this as a

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-15 Thread Boqun Feng
On Wed, Oct 14, 2015 at 01:19:17PM -0700, Paul E. McKenney wrote: > On Wed, Oct 14, 2015 at 11:55:56PM +0800, Boqun Feng wrote: > > According to memory-barriers.txt, xchg, cmpxchg and their atomic{,64}_ > > versions all need to imply a full barrier, however they are now just >

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-15 Thread Boqun Feng
On Thu, Oct 15, 2015 at 11:35:44AM +0100, Will Deacon wrote: > > So arm64 is ok. Doesn't lwsync order store->store observability for PPC? > I did some litmus and put the result here. My understanding might be wrong, and I think Paul can explain the lwsync and store->store order better ;-)

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-20 Thread Boqun Feng
On Wed, Oct 14, 2015 at 01:19:17PM -0700, Paul E. McKenney wrote: > > Am I missing something here? If not, it seems to me that you need > the leading lwsync to instead be a sync. > > Of course, if I am not missing something, then this applies also to the > value-returning RMW atomic operations

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

2015-10-20 Thread Boqun Feng
On Mon, Oct 19, 2015 at 12:23:24PM +0200, Peter Zijlstra wrote: > On Mon, Oct 19, 2015 at 09:17:18AM +0800, Boqun Feng wrote: > > This is confusing me right now. ;-) > > > > Let's use a simple example for only one primitive, as I understand it, > > if we say a primiti

Re: [PATCH tip/locking/core v8 1/5] locking/qspinlock: Use _acquire/_release versions of cmpxchg & xchg

2015-10-19 Thread Boqun Feng
On Mon, Oct 19, 2015 at 08:46:02PM -0700, Davidlohr Bueso wrote: > On Tue, 20 Oct 2015, Boqun Feng wrote: > > >>@@ -93,7 +94,7 @@ static __always_inline void queued_spin_unlock(struct > >>qspinlock *lock) > >>/* > >> * smp_mb__before_atomic

Re: [PATCH tip/locking/core v8 1/5] locking/qspinlock: Use _acquire/_release versions of cmpxchg & xchg

2015-10-19 Thread Boqun Feng
Hi Waiman, On Thu, Oct 15, 2015 at 06:51:03PM -0400, Waiman Long wrote: > This patch replaces the cmpxchg() and xchg() calls in the native > qspinlock code with the more relaxed _acquire or _release versions of > those calls to enable other architectures to adopt queued spinlocks > with less

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

2015-10-20 Thread Boqun Feng
On Mon, Oct 12, 2015 at 04:30:48PM -0700, Paul E. McKenney wrote: > On Fri, Oct 09, 2015 at 07:33:28PM +0100, Will Deacon wrote: > > On Fri, Oct 09, 2015 at 10:43:27AM -0700, Paul E. McKenney wrote: > > > On Fri, Oct 09, 2015 at 10:51:29AM +0100, Will Deacon wrote: [snip] > > > > > We could also

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-14 Thread Boqun Feng
On Thu, Oct 15, 2015 at 08:53:21AM +0800, Boqun Feng wrote: > On Wed, Oct 14, 2015 at 02:44:53PM -0700, Paul E. McKenney wrote: > > On Wed, Oct 14, 2015 at 11:04:19PM +0200, Peter Zijlstra wrote: > > > On Wed, Oct 14, 2015 at 01:19:17PM -0700, Paul E. McKenney wrote: >

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-14 Thread Boqun Feng
On Wed, Oct 14, 2015 at 02:44:53PM -0700, Paul E. McKenney wrote: > On Wed, Oct 14, 2015 at 11:04:19PM +0200, Peter Zijlstra wrote: > > On Wed, Oct 14, 2015 at 01:19:17PM -0700, Paul E. McKenney wrote: > > > Suppose we have something like the following, where "a" and "x" are both > > > initially

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-14 Thread Boqun Feng
Hi Paul, On Thu, Oct 15, 2015 at 08:53:21AM +0800, Boqun Feng wrote: > On Wed, Oct 14, 2015 at 02:44:53PM -0700, Paul E. McKenney wrote: [snip] > > To that end, the herd tool can make a diagram of what it thought > > happened, and I have attached it. I used this diagram t

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-14 Thread Boqun Feng
On Wed, Oct 14, 2015 at 08:07:05PM -0700, Paul E. McKenney wrote: > On Thu, Oct 15, 2015 at 08:53:21AM +0800, Boqun Feng wrote: [snip] > > > > I'm afraid more than that, the above litmus also shows that > > > > CPU 0

Re: [PATCH tip/locking/core v4 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier

2015-10-21 Thread Boqun Feng
On Tue, Oct 20, 2015 at 02:28:35PM -0700, Paul E. McKenney wrote: > On Tue, Oct 20, 2015 at 11:21:47AM +0200, Peter Zijlstra wrote: > > On Tue, Oct 20, 2015 at 03:15:32PM +0800, Boqun Feng wrote: > > > On Wed, Oct 14, 2015 at 01:19:17PM -0700, Paul E. McKenney wrote: > > &

Re: [RFC v2 5/7] powerpc: atomic: Implement cmpxchg{,64}_* and atomic{,64}_cmpxchg_* variants

2015-10-11 Thread Boqun Feng
On Sat, Oct 10, 2015 at 09:58:05AM +0800, Boqun Feng wrote: > Hi Peter, > > Sorry for replying late. > > On Thu, Oct 01, 2015 at 02:27:16PM +0200, Peter Zijlstra wrote: > > On Wed, Sep 16, 2015 at 11:49:33PM +0800, Boqun Feng wrote: > > > Unlike other atomic o

Re: [PATCH] Documentation: Remove misleading examples of the barriers in wake_*()

2015-10-11 Thread Boqun Feng
On Tue, Oct 06, 2015 at 06:06:50PM +0200, Peter Zijlstra wrote: > On Thu, Sep 24, 2015 at 09:21:22PM +0800, Boqun Feng wrote: > > > Included in it are some of the details on this subject, because a wakeup > > > has two prior states that are of importance, the

Re: [RFC v2 4/7] powerpc: atomic: Implement xchg_* and atomic{,64}_xchg_* variants

2015-10-11 Thread Boqun Feng
Hi Paul, On Thu, Oct 01, 2015 at 11:03:01AM -0700, Paul E. McKenney wrote: > On Thu, Oct 01, 2015 at 07:13:04PM +0200, Peter Zijlstra wrote: > > On Thu, Oct 01, 2015 at 08:09:09AM -0700, Paul E. McKenney wrote: > > > On Thu, Oct 01, 2015 at 02:24:40PM +0200, Peter Zijlstra wrote: > > > > > > I

Re: [RFC v2 5/7] powerpc: atomic: Implement cmpxchg{,64}_* and atomic{,64}_cmpxchg_* variants

2015-10-12 Thread Boqun Feng
On Mon, Oct 12, 2015 at 08:46:21AM +0200, Peter Zijlstra wrote: > On Sun, Oct 11, 2015 at 06:25:20PM +0800, Boqun Feng wrote: > > On Sat, Oct 10, 2015 at 09:58:05AM +0800, Boqun Feng wrote: > > > Hi Peter, > > > > > > Sorry for replying late. > > > &

Re: [RFC v2 1/7] atomics: Add test for atomic operations with _relaxed variants

2015-10-12 Thread Boqun Feng
On Mon, Oct 12, 2015 at 10:30:34AM +0100, Will Deacon wrote: > On Wed, Sep 16, 2015 at 04:49:29PM +0100, Boqun Feng wrote: > > Some atomic operations now have _{relaxed, acquire, release} variants, > > this patch then adds some trivial tests for two purpose: > > >

Re: [PATCH] Documentation: Remove misleading examples of the barriers in wake_*()

2015-10-12 Thread Boqun Feng
On Sun, Oct 11, 2015 at 05:40:44PM -0700, Paul E. McKenney wrote: > On Sun, Oct 11, 2015 at 11:26:40PM +0800, Boqun Feng wrote: > > On Tue, Oct 06, 2015 at 06:06:50PM +0200, Peter Zijlstra wrote: > > > On Thu, Sep 24, 2015 at 09:21:22PM +0800, Boqun Feng wrote: > > >

Re: [lkp] [PATCH v3 2/6] atomics: Add test for atomic operations with _relaxed variants

2015-10-12 Thread Boqun Feng
ellerman.id.au>", "Thomas > Gleixner <tglx@linutronix.d > e>", "Will Deacon <will.dea...@arm.com>", "\"Paul E. McKenney\" > <paul...@linux.vnet.ibm.com>", "Waiman Long <waiman.l...@hp.com>", "Davidlohr

  1   2   3   4   5   6   7   8   9   10   >