All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/fb-helper: Add locking to sysrq handling
@ 2020-10-07 13:30 ` Daniel Vetter
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2020-10-07 13:30 UTC (permalink / raw)
  To: DRI Development
  Cc: David Airlie, Daniel Vetter, Intel Graphics Development,
	Thomas Zimmermann, Daniel Vetter

We didn't take the kernel_fb_helper_lock mutex, which protects that
code. While at it, simplify the code
- inline the function (originally shared with kgdb I think)
- drop the error tracking and all the complications
- drop the pointless early out, it served nothing

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/drm_fb_helper.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 8697554ccd41..c2f72bb6afb1 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -281,18 +281,12 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
 EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
 
 #ifdef CONFIG_MAGIC_SYSRQ
-/*
- * restore fbcon display for all kms driver's using this helper, used for sysrq
- * and panic handling.
- */
-static bool drm_fb_helper_force_kernel_mode(void)
+/* emergency restore, don't bother with error reporting */
+static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
 {
-	bool ret, error = false;
 	struct drm_fb_helper *helper;
 
-	if (list_empty(&kernel_fb_helper_list))
-		return false;
-
+	mutex_lock(&kernel_fb_helper_lock);
 	list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
 		struct drm_device *dev = helper->dev;
 
@@ -300,22 +294,12 @@ static bool drm_fb_helper_force_kernel_mode(void)
 			continue;
 
 		mutex_lock(&helper->lock);
-		ret = drm_client_modeset_commit_locked(&helper->client);
-		if (ret)
-			error = true;
+		drm_client_modeset_commit_locked(&helper->client);
 		mutex_unlock(&helper->lock);
 	}
-	return error;
+	mutex_unlock(&kernel_fb_helper_lock);
 }
 
-static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
-{
-	bool ret;
-
-	ret = drm_fb_helper_force_kernel_mode();
-	if (ret == true)
-		DRM_ERROR("Failed to restore crtc configuration\n");
-}
 static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
 
 static void drm_fb_helper_sysrq(int dummy1)
-- 
2.28.0

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-gfx] [PATCH] drm/fb-helper: Add locking to sysrq handling
@ 2020-10-07 13:30 ` Daniel Vetter
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2020-10-07 13:30 UTC (permalink / raw)
  To: DRI Development
  Cc: David Airlie, Daniel Vetter, Intel Graphics Development,
	Maxime Ripard, Thomas Zimmermann, Daniel Vetter

We didn't take the kernel_fb_helper_lock mutex, which protects that
code. While at it, simplify the code
- inline the function (originally shared with kgdb I think)
- drop the error tracking and all the complications
- drop the pointless early out, it served nothing

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/drm_fb_helper.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 8697554ccd41..c2f72bb6afb1 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -281,18 +281,12 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
 EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
 
 #ifdef CONFIG_MAGIC_SYSRQ
-/*
- * restore fbcon display for all kms driver's using this helper, used for sysrq
- * and panic handling.
- */
-static bool drm_fb_helper_force_kernel_mode(void)
+/* emergency restore, don't bother with error reporting */
+static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
 {
-	bool ret, error = false;
 	struct drm_fb_helper *helper;
 
-	if (list_empty(&kernel_fb_helper_list))
-		return false;
-
+	mutex_lock(&kernel_fb_helper_lock);
 	list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
 		struct drm_device *dev = helper->dev;
 
@@ -300,22 +294,12 @@ static bool drm_fb_helper_force_kernel_mode(void)
 			continue;
 
 		mutex_lock(&helper->lock);
-		ret = drm_client_modeset_commit_locked(&helper->client);
-		if (ret)
-			error = true;
+		drm_client_modeset_commit_locked(&helper->client);
 		mutex_unlock(&helper->lock);
 	}
-	return error;
+	mutex_unlock(&kernel_fb_helper_lock);
 }
 
-static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
-{
-	bool ret;
-
-	ret = drm_fb_helper_force_kernel_mode();
-	if (ret == true)
-		DRM_ERROR("Failed to restore crtc configuration\n");
-}
 static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
 
 static void drm_fb_helper_sysrq(int dummy1)
-- 
2.28.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/fb-helper: Add locking to sysrq handling
  2020-10-07 13:30 ` [Intel-gfx] " Daniel Vetter
  (?)
@ 2020-10-07 13:41 ` Patchwork
  -1 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2020-10-07 13:41 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

