summaryrefslogtreecommitdiffstats
path: root/0010-fbcon-Do-not-takeover-the-console-from-atomic-contex.patch
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-08-06 18:22:19 +0200
committerHans de Goede <hdegoede@redhat.com>2018-08-06 18:22:33 +0200
commit13c17b879a406df92da78719fcbc7050cc5ee008 (patch)
treed0abe540bf95a5b122ea3a9a8f8a34a8d7011837 /0010-fbcon-Do-not-takeover-the-console-from-atomic-contex.patch
parent581efe4e7e1cc6faa17a776df09aea3a941c0089 (diff)
downloadkernel-13c17b879a406df92da78719fcbc7050cc5ee008.tar.gz
kernel-13c17b879a406df92da78719fcbc7050cc5ee008.tar.xz
kernel-13c17b879a406df92da78719fcbc7050cc5ee008.zip
Add one more FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER bugfix patch
Diffstat (limited to '0010-fbcon-Do-not-takeover-the-console-from-atomic-contex.patch')
-rw-r--r--0010-fbcon-Do-not-takeover-the-console-from-atomic-contex.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/0010-fbcon-Do-not-takeover-the-console-from-atomic-contex.patch b/0010-fbcon-Do-not-takeover-the-console-from-atomic-contex.patch
new file mode 100644
index 000000000..815c66073
--- /dev/null
+++ b/0010-fbcon-Do-not-takeover-the-console-from-atomic-contex.patch
@@ -0,0 +1,67 @@
+From 8f571bbfc621fd0826bbc7a8924c811f3a3167c9 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Mon, 6 Aug 2018 16:32:27 +0200
+Subject: [PATCH] fbcon: Do not takeover the console from atomic context
+
+Taking over the console involves allocating mem with GFP_KERNEL, talking
+to drm drivers, etc. So this should not be done from an atomic context.
+
+But the console-output trigger deferred console takeover may happen from an
+atomic context, which leads to "BUG: sleeping function called from invalid
+context" errors.
+
+This commit fixes these errors by doing the deferred takeover from a
+workqueue when the notifier runs from an atomic context.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+---
+ drivers/video/fbdev/core/fbcon.c | 21 +++++++++++++++++++--
+ 1 file changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
+index a3fd510..f812891 100644
+--- a/drivers/video/fbdev/core/fbcon.c
++++ b/drivers/video/fbdev/core/fbcon.c
+@@ -3596,7 +3596,22 @@ static int fbcon_init_device(void)
+ }
+
+ #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
++static void fbcon_register_existing_fbs(struct work_struct *work)
++{
++ int i;
++
++ console_lock();
++
++ for (i = 0; i < FB_MAX; i++) {
++ if (registered_fb[i])
++ fbcon_fb_registered(registered_fb[i]);
++ }
++
++ console_unlock();
++}
++
+ static struct notifier_block fbcon_output_nb;
++static DECLARE_WORK(fbcon_deferred_takeover_work, fbcon_register_existing_fbs);
+
+ static int fbcon_output_notifier(struct notifier_block *nb,
+ unsigned long action, void *data)
+@@ -3611,9 +3626,13 @@ static int fbcon_output_notifier(struct notifier_block *nb,
+ deferred_takeover = false;
+ logo_shown = FBCON_LOGO_DONTSHOW;
+
+- for (i = 0; i < FB_MAX; i++) {
+- if (registered_fb[i])
+- fbcon_fb_registered(registered_fb[i]);
++ if (in_atomic() || irqs_disabled()) {
++ schedule_work(&fbcon_deferred_takeover_work);
++ } else {
++ for (i = 0; i < FB_MAX; i++) {
++ if (registered_fb[i])
++ fbcon_fb_registered(registered_fb[i]);
++ }
+ }
+
+ return NOTIFY_OK;
+--
+2.18.0
+