Skip to content
  • Vitaly Kuznetsov's avatar
    panic: release stale console lock to always get the logbuf printed out · 08d78658
    Vitaly Kuznetsov authored
    
    
    In some cases we may end up killing the CPU holding the console lock
    while still having valuable data in logbuf. E.g. I'm observing the
    following:
    
    - A crash is happening on one CPU and console_unlock() is being called on
      some other.
    
    - console_unlock() tries to print out the buffer before releasing the lock
      and on slow console it takes time.
    
    - in the meanwhile crashing CPU does lots of printk()-s with valuable data
      (which go to the logbuf) and sends IPIs to all other CPUs.
    
    - console_unlock() finishes printing previous chunk and enables interrupts
      before trying to print out the rest, the CPU catches the IPI and never
      releases console lock.
    
    This is not the only possible case: in VT/fb subsystems we have many other
    console_lock()/console_unlock() users.  Non-masked interrupts (or
    receiving NMI in case of extreme slowness) will have the same result.
    Getting the whole console buffer printed out on crash should be top
    priority.
    
    [akpm@linux-foundation.org: tweak comment text]
    Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
    Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
    Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: Jiri Kosina <jkosina@suse.cz>
    Cc: Baoquan He <bhe@redhat.com>
    Cc: Prarit Bhargava <prarit@redhat.com>
    Cc: Xie XiuQi <xiexiuqi@huawei.com>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: "K. Y. Srinivasan" <kys@microsoft.com>
    Cc: Jan Kara <jack@suse.cz>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    08d78658