On Mon, Nov 23, 2020 at 08:13:32PM +0900, Byungchul Park wrote:
> [    0.995081] ===================================================
> [    0.995619] Dept: Circular dependency has been detected.
> [    0.995816] 5.9.0+ #8 Tainted: G        W        
> [    0.996493] ---------------------------------------------------
> [    0.996493] summary
> [    0.996493] ---------------------------------------------------
> [    0.996493] *** AA DEADLOCK ***
> [    0.996493] 
> [    0.996493] context A
> [    0.996493]     [S] __mutex_lock(&dev->mutex:0)
> [    0.996493]     [W] __mutex_lock(&dev->mutex:0)
> [    0.996493]     [E] __mutex_unlock(&dev->mutex:0)
> [    0.996493] 
> [    0.996493] [S]: start of the event context
> [    0.996493] [W]: the wait blocked
> [    0.996493] [E]: the event not reachable

Let me explain what [S], [W] and [E] mean using example:

1. In the case of typical locks:

   if condition a
      lock(&a);         <- [S] start of the event context for the event, 
unlock(&a)
                           [W] wait as well
      ...
      unlock(&a);       <- [E] event to someone who has been waiting lock &a to
                               be released
   else
      lock(&b);         <- [S] start of the event context for the event, 
unlock(&b)
                           [W] wait as well
      ...
      unlock(&b);       <- [E] event to someone who has been waiting lock &b to
                               be released

2. In the case of general wait and event:

   THREAD 1
      trigger_the_event_context_to_go();
      ...
      wait_for_something(&c); <- [W] wait
         store_timestamp();

   THREAD 2
      notice_someone_triggered_me();
      ...

      (somewhere can see the timestamp of wait_for_something(&c) in THREAD 1)
      <- [S] start of the event context for the event, do_something(&c)

      ...
      do_something(&c); <- [E] event the wait is waiting for in THREAD 1

Thanks,
Byungchul

Reply via email to