Skip to content
  • Sergey Senozhatsky's avatar
    lib/ratelimit.c: use deferred printk() version · 656d61ce
    Sergey Senozhatsky authored
    printk_ratelimit() invokes ___ratelimit() which may invoke a normal
    printk() (pr_warn() in this particular case) to warn about suppressed
    output.  Given that printk_ratelimit() may be called from anywhere, that
    pr_warn() is dangerous - it may end up deadlocking the system.  Fix
    ___ratelimit() by using deferred printk().
    
    Sasha reported the following lockdep error:
    
     : Unregister pv shared memory for cpu 8
     : select_fallback_rq: 3 callbacks suppressed
     : process 8583 (trinity-c78) no longer affine to cpu8
     :
     : ======================================================
     : WARNING: possible circular locking dependency detected
     : 4.14.0-rc2-next-20170927+ #252 Not tainted
     : ------------------------------------------------------
     : migration/8/62 is trying to acquire lock:
     : (&port_lock_key){-.-.}, at: serial8250_console_write()
     :
     : but task is already holding lock:
     : (&rq->lock){-.-.}, at: sched_cpu_dying()
     :
     : which lock already depends on the new lock.
     :
    ...
    656d61ce