Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1367068

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

From Boqun Feng <boqun.feng@gmail.com>
Newsgroups linux.kernel
Subject Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260
Date 2016-03-30 12:10 +0200
Message-ID <rilez-3Ki-13@gated-at.bofh.it> (permalink)
References (1 earlier) <rheIa-5IK-1@gated-at.bofh.it> <rhhG1-85z-1@gated-at.bofh.it> <rhpNf-56p-1@gated-at.bofh.it> <rhXvz-3qM-1@gated-at.bofh.it> <rikLx-3iV-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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: Detect chain_key 
> > > collisions").
> > 
> > I've Cc:-ed Alfredo Alvarez Fernandez who added that test.
> 
> OK, so while the code in check_no_collision() seems sensible, it relies
> on borken bits.
> 
> The whole chain_hlocks and /proc/lockdep_chains stuff appears to have
> been buggered from the start.
> 
> The below patch should fix this.
> 
> Furthermore, our hash function has definite room for improvement.
> 
> ---
>  include/linux/lockdep.h       |  8 +++++---
>  kernel/locking/lockdep.c      | 30 ++++++++++++++++++++++++------
>  kernel/locking/lockdep_proc.c |  2 ++
>  3 files changed, 31 insertions(+), 9 deletions(-)
> 
> diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
> index d026b190c530..2568c120513b 100644
> --- a/include/linux/lockdep.h
> +++ b/include/linux/lockdep.h
> @@ -196,9 +196,11 @@ struct lock_list {
>   * We record lock dependency chains, so that we can cache them:
>   */
>  struct lock_chain {
> -	u8				irq_context;
> -	u8				depth;
> -	u16				base;
> +	/* see BUILD_BUG_ON()s in lookup_chain_cache() */
> +	unsigned int			irq_context :  2,
> +					depth       :  6,
> +					base	    : 24;
> +	/* 4 byte hole */
>  	struct hlist_node		entry;
>  	u64				chain_key;
>  };
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 53ab2f85d77e..91a4b7780afb 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c

[...]

> @@ -2860,11 +2882,6 @@ static int separate_irq_context(struct task_struct *curr,
>  {
>  	unsigned int depth = curr->lockdep_depth;
>  
> -	/*
> -	 * Keep track of points where we cross into an interrupt context:
> -	 */
> -	hlock->irq_context = 2*(curr->hardirq_context ? 1 : 0) +
> -				curr->softirq_context;
>  	if (depth) {
>  		struct held_lock *prev_hlock;
>  
> @@ -3164,6 +3181,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
>  	hlock->acquire_ip = ip;
>  	hlock->instance = lock;
>  	hlock->nest_lock = nest_lock;
> +	hlock->irq_context = 2*(!!curr->hardirq_context) + !!curr->softirq_context;
>  	hlock->trylock = trylock;
>  	hlock->read = read;
>  	hlock->check = check;

This is just for cleaning up, right? However ->hardirq_context and
->softirq_context only defined when CONFIG_TRACE_IRQFLAGS=y.

So we should use macro like current_hardirq_context() here? Or
considering the two helpers introduced in my RFC:

http://lkml.kernel.org/g/1455602265-16490-2-git-send-email-boqun.feng@gmail.com

if you don't think that overkills ;-)

Regards,
Boqun

[...]

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-27 14:10 +0200
  Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Boqun Feng <boqun.feng@gmail.com> - 2016-03-27 15:40 +0200
  Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Theodore Ts'o <tytso@mit.edu> - 2016-03-27 20:30 +0200
    Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-27 21:50 +0200
      Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-27 22:30 +0200
  Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-27 22:50 +0200
    Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-27 23:50 +0200
    Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-28 08:40 +0200
    Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Ingo Molnar <mingo@kernel.org> - 2016-03-29 10:50 +0200
      Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 11:40 +0200
        Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 12:00 +0200
          Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 14:50 +0200
            Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 14:50 +0200
              Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 15:20 +0200
        Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 12:00 +0200
        Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Boqun Feng <boqun.feng@gmail.com> - 2016-03-30 12:10 +0200
          Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 12:40 +0200
            Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 13:10 +0200
          Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-31 17:50 +0200
            Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Boqun Feng <boqun.feng@gmail.com> - 2016-03-31 18:00 +0200
            Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-04-02 08:30 +0200
        Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Peter Zijlstra <peterz@infradead.org> - 2016-03-30 16:10 +0200
          Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 17:30 +0200
            [PATCH] lockdep: print chain_key collision information Alfredo Alvarez Fernandez <alfredoalvarezfernandez@gmail.com> - 2016-03-30 19:10 +0200
              Re: [PATCH] lockdep: print chain_key collision information Peter Zijlstra <peterz@infradead.org> - 2016-03-30 19:20 +0200
              [tip:core/urgent] locking/lockdep: Print chain_key collision  information tip-bot for Alfredo Alvarez Fernandez <tipbot@zytor.com> - 2016-04-01 08:40 +0200
      Re: [Linux-v4.6-rc1] ext4: WARNING: CPU: 2 PID: 2692 at  kernel/locking/lockdep.c:2017 __lock_acquire+0x180e/0x2260 Sedat Dilek <sedat.dilek@gmail.com> - 2016-03-30 11:40 +0200

csiph-web