lkml.org 
[lkml]   [2017]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: deadlock in synchronize_srcu() in debugfs?
From
Date
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

\
 
 \ /
  Last update: 2017-03-27 13:19    [W:0.658 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site