drm/nouveau: Handle fbcon suspend/resume in seperate worker
authorLyude Paul <lyude@redhat.com>
Thu, 12 Jan 2017 02:25:24 +0000 (21:25 -0500)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 02:58:37 +0000 (02:58 +0000)
commitda9030129ead5937ebe58f448ed74ceb3c5da39c
tree44621fad59dba731a8dfe28bf923fbc2a5a8d24a
parent899a2083c6e6d0035b9973e923eb84acbebcc7d5
drm/nouveau: Handle fbcon suspend/resume in seperate worker

[ Upstream commit 15266ae38fe09dae07bd8812cb7a7717b1e1d992 ]

Resuming from RPM can happen while already holding
dev->mode_config.mutex. This means we can't actually handle fbcon in
any RPM resume workers, since restoring fbcon requires grabbing
dev->mode_config.mutex again. So move the fbcon suspend/resume code into
it's own worker, and rely on that instead to avoid deadlocking.

This fixes more deadlocks for runtime suspending the GPU on the ThinkPad
W541. Reproduction recipe:

 - Get a machine with both optimus and a nvidia card with connectors
   attached to it
 - Wait for the nvidia GPU to suspend
 - Attempt to manually reprobe any of the connectors on the nvidia GPU
   using sysfs
 - *deadlock*

[airlied: use READ_ONCE to address Hans's comment]

Signed-off-by: Lyude <lyude@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Kilian Singer <kilian.singer@quantumtechnology.info>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: David Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/nouveau/nouveau_fbcon.c