[Devel] Re: [PATCH 4/5] freezer cgroup: Fix an RCU warning in cgroup_freezing_or_frozen()

2010-04-22 Thread Peter Zijlstra
On Fri, 2010-04-23 at 09:05 +0800, Li Zefan wrote: > > > You are right in that taking task_lock() is sufficient (I forgot > this lock rule), but it's not true that whatever locks are held > in the ->attach method can pin a task's cgroup. Ah, can you be more specific about the ->attach() case?

[Devel] Re: [PATCH] cgroup: Check task_lock in task_subsys_state()

2010-04-22 Thread Paul E. McKenney
On Fri, Apr 23, 2010 at 10:35:52AM +0800, Li Zefan wrote: > task_subsys_state() is safe under task_lock(). See > Documentation/cgroups/cgroups.txt for locking rule. > > This fixes an RCU warning when resume from suspend. The > warning comes from freezer cgroup in cgroup_freezing_or_frozen(). > >

[Devel] Re: [PATCH] cgroup: Check task_lock in task_subsys_state()

2010-04-22 Thread Matt Helsley
On Fri, Apr 23, 2010 at 10:35:52AM +0800, Li Zefan wrote: > task_subsys_state() is safe under task_lock(). See > Documentation/cgroups/cgroups.txt for locking rule. > > This fixes an RCU warning when resume from suspend. The > warning comes from freezer cgroup in cgroup_freezing_or_frozen(). > >

[Devel] [PATCH] cgroup: Check task_lock in task_subsys_state()

2010-04-22 Thread Li Zefan
task_subsys_state() is safe under task_lock(). See Documentation/cgroups/cgroups.txt for locking rule. This fixes an RCU warning when resume from suspend. The warning comes from freezer cgroup in cgroup_freezing_or_frozen(). Signed-off-by: Li Zefan --- I'm not sure which is preferable - access

[Devel] Re: [PATCH 4/5] freezer cgroup: Fix an RCU warning in cgroup_freezing_or_frozen()

2010-04-22 Thread Li Zefan
with CONFIG_PROVE_RCU, a warning can be triggered when we resume from suspend: ... include/linux/cgroup.h:533 invoked rcu_dereference_check() without protection! ... task_freezer() calls task_subsys_state(), which needs to be protected by rcu_read_

[Devel] Re: [PATCH] Fix acquiring socket lock before reading RTNETLINK response

2010-04-22 Thread Serge E. Hallyn
Quoting Dan Smith (da...@us.ibm.com): > Signed-off-by: Dan Smith Looks good to my limited understanding. Acked-by: Serge Hallyn > --- > net/checkpoint_dev.c |7 --- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/net/checkpoint_dev.c b/net/checkpoint_dev.c > index

[Devel] Re: [PATCH 3/5] sched: Fix an RCU warning in print_task()

2010-04-22 Thread Paul E. McKenney
On Thu, Apr 22, 2010 at 02:12:12PM -0700, Matt Helsley wrote: > On Thu, Apr 22, 2010 at 12:20:04PM +0200, Peter Zijlstra wrote: > > > > > You can also pin a cgroup by holding whatever locks are held in the > > ->attach method. But the RCU annotation doesn't know (nor reasonably can > > know abou

[Devel] Re: [PATCH 3/5] sched: Fix an RCU warning in print_task()

2010-04-22 Thread Matt Helsley
On Thu, Apr 22, 2010 at 12:20:04PM +0200, Peter Zijlstra wrote: > You can also pin a cgroup by holding whatever locks are held in the > ->attach method. But the RCU annotation doesn't know (nor reasonably can > know about that). For my future reference, what's the right way to "fix" these situa

[Devel] Re: [PATCH 4/5] freezer cgroup: Fix an RCU warning in cgroup_freezing_or_frozen()

2010-04-22 Thread Peter Zijlstra
On Thu, 2010-04-22 at 12:59 -0700, Paul E. McKenney wrote: > On Thu, Apr 22, 2010 at 02:27:55PM +0200, Peter Zijlstra wrote: > > On Thu, 2010-04-22 at 17:31 +0800, Li Zefan wrote: > > > with CONFIG_PROVE_RCU, a warning can be triggered when we > > > resume from suspend: > > > > > > ... > > > inclu

[Devel] [PATCH] Fix acquiring socket lock before reading RTNETLINK response

2010-04-22 Thread Dan Smith
Signed-off-by: Dan Smith --- net/checkpoint_dev.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/net/checkpoint_dev.c b/net/checkpoint_dev.c index 7ccb899..2787892 100644 --- a/net/checkpoint_dev.c +++ b/net/checkpoint_dev.c @@ -136,11 +136,12 @@ static struct nlms

[Devel] Re: [PATCH 4/5] freezer cgroup: Fix an RCU warning in cgroup_freezing_or_frozen()

2010-04-22 Thread Paul E. McKenney
On Thu, Apr 22, 2010 at 02:27:55PM +0200, Peter Zijlstra wrote: > On Thu, 2010-04-22 at 17:31 +0800, Li Zefan wrote: > > with CONFIG_PROVE_RCU, a warning can be triggered when we > > resume from suspend: > > > > ... > > include/linux/cgroup.h:533 invoked rcu_dereference_check() without > > protec

[Devel] Re: [PATCH 5/5] blk-cgroup: Fix an RCU warning in blkiocg_create()

2010-04-22 Thread Paul E. McKenney
On Thu, Apr 22, 2010 at 05:32:28PM +0800, Li Zefan wrote: > with CONFIG_PROVE_RCU=y, a warning can be triggered: > > # mount -t cgroup -o blkio xxx /mnt > # mkdir /mnt/subgroup > > ... > kernel/cgroup.c:4442 invoked rcu_dereference_check() without protection! > ... > > To fix this, we avoid

