Re: [PATCH v3] fbcon: Do not takeover the console from atomic context

2018-08-11 Thread Hans de Goede

Hi,

On 10-08-18 17:22, Bartlomiej Zolnierkiewicz wrote:

On Friday, August 10, 2018 01:27:57 PM Hans de Goede wrote:

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.

Signed-off-by: Hans de Goede 


Patch queued for 4.19, thanks.


@@ -3607,8 +3620,8 @@ static int fbcon_output_notifier(struct notifier_block 
*nb,
deferred_takeover = false;
logo_shown = FBCON_LOGO_DONTSHOW;
  
-	for_each_registered_fb(i)

-   fbcon_fb_registered(registered_fb[i]);
+   /* We may get called in atomic context */
+   schedule_work(_deferred_takeover_work);


After above change gcc now complains about unused variable:

drivers/video/fbdev/core/fbcon.c: In function ‘fbcon_output_notifier’:
drivers/video/fbdev/core/fbcon.c:3613:6: warning: unused variable ‘i’ 
[-Wunused-variable]
   int i;
   ^

I fixed this while applying the patch.


Ah yes, thank you for fixing this,

Regards,

Hans
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3] fbcon: Do not takeover the console from atomic context

2018-08-10 Thread Bartlomiej Zolnierkiewicz
On Friday, August 10, 2018 01:27:57 PM Hans de Goede wrote:
> 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.
> 
> Signed-off-by: Hans de Goede 

Patch queued for 4.19, thanks.

> @@ -3607,8 +3620,8 @@ static int fbcon_output_notifier(struct notifier_block 
> *nb,
>   deferred_takeover = false;
>   logo_shown = FBCON_LOGO_DONTSHOW;
>  
> - for_each_registered_fb(i)
> - fbcon_fb_registered(registered_fb[i]);
> + /* We may get called in atomic context */
> + schedule_work(_deferred_takeover_work);

After above change gcc now complains about unused variable:

drivers/video/fbdev/core/fbcon.c: In function ‘fbcon_output_notifier’:
drivers/video/fbdev/core/fbcon.c:3613:6: warning: unused variable ‘i’ 
[-Wunused-variable]
  int i;
  ^

I fixed this while applying the patch.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel