[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1490613502.3393.2.camel@sipsolutions.net>
Date: Mon, 27 Mar 2017 13:18:22 +0200
From: Johannes Berg <johannes@...solutions.net>
To: paulmck@...ux.vnet.ibm.com
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Nicolai Stange <nicstange@...il.com>,
gregkh <gregkh@...uxfoundation.org>, sharon.dvir@...el.com,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
linux-wireless <linux-wireless@...r.kernel.org>
Subject: Re: deadlock in synchronize_srcu() in debugfs?
On Fri, 2017-03-24 at 13:20 -0700, Paul E. McKenney wrote:
>
> And I cannot resist adding this one:
>
> CPU 1 CPU 2
> i = srcu_read_lock(&s1); mutex_lock(&l1);
> mutex_lock(&l1); synchronize_srcu(&s2);
> mutex_unlock(&l1); mutex_unlock(&l1);
> srcu_read_unlock(&s1, i);
>
> CPU 3 CPU 4
> i = srcu_read_lock(&s2); mutex_lock(&l2);
> mutex_lock(&l2); synchronize_srcu(&s1);
> mutex_unlock(&l2); mutex_unlock(&l2);
> srcu_read_unlock(&s2, i);
>
> Removing the SRCU statements from any of these CPU would break the
> deadlock. This can be easily extended to a deadlock cycle involving
> any number of srcu_struct structures.
>
> But this would still be a cycle involving an srcu_read_lock() and a
> synchronize_srcu() on the same srcu_struct, which is reassuring.
Right, you can cycle this indefinitely. lockdep has some kind of
maximum chain length I think. :)
johannes
Powered by blists - more mailing lists