]> git.baikalelectronics.ru Git - kernel.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)
commitd5b1b62664f31cab5aca29385441df56f0b88bd9
tree56a205cd9e02c8a7606f46d287997140d25f8559
parentab19cbccac6b07206cf52020e356ec7c032c3963
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