[Devel] Re: [PATCH 3/5] sched: Fix an RCU warning in print_task()

2010-04-22 Thread Paul E. McKenney
On Thu, Apr 22, 2010 at 05:30:40PM +0800, Li Zefan wrote: > With CONFIG_PROVE_RCU=y, a warning can be triggered: > > $ cat /proc/sched_debug > > ... > kernel/cgroup.c:1649 invoked rcu_dereference_check() without protection! > ... > > Both cgroup_path() and task_group() should be called with ei

[Devel] Re: [PATCH 2/5] cgroup: Fix an RCU warning in alloc_css_id()

2010-04-22 Thread Paul E. McKenney
On Thu, Apr 22, 2010 at 05:30:00PM +0800, Li Zefan wrote: > With CONFIG_PROVE_RCU=y, a warning can be triggered: > > # mount -t cgroup -o memory xxx /mnt > # mkdir /mnt/0 > > ... > kernel/cgroup.c:4442 invoked rcu_dereference_check() without protection! > ... > > This is a false-positive. It

[Devel] Re: [PATCH 1/5] cgroup: Fix an RCU warning in cgroup_path()

2010-04-22 Thread Paul E. McKenney
On Thu, Apr 22, 2010 at 05:29:24PM +0800, Li Zefan wrote: > with CONFIG_PROVE_RCU=y, a warning can be triggered: > > # mount -t cgroup -o debug xxx /mnt > # cat /proc/$$/cgroup > > ... > kernel/cgroup.c:1649 invoked rcu_dereference_check() without protection! > ... > > This is a false-positi

[Devel] Re: [PATCH 5/5] blk-cgroup: Fix an RCU warning in blkiocg_create()

2010-04-22 Thread Vivek Goyal
On Thu, Apr 22, 2010 at 05:32:28PM +0800, Li Zefan wrote: > with CONFIG_PROVE_RCU=y, a warning can be triggered: > > # mount -t cgroup -o blkio xxx /mnt > # mkdir /mnt/subgroup > > ... > kernel/cgroup.c:4442 invoked rcu_dereference_check() without protection! > ... > IIUC, so blkiocg_create

[Devel] Re: [PATCH 4/5] freezer cgroup: Fix an RCU warning in cgroup_freezing_or_frozen()

2010-04-22 Thread Peter Zijlstra
On Thu, 2010-04-22 at 17:31 +0800, Li Zefan wrote: > with CONFIG_PROVE_RCU, a warning can be triggered when we > resume from suspend: > > ... > include/linux/cgroup.h:533 invoked rcu_dereference_check() without protection! > ... > > task_freezer() calls task_subsys_state(), which needs to be > pr

[Devel] Re: [PATCH 3/5] sched: Fix an RCU warning in print_task()

2010-04-22 Thread Peter Zijlstra
On Thu, 2010-04-22 at 17:30 +0800, Li Zefan wrote: > With CONFIG_PROVE_RCU=y, a warning can be triggered: > > $ cat /proc/sched_debug > > ... > kernel/cgroup.c:1649 invoked rcu_dereference_check() without protection! > ... > > Both cgroup_path() and task_group() should be called with either >

[Devel] [PATCH 5/5] blk-cgroup: Fix an RCU warning in blkiocg_create()

2010-04-22 Thread Li Zefan
with CONFIG_PROVE_RCU=y, a warning can be triggered: # mount -t cgroup -o blkio xxx /mnt # mkdir /mnt/subgroup ... kernel/cgroup.c:4442 invoked rcu_dereference_check() without protection! ... To fix this, we avoid caling css_depth() here, which is a bit simpler than the original code. Signe

[Devel] [PATCH 4/5] freezer cgroup: Fix an RCU warning in cgroup_freezing_or_frozen()

2010-04-22 Thread Li Zefan
with CONFIG_PROVE_RCU, a warning can be triggered when we resume from suspend: ... include/linux/cgroup.h:533 invoked rcu_dereference_check() without protection! ... task_freezer() calls task_subsys_state(), which needs to be protected by rcu_read_lock or cgroup_mutex. Signed-off-by: Li Zefan -

[Devel] [PATCH 3/5] sched: Fix an RCU warning in print_task()

2010-04-22 Thread Li Zefan
With CONFIG_PROVE_RCU=y, a warning can be triggered: $ cat /proc/sched_debug ... kernel/cgroup.c:1649 invoked rcu_dereference_check() without protection! ... Both cgroup_path() and task_group() should be called with either rcu_read_lock or cgroup_mutex held. Signed-off-by: Li Zefan --- kern

[Devel] [PATCH 2/5] cgroup: Fix an RCU warning in alloc_css_id()

2010-04-22 Thread Li Zefan
With CONFIG_PROVE_RCU=y, a warning can be triggered: # mount -t cgroup -o memory xxx /mnt # mkdir /mnt/0 ... kernel/cgroup.c:4442 invoked rcu_dereference_check() without protection! ... This is a false-positive. It's safe to directly access parent_css->id. Signed-off-by: Li Zefan --- kern

[Devel] [PATCH 1/5] cgroup: Fix an RCU warning in cgroup_path()

2010-04-22 Thread Li Zefan
with CONFIG_PROVE_RCU=y, a warning can be triggered: # mount -t cgroup -o debug xxx /mnt # cat /proc/$$/cgroup ... kernel/cgroup.c:1649 invoked rcu_dereference_check() without protection! ... This is a false-positive, because cgroup_path() can be called with either rcu_read_lock() held or cg