== Series Details ==

Series: drm/fb-helper: Add locking to sysrq handling
URL   : https://patchwork.freedesktop.org/series/82441/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
da54a4f1af82 drm/fb-helper: Add locking to sysrq handling
-:69: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter <daniel.vetter@ffwll.ch>'

total: 0 errors, 1 warnings, 0 checks, 45 lines checked


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Intel-gfx] ✓ Fi.CI.BAT: success for drm/fb-helper: Add locking to sysrq handling
  2020-10-07 13:30 ` [Intel-gfx] " Daniel Vetter
  (?)
  (?)
@ 2020-10-07 14:03 ` Patchwork
  -1 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2020-10-07 14:03 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 6448 bytes --]

== Series Details ==

Series: drm/fb-helper: Add locking to sysrq handling
URL   : https://patchwork.freedesktop.org/series/82441/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9109 -> Patchwork_18647
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/index.html

Known issues
------------

  Here are the changes found in Patchwork_18647 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_module_load@reload:
    - fi-tgl-u2:          [PASS][1] -> [DMESG-WARN][2] ([i915#1982] / [k.org#205379])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-tgl-u2/igt@i915_module_load@reload.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-tgl-u2/igt@i915_module_load@reload.html

  * igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1:
    - fi-icl-u2:          [PASS][3] -> [DMESG-WARN][4] ([i915#1982])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-icl-u2/igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-icl-u2/igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1.html

  
#### Possible fixes ####

  * igt@i915_pm_rpm@basic-pci-d3-state:
    - fi-byt-j1900:       [DMESG-WARN][5] ([i915#1982]) -> [PASS][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-byt-j1900/igt@i915_pm_rpm@basic-pci-d3-state.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-byt-j1900/igt@i915_pm_rpm@basic-pci-d3-state.html
    - fi-bsw-kefka:       [DMESG-WARN][7] ([i915#1982]) -> [PASS][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-bsw-kefka/igt@i915_pm_rpm@basic-pci-d3-state.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-bsw-kefka/igt@i915_pm_rpm@basic-pci-d3-state.html

  * igt@i915_pm_rpm@module-reload:
    - fi-apl-guc:         [DMESG-WARN][9] ([i915#1635] / [i915#1982]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-apl-guc/igt@i915_pm_rpm@module-reload.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-apl-guc/igt@i915_pm_rpm@module-reload.html

  * igt@kms_busy@basic@flip:
    - {fi-tgl-dsi}:       [DMESG-WARN][11] ([i915#1982]) -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-tgl-dsi/igt@kms_busy@basic@flip.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-tgl-dsi/igt@kms_busy@basic@flip.html

  * igt@kms_flip@basic-flip-vs-wf_vblank@c-edp1:
    - fi-icl-u2:          [DMESG-WARN][13] ([i915#1982]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-icl-u2/igt@kms_flip@basic-flip-vs-wf_vblank@c-edp1.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-icl-u2/igt@kms_flip@basic-flip-vs-wf_vblank@c-edp1.html

  
#### Warnings ####

  * igt@gem_exec_suspend@basic-s0:
    - fi-kbl-x1275:       [DMESG-WARN][15] ([i915#62] / [i915#92]) -> [DMESG-WARN][16] ([i915#1982] / [i915#62] / [i915#92] / [i915#95])
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-kbl-x1275/igt@gem_exec_suspend@basic-s0.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-kbl-x1275/igt@gem_exec_suspend@basic-s0.html

  * igt@i915_pm_rpm@module-reload:
    - fi-kbl-x1275:       [DMESG-FAIL][17] ([i915#62]) -> [DMESG-FAIL][18] ([i915#62] / [i915#95])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
    - fi-skl-6700k2:      [DMESG-WARN][19] ([i915#2203]) -> [INCOMPLETE][20] ([i915#151] / [i915#2203])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-skl-6700k2/igt@i915_pm_rpm@module-reload.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-skl-6700k2/igt@i915_pm_rpm@module-reload.html

  * igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size:
    - fi-kbl-x1275:       [DMESG-WARN][21] ([i915#62] / [i915#92] / [i915#95]) -> [DMESG-WARN][22] ([i915#62] / [i915#92]) +3 similar issues
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-kbl-x1275/igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-kbl-x1275/igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size.html

  * igt@kms_force_connector_basic@prune-stale-modes:
    - fi-kbl-x1275:       [DMESG-WARN][23] ([i915#62] / [i915#92]) -> [DMESG-WARN][24] ([i915#62] / [i915#92] / [i915#95]) +2 similar issues
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9109/fi-kbl-x1275/igt@kms_force_connector_basic@prune-stale-modes.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-kbl-x1275/igt@kms_force_connector_basic@prune-stale-modes.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [i915#151]: https://gitlab.freedesktop.org/drm/intel/issues/151
  [i915#1635]: https://gitlab.freedesktop.org/drm/intel/issues/1635
  [i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
  [i915#2203]: https://gitlab.freedesktop.org/drm/intel/issues/2203
  [i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
  [i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
  [i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95
  [k.org#205379]: https://bugzilla.kernel.org/show_bug.cgi?id=205379


Participating hosts (45 -> 39)
------------------------------

  Missing    (6): fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * Linux: CI_DRM_9109 -> Patchwork_18647

  CI-20190529: 20190529
  CI_DRM_9109: 96e1886f0244ba6e235730b1da9146e71ed6ff3c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5803: 33f07391e5f6a8d9323e471c81db3f29f91ed4d7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_18647: da54a4f1af82a9d13f336bd9bcf5512f5c7e3fcc @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

da54a4f1af82 drm/fb-helper: Add locking to sysrq handling

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/index.html

[-- Attachment #1.2: Type: text/html, Size: 8829 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/fb-helper: Add locking to sysrq handling
  2020-10-07 13:30 ` [Intel-gfx] " Daniel Vetter
@ 2020-10-08  9:22   ` Thomas Zimmermann
  -1 siblings, 0 replies; 8+ messages in thread
From: Thomas Zimmermann @ 2020-10-08  9:22 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: David Airlie, Intel Graphics Development, Daniel Vetter


[-- Attachment #1.1.1: Type: text/plain, Size: 3019 bytes --]

Hi

Am 07.10.20 um 15:30 schrieb Daniel Vetter:
> We didn't take the kernel_fb_helper_lock mutex, which protects that
> code. While at it, simplify the code
> - inline the function (originally shared with kgdb I think)
> - drop the error tracking and all the complications
> - drop the pointless early out, it served nothing
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 26 +++++---------------------
>  1 file changed, 5 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 8697554ccd41..c2f72bb6afb1 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -281,18 +281,12 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
>  EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
>  
>  #ifdef CONFIG_MAGIC_SYSRQ
> -/*
> - * restore fbcon display for all kms driver's using this helper, used for sysrq
> - * and panic handling.
> - */
> -static bool drm_fb_helper_force_kernel_mode(void)
> +/* emergency restore, don't bother with error reporting */
> +static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
>  {
> -	bool ret, error = false;
>  	struct drm_fb_helper *helper;
>  
> -	if (list_empty(&kernel_fb_helper_list))
> -		return false;
> -
> +	mutex_lock(&kernel_fb_helper_lock);
>  	list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
>  		struct drm_device *dev = helper->dev;
>  
> @@ -300,22 +294,12 @@ static bool drm_fb_helper_force_kernel_mode(void)
>  			continue;
>  
>  		mutex_lock(&helper->lock);
> -		ret = drm_client_modeset_commit_locked(&helper->client);
> -		if (ret)
> -			error = true;
> +		drm_client_modeset_commit_locked(&helper->client);
>  		mutex_unlock(&helper->lock);
>  	}
> -	return error;
> +	mutex_unlock(&kernel_fb_helper_lock);
>  }
>  
> -static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
> -{
> -	bool ret;
> -
> -	ret = drm_fb_helper_force_kernel_mode();
> -	if (ret == true)
> -		DRM_ERROR("Failed to restore crtc configuration\n");

Is there a specific reason for removing that warning? Even if it doesn't
show up on screen, is it not helpful in the kernel's log?

In any case, the rest looks good.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regards
Thomas

> -}
>  static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
>  
>  static void drm_fb_helper_sysrq(int dummy1)
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 516 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/fb-helper: Add locking to sysrq handling
@ 2020-10-08  9:22   ` Thomas Zimmermann
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Zimmermann @ 2020-10-08  9:22 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: David Airlie, Intel Graphics Development, Maxime Ripard, Daniel Vetter


[-- Attachment #1.1.1: Type: text/plain, Size: 3019 bytes --]

Hi

Am 07.10.20 um 15:30 schrieb Daniel Vetter:
> We didn't take the kernel_fb_helper_lock mutex, which protects that
> code. While at it, simplify the code
> - inline the function (originally shared with kgdb I think)
> - drop the error tracking and all the complications
> - drop the pointless early out, it served nothing
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 26 +++++---------------------
>  1 file changed, 5 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 8697554ccd41..c2f72bb6afb1 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -281,18 +281,12 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
>  EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
>  
>  #ifdef CONFIG_MAGIC_SYSRQ
> -/*
> - * restore fbcon display for all kms driver's using this helper, used for sysrq
> - * and panic handling.
> - */
> -static bool drm_fb_helper_force_kernel_mode(void)
> +/* emergency restore, don't bother with error reporting */
> +static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
>  {
> -	bool ret, error = false;
>  	struct drm_fb_helper *helper;
>  
> -	if (list_empty(&kernel_fb_helper_list))
> -		return false;
> -
> +	mutex_lock(&kernel_fb_helper_lock);
>  	list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
>  		struct drm_device *dev = helper->dev;
>  
> @@ -300,22 +294,12 @@ static bool drm_fb_helper_force_kernel_mode(void)
>  			continue;
>  
>  		mutex_lock(&helper->lock);
> -		ret = drm_client_modeset_commit_locked(&helper->client);
> -		if (ret)
> -			error = true;
> +		drm_client_modeset_commit_locked(&helper->client);
>  		mutex_unlock(&helper->lock);
>  	}
> -	return error;
> +	mutex_unlock(&kernel_fb_helper_lock);
>  }
>  
> -static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
> -{
> -	bool ret;
> -
> -	ret = drm_fb_helper_force_kernel_mode();
> -	if (ret == true)
> -		DRM_ERROR("Failed to restore crtc configuration\n");

Is there a specific reason for removing that warning? Even if it doesn't
show up on screen, is it not helpful in the kernel's log?

In any case, the rest looks good.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regards
Thomas

> -}
>  static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
>  
>  static void drm_fb_helper_sysrq(int dummy1)
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 516 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/fb-helper: Add locking to sysrq handling
  2020-10-08  9:22   ` [Intel-gfx] " Thomas Zimmermann
@ 2020-10-08  9:29     ` Daniel Vetter
  -1 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2020-10-08  9:29 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: David Airlie, Intel Graphics Development, DRI Development, Daniel Vetter

On Thu, Oct 8, 2020 at 11:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 07.10.20 um 15:30 schrieb Daniel Vetter:
> > We didn't take the kernel_fb_helper_lock mutex, which protects that
> > code. While at it, simplify the code
> > - inline the function (originally shared with kgdb I think)
> > - drop the error tracking and all the complications
> > - drop the pointless early out, it served nothing
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > ---
> >  drivers/gpu/drm/drm_fb_helper.c | 26 +++++---------------------
> >  1 file changed, 5 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> > index 8697554ccd41..c2f72bb6afb1 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -281,18 +281,12 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
> >  EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
> >
> >  #ifdef CONFIG_MAGIC_SYSRQ
> > -/*
> > - * restore fbcon display for all kms driver's using this helper, used for sysrq
> > - * and panic handling.
> > - */
> > -static bool drm_fb_helper_force_kernel_mode(void)
> > +/* emergency restore, don't bother with error reporting */
> > +static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
> >  {
> > -     bool ret, error = false;
> >       struct drm_fb_helper *helper;
> >
> > -     if (list_empty(&kernel_fb_helper_list))
> > -             return false;
> > -
> > +     mutex_lock(&kernel_fb_helper_lock);
> >       list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
> >               struct drm_device *dev = helper->dev;
> >
> > @@ -300,22 +294,12 @@ static bool drm_fb_helper_force_kernel_mode(void)
> >                       continue;
> >
> >               mutex_lock(&helper->lock);
> > -             ret = drm_client_modeset_commit_locked(&helper->client);
> > -             if (ret)
> > -                     error = true;
> > +             drm_client_modeset_commit_locked(&helper->client);
> >               mutex_unlock(&helper->lock);
> >       }
> > -     return error;
> > +     mutex_unlock(&kernel_fb_helper_lock);
> >  }
> >
> > -static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
> > -{
> > -     bool ret;
> > -
> > -     ret = drm_fb_helper_force_kernel_mode();
> > -     if (ret == true)
> > -             DRM_ERROR("Failed to restore crtc configuration\n");
>
> Is there a specific reason for removing that warning? Even if it doesn't
> show up on screen, is it not helpful in the kernel's log?

I just found it really unhelpful, if you're trying to force-show
fbcon, what's the point if it doesn't work out? The user will notice.
Also, if we're really in a dire situation where you want this, in my
experience there's a bunch of random other reasons why this can fail,
mostly when the work we have to schedule for locking reasons never
runs. So it's also unreliable.

> In any case, the rest looks good.
>
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for taking a look, I'll apply it.
-Daniel

>
> Best regards
> Thomas
>
> > -}
> >  static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
> >
> >  static void drm_fb_helper_sysrq(int dummy1)
> >
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/fb-helper: Add locking to sysrq handling
@ 2020-10-08  9:29     ` Daniel Vetter
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2020-10-08  9:29 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: David Airlie, Intel Graphics Development, Maxime Ripard,
	DRI Development, Daniel Vetter

On Thu, Oct 8, 2020 at 11:22 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 07.10.20 um 15:30 schrieb Daniel Vetter:
> > We didn't take the kernel_fb_helper_lock mutex, which protects that
> > code. While at it, simplify the code
> > - inline the function (originally shared with kgdb I think)
> > - drop the error tracking and all the complications
> > - drop the pointless early out, it served nothing
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > ---
> >  drivers/gpu/drm/drm_fb_helper.c | 26 +++++---------------------
> >  1 file changed, 5 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> > index 8697554ccd41..c2f72bb6afb1 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -281,18 +281,12 @@ int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
> >  EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
> >
> >  #ifdef CONFIG_MAGIC_SYSRQ
> > -/*
> > - * restore fbcon display for all kms driver's using this helper, used for sysrq
> > - * and panic handling.
> > - */
> > -static bool drm_fb_helper_force_kernel_mode(void)
> > +/* emergency restore, don't bother with error reporting */
> > +static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
> >  {
> > -     bool ret, error = false;
> >       struct drm_fb_helper *helper;
> >
> > -     if (list_empty(&kernel_fb_helper_list))
> > -             return false;
> > -
> > +     mutex_lock(&kernel_fb_helper_lock);
> >       list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
> >               struct drm_device *dev = helper->dev;
> >
> > @@ -300,22 +294,12 @@ static bool drm_fb_helper_force_kernel_mode(void)
> >                       continue;
> >
> >               mutex_lock(&helper->lock);
> > -             ret = drm_client_modeset_commit_locked(&helper->client);
> > -             if (ret)
> > -                     error = true;
> > +             drm_client_modeset_commit_locked(&helper->client);
> >               mutex_unlock(&helper->lock);
> >       }
> > -     return error;
> > +     mutex_unlock(&kernel_fb_helper_lock);
> >  }
> >
> > -static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
> > -{
> > -     bool ret;
> > -
> > -     ret = drm_fb_helper_force_kernel_mode();
> > -     if (ret == true)
> > -             DRM_ERROR("Failed to restore crtc configuration\n");
>
> Is there a specific reason for removing that warning? Even if it doesn't
> show up on screen, is it not helpful in the kernel's log?

I just found it really unhelpful, if you're trying to force-show
fbcon, what's the point if it doesn't work out? The user will notice.
Also, if we're really in a dire situation where you want this, in my
experience there's a bunch of random other reasons why this can fail,
mostly when the work we have to schedule for locking reasons never
runs. So it's also unreliable.

> In any case, the rest looks good.
>
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for taking a look, I'll apply it.
-Daniel

>
> Best regards
> Thomas
>
> > -}
> >  static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
> >
> >  static void drm_fb_helper_sysrq(int dummy1)
> >
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-08  9:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 13:30 [PATCH] drm/fb-helper: Add locking to sysrq handling Daniel Vetter
2020-10-07 13:30 ` [Intel-gfx] " Daniel Vetter
2020-10-07 13:41 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2020-10-07 14:03 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-10-08  9:22 ` [PATCH] " Thomas Zimmermann
2020-10-08  9:22   ` [Intel-gfx] " Thomas Zimmermann
2020-10-08  9:29   ` Daniel Vetter
2020-10-08  9:29     ` [Intel-gfx] " Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.