]> git.karo-electronics.de Git - linux-beck.git/commit
console: Move userspace I/O out of console_lock to fix lockdep warning
authorWaiman Long <longman@redhat.com>
Wed, 23 Nov 2016 19:06:45 +0000 (14:06 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Nov 2016 20:42:40 +0000 (21:42 +0100)
commit7edd7e82b96bcbcc2f9437449df29fde0f08295e
tree56a205cd9e02c8a7606f46d287997140d25f8559
parent5020ded78348092eac5e9909018f6d53e24eadb6
console: Move userspace I/O out of console_lock to fix lockdep warning

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: Waiman Long <longman@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/consolemap.c