• Waiman Long's avatar
    console: Move userspace I/O out of console_lock to fix lockdep warning · 7edd7e82
    Waiman Long authored
    When running certain workload on a debug kernel with lockdep turned on,
    a ppc64 kvm guest could sometimes hit the following lockdep warning:
    
      [ INFO: possible circular locking dependency detected ]
      Possible unsafe locking scenario:
    
            CPU0                    CPU1
            ----                    ----
       lock(&mm->mmap_sem);
                                    lock(console_lock);
                                    lock(&mm->mmap_sem);
       lock(cpu_hotplug.lock);
    
      *** DEADLOCK ***
    
    Looking at the console code, the console_lock-->mmap_sem scenario will
    only happen when reading or writing the console unicode map leading to
    a page fault.
    
    To break this circular locking dependency, all the userspace I/O
    operations in consolemap.c are now moved outside of the console_lock
    critical sections so that the mmap_sem won't be acquired when holding
    the console_lock.
    Signed-off-by: default avatarWaiman Long <longman@redhat.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    7edd7e82
consolemap.c 25 KB