drm/fb-helper: Add locking to sysrq handling
Subsystems (2)
PATCH 1/1 drm/fb-helper: Add locking to sysrq handling
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
--- drivers/gpu/drm/drm_fb_helper.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +5 -21
@@ -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)
Signature · 6 lines
2.28.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/fb-helper: Add locking to sysrq handling
== Series Details ==
== 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 <[email protected]>'
total: 0 errors, 1 warnings, 0 checks, 45 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for drm/fb-helper: Add locking to sysrq handling
In reply to Daniel Vetter== Series Details ==
== 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@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-tgl-u2/igt@[email protected]
* 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@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-icl-u2/igt@kms_flip@[email protected]
#### 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@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-byt-j1900/igt@[email protected]
- 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@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-bsw-kefka/igt@[email protected]
* 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@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-apl-guc/igt@[email protected]
* 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@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-tgl-dsi/igt@kms_busy@[email protected]
* 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@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-icl-u2/igt@kms_flip@[email protected]
#### 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@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-kbl-x1275/igt@[email protected]
* 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@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-kbl-x1275/igt@[email protected]
- 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@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-skl-6700k2/igt@[email protected]
* 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@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-kbl-x1275/igt@[email protected]
* 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@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18647/fi-kbl-x1275/igt@[email protected]
{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
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi
Am 07.10.20 um 15:30 schrieb Daniel Vetter:
Quoted 53 lines
We didn't take the
kernel_fb_helper_lockmutex, 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 nothingSigned-off-by Daniel Vetter <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-)drivers/gpu/drm/drm_fb_helper.c +4
-13@@ -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;
drivers/gpu/drm/drm_fb_helper.c static bool drm_fb_helper_force_kernel_mode(void) · line 317
Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c +1
-7+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.
Best regards
Thomas
Quoted 5 lines
drivers/gpu/drm/drm_fb_helper.c +0
-1-} static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);static void drm_fb_helper_sysrq (int dummy1)
Signature · 6 lines
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
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 60 lines · Thomas Zimmermann
Hi
Am 07.10.20 um 15:30 schrieb Daniel Vetter:
Quoted 56 lines
We didn't take the
kernel_fb_helper_lockmutex, 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 nothingSigned-off-by Daniel Vetter <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-)drivers/gpu/drm/drm_fb_helper.c +5
-13@@ -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); }
Quoted 10 lines
drivers/gpu/drm/drm_fb_helper.c static bool drm_fb_helper_force_kernel_mode(void) · line 317
Quoted 7 lines
drivers/gpu/drm/drm_fb_helper.c +0
-7-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.
Quoted 3 lines
In any case, the rest looks good.
Thanks for taking a look, I'll apply it.
-Daniel
Quoted 18 lines
Best regards
Thomasdrivers/gpu/drm/drm_fb_helper.c static bool drm_fb_helper_force_kernel_mode(void) · line 305
Quoted 5 lines
drivers/gpu/drm/drm_fb_helper.c +0
-1-} 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
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel