Re: [PATCH] make lockdep happy with r/o bind mounts

2007-09-24 Thread Peter Zijlstra
On Mon, 24 Sep 2007 10:46:58 -0700 Dave Hansen <[EMAIL PROTECTED]>
wrote:

> 
> With the r/o bind mount patches, we can have as many
> spinlocks nested as there are CPUs on the system.
> Lockdep freaks out after 8.
> 
> So, create a new lockdep class of locks for the
> mnt_writer spinlocks, and initialize each of the
> cpu locks to be in a different class.
> 
> It should shut up warnings like this, while still
> allowing some of the lockdep goodness to remain:
> 
> =
> [ INFO: possible recursive locking detected ]
> 2.6.23-rc6 #6
> -
> swapper/1 is trying to acquire lock:
>  (>lock){--..}, at: [] 
> lock_and_coalesce_cpu_mnt_writer_counts+0x29/0x5c
> 
> but task is already holding lock:
>  (>lock){--..}, at: [] 
> lock_and_coalesce_cpu_mnt_writer_counts+0x29/0x5c
> 
> other info that might help us debug this:
> 1 lock held by swapper/1:
>  #0:  (>lock){--..}, at: [] 
> lock_and_coalesce_cpu_mnt_writer_counts+0x29/0x5c
> 
> stack backtrace:
>  [] show_trace_log_lvl+0x19/0x2e
>  [] show_trace+0x12/0x14
>  [] dump_stack+0x14/0x16
>  [] print_deadlock_bug+0xb7/0xc1
>  [] check_deadlock+0x40/0x54
>  [] validate_chain+0x26e/0x319
>  [] __lock_acquire+0x6c4/0x731
>  [] lock_acquire+0x7a/0x94
>  [] _spin_lock+0x38/0x62
>  [] lock_and_coalesce_cpu_mnt_writer_counts+0x29/0x5c
>  [] mntput_no_expire+0x38/0xad
>  [] path_release_on_umount+0x15/0x18
>  [] sys_umount+0x67/0x6f
>  [] name_to_dev_t+0x22a/0x24c
>  [] prepare_namespace+0x89/0x187
>  [] kernel_init+0x9a/0xa3
>  [] kernel_thread_helper+0x7/0x10
>  ===
> 
> Signed-off-by: Dave Hansen <[EMAIL PROTECTED]>

Acked-by: Peter Zijlstra <[EMAIL PROTECTED]>

> ---
> 
>  lxc-dave/fs/namespace.c |2 ++
>  1 file changed, 2 insertions(+)
> 
> diff -puN fs/namespace.c~make-lockdep-happy-with-ro-bind-mounts fs/namespace.c
> --- lxc/fs/namespace.c~make-lockdep-happy-with-ro-bind-mounts 2007-09-24 
> 10:32:23.0 -0700
> +++ lxc-dave/fs/namespace.c   2007-09-24 10:41:37.0 -0700
> @@ -116,6 +116,7 @@ struct mnt_writer {
>* must be ordered by cpu number.
>*/
>   spinlock_t lock;
> + struct lock_class_key lock_class; /* compiles out with !lockdep */
>   unsigned long count;
>   struct vfsmount *mnt;
>  } cacheline_aligned_in_smp;
> @@ -127,6 +128,7 @@ static int __init init_mnt_writers(void)
>   for_each_possible_cpu(cpu) {
>   struct mnt_writer *writer = _cpu(mnt_writers, cpu);
>   spin_lock_init(>lock);
> + lockdep_set_class(>lock, >lock_class);
>   writer->count = 0;
>   }
>   return 0;
> diff -puN include/linux/lockdep.h~make-lockdep-happy-with-ro-bind-mounts 
> include/linux/lockdep.h
> _
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] make lockdep happy with r/o bind mounts

2007-09-24 Thread Arjan van de Ven
On Mon, 24 Sep 2007 10:46:58 -0700
Dave Hansen <[EMAIL PROTECTED]> wrote:

> 
> With the r/o bind mount patches, we can have as many
> spinlocks nested as there are CPUs on the system.
> Lockdep freaks out after 8.

The patch implements the right solution for this "invent your own lock"
situation... 

Acked-by: Arjan van de Ven <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] make lockdep happy with r/o bind mounts

2007-09-24 Thread Arjan van de Ven
On Mon, 24 Sep 2007 10:46:58 -0700
Dave Hansen [EMAIL PROTECTED] wrote:

 
 With the r/o bind mount patches, we can have as many
 spinlocks nested as there are CPUs on the system.
 Lockdep freaks out after 8.

The patch implements the right solution for this invent your own lock
situation... 

Acked-by: Arjan van de Ven [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] make lockdep happy with r/o bind mounts

2007-09-24 Thread Peter Zijlstra
On Mon, 24 Sep 2007 10:46:58 -0700 Dave Hansen [EMAIL PROTECTED]
wrote:

 
 With the r/o bind mount patches, we can have as many
 spinlocks nested as there are CPUs on the system.
 Lockdep freaks out after 8.
 
 So, create a new lockdep class of locks for the
 mnt_writer spinlocks, and initialize each of the
 cpu locks to be in a different class.
 
 It should shut up warnings like this, while still
 allowing some of the lockdep goodness to remain:
 
 =
 [ INFO: possible recursive locking detected ]
 2.6.23-rc6 #6
 -
 swapper/1 is trying to acquire lock:
  (writer-lock){--..}, at: [c016c094] 
 lock_and_coalesce_cpu_mnt_writer_counts+0x29/0x5c
 
 but task is already holding lock:
  (writer-lock){--..}, at: [c016c094] 
 lock_and_coalesce_cpu_mnt_writer_counts+0x29/0x5c
 
 other info that might help us debug this:
 1 lock held by swapper/1:
  #0:  (writer-lock){--..}, at: [c016c094] 
 lock_and_coalesce_cpu_mnt_writer_counts+0x29/0x5c
 
 stack backtrace:
  [c01034ab] show_trace_log_lvl+0x19/0x2e
  [c01034d2] show_trace+0x12/0x14
  [c01035be] dump_stack+0x14/0x16
  [c0130ab2] print_deadlock_bug+0xb7/0xc1
  [c0130afc] check_deadlock+0x40/0x54
  [c013100a] validate_chain+0x26e/0x319
  [c0132cca] __lock_acquire+0x6c4/0x731
  [c01332da] lock_acquire+0x7a/0x94
  [c031bb01] _spin_lock+0x38/0x62
  [c016c094] lock_and_coalesce_cpu_mnt_writer_counts+0x29/0x5c
  [c016c5f8] mntput_no_expire+0x38/0xad
  [c015fbed] path_release_on_umount+0x15/0x18
  [c016cc76] sys_umount+0x67/0x6f
  [c010058a] name_to_dev_t+0x22a/0x24c
  [c0427207] prepare_namespace+0x89/0x187
  [c0426cdd] kernel_init+0x9a/0xa3
  [c010336f] kernel_thread_helper+0x7/0x10
  ===
 
 Signed-off-by: Dave Hansen [EMAIL PROTECTED]

Acked-by: Peter Zijlstra [EMAIL PROTECTED]

 ---
 
  lxc-dave/fs/namespace.c |2 ++
  1 file changed, 2 insertions(+)
 
 diff -puN fs/namespace.c~make-lockdep-happy-with-ro-bind-mounts fs/namespace.c
 --- lxc/fs/namespace.c~make-lockdep-happy-with-ro-bind-mounts 2007-09-24 
 10:32:23.0 -0700
 +++ lxc-dave/fs/namespace.c   2007-09-24 10:41:37.0 -0700
 @@ -116,6 +116,7 @@ struct mnt_writer {
* must be ordered by cpu number.
*/
   spinlock_t lock;
 + struct lock_class_key lock_class; /* compiles out with !lockdep */
   unsigned long count;
   struct vfsmount *mnt;
  } cacheline_aligned_in_smp;
 @@ -127,6 +128,7 @@ static int __init init_mnt_writers(void)
   for_each_possible_cpu(cpu) {
   struct mnt_writer *writer = per_cpu(mnt_writers, cpu);
   spin_lock_init(writer-lock);
 + lockdep_set_class(writer-lock, writer-lock_class);
   writer-count = 0;
   }
   return 0;
 diff -puN include/linux/lockdep.h~make-lockdep-happy-with-ro-bind-mounts 
 include/linux/lockdep.h
 _
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/