drm/panic: Remove build time dependency with FRAMEBUFFER_CONSOLE
Subsystems (6)
Jocelyn Falempe
maintainercover drm/panic: Remove build time dependency with FRAMEBUFFER_CONSOLE
When proposing to enable DRM_PANIC on Fedora, some users raised concern about the need to disable VT_CONSOLE.
So this is my new attempt to avoid fbcon/vt_console to overwrite the panic screen.
This time it doesn't involve any locking, so it should be safe.
I added a skip_panic option in struct fb_info, and check if this option and the panic_cpu are set in fb_is_inactive(), to prevent any framebuffer operation. Also skip_panic is only true if the drm driver supports drm_panic, so you will still get the VT panic info on drivers that don't have drm_panic support yet.
Jocelyn Falempe (3):
drm/panic: Add drm_panic_is_enabled()
fbcon: Add an option to disable fbcon in panic. drm/panic: Remove build time dependency with FRAMEBUFFER_CONSOLE
drivers/gpu/drm/Kconfig | 2 +- drivers/gpu/drm/drm_fb_helper.c | 2 ++ drivers/gpu/drm/drm_panic.c | 20 ++++++++++++++++++++ drivers/video/fbdev/core/fbcon.c | 7 ++++++- include/drm/drm_panic.h | 2 ++ include/linux/fb.h | 1 + 6 files changed, 32 insertions(+), 2 deletions(-)
base-commit: a237f217bad50c381773da5b00442710d1449098
Signature · 1 line
2.45.2
Jocelyn Falempe
maintainerPATCH 1/3 drm/panic: Add drm_panic_is_enabled()
It allows to check if the drm device supports drm_panic. Prepare the work to have better integration with fbcon and vtconsole.
--- drivers/gpu/drm/drm_panic.c | 20 ++++++++++++++++++++ include/drm/drm_panic.h | 2 ++ 2 files changed, 22 insertions(+)
drivers/gpu/drm/drm_panic.c +20 -0
@@ -703,6 +703,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index)static void debugfs_register_plane (struct drm_plane *plane,int index) {}#endif /* CONFIG_DRM_PANIC_DEBUG */ +/** +* drm_panic_is_enabled +* @dev: the drm device that may supports drm_panic +* +* returns true if the drm device supports drm_panic +*/ +bool drm_panic_is_enabled (struct drm_device *dev) +{ +struct drm_plane *plane; + +if (!dev->mode_config.num_total_plane) +return false; + +drm_for_each_plane (plane, dev) +if (plane->helper_private && plane->helper_private->get_scanout_buffer) +return true; +return false; +} +EXPORT_SYMBOL (drm_panic_is_enabled); +/** * drm_panic_register() - Initialize DRM panic for a device * @dev: the drm device on which the panic screen will be displayed.
include/drm/drm_panic.h +2 -0
@@ -148,11 +148,13 @@ struct drm_scanout_buffer {#ifdef CONFIG_DRM_PANIC +bool drm_panic_is_enabled (struct drm_device *dev);void drm_panic_register (struct drm_device *dev);void drm_panic_unregister (struct drm_device *dev);#else +bool drm_panic_is_enabled (struct drm_device *dev) {return false; }static inline void drm_panic_register (struct drm_device *dev) {}static inline void drm_panic_unregister (struct drm_device *dev) {}
Signature · 1 line
2.45.2
Re: [PATCH 1/3] drm/panic: Add drm_panic_is_enabled()
Jocelyn Falempe <[email protected]> writes:
Hello Jocelyn,
Quoted 27 lines
It allows to check if the drm device supports
drm_panic. Prepare the work to have better integration with fbcon and vtconsole.Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/drm_panic.c | 20 ++++++++++++++++++++ include/drm/drm_panic.h | 2 ++ 2 files changed, 22 insertions(+)drivers/gpu/drm/drm_panic.c +10
-0@@ -703,6 +703,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index)static void debugfs_register_plane (struct drm_plane *plane,int index) {}#endif /* CONFIG_DRM_PANIC_DEBUG */ +/** +* drm_panic_is_enabled +* @dev: the drm device that may supports drm_panic +* +* returns true if the drm device supports drm_panic +*/ +bool drm_panic_is_enabled (struct drm_device *dev) +{ +struct drm_plane *plane; +
drivers/gpu/drm/drm_panic.c static void debugfs_register_plane(struct drm_plane *plane, int index) · line 725
Quoted 10 lines
drivers/gpu/drm/drm_panic.c +10
-0+if (!dev->mode_config.num_total_plane) +return false; + +drm_for_each_plane (plane, dev) +if (plane->helper_private && plane->helper_private->get_scanout_buffer) +return true; +return false; +} +EXPORT_SYMBOL (drm_panic_is_enabled); +
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 1/3] drm/panic: Add drm_panic_is_enabled()
In reply to Jocelyn FalempeQuoted 26 lines · Jocelyn Falempe
It allows to check if the drm device supports
drm_panic. Prepare the work to have better integration with fbcon and vtconsole.Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/drm_panic.c | 20 ++++++++++++++++++++ include/drm/drm_panic.h | 2 ++ 2 files changed, 22 insertions(+)drivers/gpu/drm/drm_panic.c +9
-0@@ -703,6 +703,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index)static void debugfs_register_plane (struct drm_plane *plane,int index) {}#endif /* CONFIG_DRM_PANIC_DEBUG */ +/** +* drm_panic_is_enabled +* @dev: the drm device that may supports drm_panic +* +* returns true if the drm device supports drm_panic +*/ +bool drm_panic_is_enabled (struct drm_device *dev) +{ +struct drm_plane *plane;
drivers/gpu/drm/drm_panic.c static void debugfs_register_plane(struct drm_plane *plane, int index) · line 724
Quoted 10 lines
drivers/gpu/drm/drm_panic.c +10
-0+ +if (!dev->mode_config.num_total_plane) +return false; + +drm_for_each_plane (plane, dev) +if (plane->helper_private && plane->helper_private->get_scanout_buffer) +return true; +return false; +} +EXPORT_SYMBOL (drm_panic_is_enabled);
This feels like overkill since you currently only have one user in the fbdev emulation code, but maybe useful in some other places ...
include/drm/drm_panic.h struct drm_scanout_buffer { · line 151
Quoted 13 lines
drivers/gpu/drm/drm_panic.c +1
-0+/** * drm_panic_register() - Initialize DRM panic for a device * @dev: the drm device on which the panic screen will be displayed. include/drm/drm_panic.h +1
-0@@ -148,11 +148,13 @@ struct drm_scanout_buffer {#ifdef CONFIG_DRM_PANIC +bool drm_panic_is_enabled (struct drm_device *dev);
Since it's internal only, this should be in drivers/gpu/drm/drm_crtc_internal.h and not int he include for drivers. With that:
include/drm/drm_panic.h struct drm_scanout_buffer { · line 153
Quoted 2 lines
include/drm/drm_panic.h +0
-0void drm_panic_register (struct drm_device *dev);void drm_panic_unregister (struct drm_device *dev);
These two are only used in drm.ko. Can you please move them to drm_crtc_internal.h too and drop the EXPORT_SYMBOL in a follow-up patch? We're trying to limit the exported interface and official headers to really only the pieces drivers actually need.
Thanks, Sima
Quoted 10 lines
include/drm/drm_panic.h +1
-0#else +bool drm_panic_is_enabled (struct drm_device *dev) {return false; }static inline void drm_panic_register (struct drm_device *dev) {}static inline void drm_panic_unregister (struct drm_device *dev) {}Signature · 1 line
2.45.2
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Jocelyn Falempe
maintainerRe: [PATCH 1/3] drm/panic: Add drm_panic_is_enabled()
Quoted 51 lines · Daniel Vetter
Quoted 26 lines · Jocelyn Falempe
It allows to check if the drm device supports
drm_panic. Prepare the work to have better integration with fbcon and vtconsole.Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/drm_panic.c | 20 ++++++++++++++++++++ include/drm/drm_panic.h | 2 ++ 2 files changed, 22 insertions(+)drivers/gpu/drm/drm_panic.c +9
-0@@ -703,6 +703,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index)static void debugfs_register_plane (struct drm_plane *plane,int index) {}#endif /* CONFIG_DRM_PANIC_DEBUG */ +/** +* drm_panic_is_enabled +* @dev: the drm device that may supports drm_panic +* +* returns true if the drm device supports drm_panic +*/ +bool drm_panic_is_enabled (struct drm_device *dev) +{ +struct drm_plane *plane;drivers/gpu/drm/drm_panic.c static void debugfs_register_plane(struct drm_plane *plane, int index) · line 724
Quoted 10 lines
drivers/gpu/drm/drm_panic.c +10
-0+ +if (!dev->mode_config.num_total_plane) +return false; + +drm_for_each_plane (plane, dev) +if (plane->helper_private && plane->helper_private->get_scanout_buffer) +return true; +return false; +} +EXPORT_SYMBOL (drm_panic_is_enabled);This feels like overkill since you currently only have one user in the fbdev emulation code, but maybe useful in some other places ...
Quoted 10 lines
drivers/gpu/drm/drm_panic.c +1
-0+/** * drm_panic_register() - Initialize DRM panic for a device * @dev: the drm device on which the panic screen will be displayed. include/drm/drm_panic.h +0
-0@@ -148,11 +148,13 @@ struct drm_scanout_buffer {
Quoted 6 lines
include/drm/drm_panic.h struct drm_scanout_buffer { · line 151
Quoted 3 lines
include/drm/drm_panic.h +1
-0#ifdef CONFIG_DRM_PANIC +bool drm_panic_is_enabled (struct drm_device *dev);Since it's internal only, this should be in
drivers/gpu/drm/drm_crtc_internal.hand not int he include for drivers.
Yes, that makes sense, drivers won't need that API.
Quoted 11 lines
With that:
Reviewed-by Daniel Vetter <[email protected]>include/drm/drm_panic.h struct drm_scanout_buffer { · line 153
Quoted 2 lines
include/drm/drm_panic.h +0
-0void drm_panic_register (struct drm_device *dev);void drm_panic_unregister (struct drm_device *dev);These two are only used in drm.ko. Can you please move them to
drm_crtc_internal.htoo and drop theEXPORT_SYMBOLin a follow-up patch? We're trying to limit the exported interface and official headers to really only the pieces drivers actually need.
Sure, I'll add this to my next drm_panic series.
Quoted 14 lines
Thanks, Sima
Quoted 10 lines
include/drm/drm_panic.h +1
-0#else +bool drm_panic_is_enabled (struct drm_device *dev) {return false; }static inline void drm_panic_register (struct drm_device *dev) {}static inline void drm_panic_unregister (struct drm_device *dev) {}Signature · 1 line
2.45.2
Best regards,
Signature · 1 line
Jocelyn
Jocelyn Falempe
maintainerRe: [PATCH 1/3] drm/panic: Add drm_panic_is_enabled()
Quoted 69 lines · Jocelyn Falempe
Quoted 42 lines · Daniel Vetter
Quoted 27 lines · Jocelyn Falempe
It allows to check if the drm device supports
drm_panic. Prepare the work to have better integration with fbcon and vtconsole.Signed-off-by Jocelyn Falempe <[email protected]>---
drivers/gpu/drm/drm_panic.c| 20 ++++++++++++++++++++ include/drm/drm_panic.h | 2 ++2 files changed, 22 insertions(+)drivers/gpu/drm/drm_panic.c +10
-0@@ -703,6 +703,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index) static void debugfs_register_plane(struct drm_plane *plane, int index) {} #endif /* CONFIG_DRM_PANIC_DEBUG */ +/** +* drm_panic_is_enabled +* @dev: the drm device that may supports drm_panic +* +* returns true if the drm device supports drm_panic +*/ +bool drm_panic_is_enabled (struct drm_device *dev) +{ + struct drm_plane *plane; +drivers/gpu/drm/drm_panic.c static void debugfs_register_plane(struct · line 725
Quoted 10 lines
drivers/gpu/drm/drm_panic.c +9
-0+ if (!dev->mode_config.num_total_plane) + return false; + + drm_for_each_plane(plane, dev) + if (plane->helper_private && plane->helper_private->get_scanout_buffer) + return true; + return false; +} +EXPORT_SYMBOL (drm_panic_is_enabled);This feels like overkill since you currently only have one user in the fbdev emulation code, but maybe useful in some other places ...
Quoted 14 lines
include/drm/drm_panic.h struct drm_scanout_buffer { · line 149
Quoted 11 lines
drivers/gpu/drm/drm_panic.c +1
-0+ /*** drm_panic_register() - Initialize DRM panic for a device * @dev: the drm device on which the panic screen will be displayed.
include/drm/drm_panic.h +1
-0@@ -148,11 +148,13 @@ struct drm_scanout_buffer { #ifdef CONFIG_DRM_PANIC +bool drm_panic_is_enabled (struct drm_device *dev);Since it's internal only, this should be in
drivers/gpu/drm/drm_crtc_internal.hand not int he include for drivers.Yes, that makes sense, drivers won't need that API.
Quoted 7 lines
With that:
Reviewed-by Daniel Vetter <[email protected]>Quoted 2 lines
include/drm/drm_panic.h +0
-0void drm_panic_register(struct drm_device *dev); void drm_panic_unregister(struct drm_device *dev);
Quoted 6 lines
Quoted 4 lines
These two are only used in drm.ko. Can you please move them to
drm_crtc_internal.htoo and drop theEXPORT_SYMBOLin a follow-up patch? We're trying to limit the exported interface and official headers to really only the pieces drivers actually need.Sure, I'll add this to my next
drm_panicseries.
I think this also applies to drm_panic_init() and drm_panic_exit(), that I introduce in my QR code series:
https://patchwork.freedesktop.org/patch/604890/?series=135944&rev=2
I will move them to drm_crtc_internal.h
Quoted 15 lines
Quoted 12 lines
Thanks, Sima
Quoted 7 lines
include/drm/drm_panic.h +1
-0#else +bool drm_panic_is_enabled (struct drm_device *dev) {return false; } static inline void drm_panic_register(struct drm_device *dev) {} static inline void drm_panic_unregister(struct drm_device *dev) {}Signature · 1 line
2.45.2Best regards,
Re: [PATCH 1/3] drm/panic: Add drm_panic_is_enabled()
Quoted 78 lines · Jocelyn Falempe
Quoted 75 lines · Jocelyn Falempe
Quoted 43 lines · Daniel Vetter
Quoted 28 lines · Jocelyn Falempe
It allows to check if the drm device supports
drm_panic. Prepare the work to have better integration with fbcon and vtconsole.Signed-off-by Jocelyn Falempe <[email protected]>---
drivers/gpu/drm/drm_panic.c| 20 ++++++++++++++++++++ include/drm/drm_panic.h | 2 ++2 files changed, 22 insertions(+)drivers/gpu/drm/drm_panic.c +10
-0@@ -703,6 +703,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index) static void debugfs_register_plane(struct drm_plane *plane, int index) {} #endif /* CONFIG_DRM_PANIC_DEBUG */ +/** +* drm_panic_is_enabled +* @dev: the drm device that may supports drm_panic +* +* returns true if the drm device supports drm_panic +*/ +bool drm_panic_is_enabled (struct drm_device *dev) +{ + struct drm_plane *plane; +drivers/gpu/drm/drm_panic.c static void debugfs_register_plane(struct · line 726
Quoted 10 lines
drivers/gpu/drm/drm_panic.c +9
-0+ if (!dev->mode_config.num_total_plane) + return false; + + drm_for_each_plane(plane, dev) + if (plane->helper_private && plane->helper_private->get_scanout_buffer) + return true; + return false; +} +EXPORT_SYMBOL (drm_panic_is_enabled);This feels like overkill since you currently only have one user in the fbdev emulation code, but maybe useful in some other places ...
Quoted 14 lines
include/drm/drm_panic.h struct drm_scanout_buffer { · line 149
Quoted 11 lines
drivers/gpu/drm/drm_panic.c +1
-0+ /***
drm_panic_register()- Initialize DRM panic for a device
* @dev: the drm device on which the panic screen will be displayed.include/drm/drm_panic.h +1
-0@@ -148,11 +148,13 @@ struct drm_scanout_buffer { #ifdef CONFIG_DRM_PANIC +bool drm_panic_is_enabled (struct drm_device *dev);Since it's internal only, this should be in
drivers/gpu/drm/drm_crtc_internal.hand not int he include for drivers.Yes, that makes sense, drivers won't need that API.
Quoted 11 lines
With that:
Reviewed-by Daniel Vetter <[email protected]>include/drm/drm_panic.h struct drm_scanout_buffer { · line 153
Quoted 2 lines
include/drm/drm_panic.h +0
-0void drm_panic_register(struct drm_device *dev); void drm_panic_unregister(struct drm_device *dev);These two are only used in drm.ko. Can you please move them to
drm_crtc_internal.htoo and drop theEXPORT_SYMBOLin a follow-up patch? We're trying to limit the exported interface and official headers to really only the pieces drivers actually need.
Quoted 6 lines
Quoted 1 line
Sure, I'll add this to my next
drm_panicseries.I think this also applies to
drm_panic_init()anddrm_panic_exit(), that I introduce in my QR code series:
https://patchwork.freedesktop.org/patch/604890/?series=135944&rev=2
I will move them todrm_crtc_internal.h
Yup.
-Sima
Quoted 17 lines
Quoted 16 lines
Quoted 13 lines
Thanks, Sima
Quoted 7 lines
include/drm/drm_panic.h +1
-0#else +bool drm_panic_is_enabled (struct drm_device *dev) {return false; } static inline void drm_panic_register(struct drm_device *dev) {} static inline void drm_panic_unregister(struct drm_device *dev) {}Signature · 1 line
2.45.2Best regards,
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH 1/3] drm/panic: Add drm_panic_is_enabled()
In reply to Jocelyn FalempeHi,
Quoted 45 lines · Jocelyn Falempe
It allows to check if the drm device supports
drm_panic. Prepare the work to have better integration with fbcon and vtconsole.Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/drm_panic.c | 20 ++++++++++++++++++++ include/drm/drm_panic.h | 2 ++ 2 files changed, 22 insertions(+)drivers/gpu/drm/drm_panic.c +20
-0@@ -703,6 +703,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index)static void debugfs_register_plane (struct drm_plane *plane,int index) {}#endif /* CONFIG_DRM_PANIC_DEBUG */ +/** +* drm_panic_is_enabled +* @dev: the drm device that may supports drm_panic +* +* returns true if the drm device supports drm_panic +*/ +bool drm_panic_is_enabled (struct drm_device *dev) +{ +struct drm_plane *plane; + +if (!dev->mode_config.num_total_plane) +return false; + +drm_for_each_plane (plane, dev) +if (plane->helper_private && plane->helper_private->get_scanout_buffer) +return true; +return false; +} +EXPORT_SYMBOL (drm_panic_is_enabled); +/** * drm_panic_register() - Initialize DRM panic for a device * @dev: the drm device on which the panic screen will be displayed. include/drm/drm_panic.h +0
-0
include/drm/drm_panic.h struct drm_scanout_buffer { · line 157
Quoted 10 lines
include/drm/drm_panic.h +2
-0@@ -148,11 +148,13 @@ struct drm_scanout_buffer {#ifdef CONFIG_DRM_PANIC +bool drm_panic_is_enabled (struct drm_device *dev);void drm_panic_register (struct drm_device *dev);void drm_panic_unregister (struct drm_device *dev);#else +bool drm_panic_is_enabled (struct drm_device *dev) {return false; }
This was moved to drivers/gpu/drm/drm_crtc_internal.h in the applied version and I can't find that version on the mailing list; imo this kind of change requires a resend.
Also, the above breaks CONFIG_DRM_PANIC=n builds:
In file included from drivers/gpu/drm/drm_atomic_uapi.c:43:drivers/gpu/drm/drm_crtc_internal.h:322:6: error: no previous prototype for ‘drm_panic_is_enabled’ [-Werror=missing-prototypes]
322 | bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
Stubs like the above must be an inline function.
Quoted 6 lines
include/drm/drm_panic.h +0
-0static inline void drm_panic_register (struct drm_device *dev) {}static inline void drm_panic_unregister (struct drm_device *dev) {}Signature · 1 line
2.45.2
Jocelyn Falempe
maintainerRe: [PATCH 1/3] drm/panic: Add drm_panic_is_enabled()
Quoted 55 lines · Imre Deak
Hi,
Quoted 52 lines · Jocelyn Falempe
It allows to check if the drm device supports
drm_panic. Prepare the work to have better integration with fbcon and vtconsole.Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/drm_panic.c | 20 ++++++++++++++++++++ include/drm/drm_panic.h | 2 ++ 2 files changed, 22 insertions(+)drivers/gpu/drm/drm_panic.c +20
-0@@ -703,6 +703,26 @@ static void debugfs_register_plane(struct drm_plane *plane, int index)static void debugfs_register_plane (struct drm_plane *plane,int index) {}#endif /* CONFIG_DRM_PANIC_DEBUG */ +/** +* drm_panic_is_enabled +* @dev: the drm device that may supports drm_panic +* +* returns true if the drm device supports drm_panic +*/ +bool drm_panic_is_enabled (struct drm_device *dev) +{ +struct drm_plane *plane; + +if (!dev->mode_config.num_total_plane) +return false; + +drm_for_each_plane (plane, dev) +if (plane->helper_private && plane->helper_private->get_scanout_buffer) +return true; +return false; +} +EXPORT_SYMBOL (drm_panic_is_enabled); +/** * drm_panic_register() - Initialize DRM panic for a device * @dev: the drm device on which the panic screen will be displayed. include/drm/drm_panic.h +1
-0@@ -148,11 +148,13 @@ struct drm_scanout_buffer {#ifdef CONFIG_DRM_PANIC +bool drm_panic_is_enabled (struct drm_device *dev);void drm_panic_register (struct drm_device *dev);void drm_panic_unregister (struct drm_device *dev);
Quoted 7 lines
include/drm/drm_panic.h struct drm_scanout_buffer { · line 157
Quoted 3 lines
include/drm/drm_panic.h +1
-0#else +bool drm_panic_is_enabled (struct drm_device *dev) {return false; }This was moved to
drivers/gpu/drm/drm_crtc_internal.hin the applied version and I can't find that version on the mailing list; imo this kind of change requires a resend.
Sorry, I though that was a minor change, but I messed it up.
Yes sending to the mailing list also triggers the CI, and checks for simple errors like this, I will send a fix shortly.
Quoted 16 lines
Also, the above breaks
CONFIG_DRM_PANIC=nbuilds:In file included from
drivers/gpu/drm/drm_atomic_uapi.c:43:drivers/gpu/drm/drm_crtc_internal.h:322:6: error: no previous prototype for ‘drm_panic_is_enabled’ [-Werror=missing-prototypes]
322 | booldrm_panic_is_enabled(struct drm_device *dev){return false; }Stubs like the above must be an inline function.
Quoted 6 lines
include/drm/drm_panic.h +0
-0static inline void drm_panic_register (struct drm_device *dev) {}static inline void drm_panic_unregister (struct drm_device *dev) {}Signature · 1 line
2.45.2
Jocelyn Falempe
maintainerPATCH 2/3 fbcon: Add an option to disable fbcon in panic.
In reply to Jocelyn FalempeThis is required to avoid conflict between DRM_PANIC, and fbcon. If a drm device already handle panic with drm_panic, it should set the skip_panic field in fb_info, so that fbcon will stay quiet, and not overwrite the panic_screen.
--- drivers/gpu/drm/drm_fb_helper.c | 2 ++ drivers/video/fbdev/core/fbcon.c | 7 ++++++- include/linux/fb.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +2 -0
@@ -40,6 +40,7 @@#include <drm/drm_fourcc.h> #include <drm/drm_framebuffer.h> #include <drm/drm_modeset_helper_vtables.h> +#include <drm/drm_panic.h> #include <drm/drm_print.h> #include <drm/drm_vblank.h>
@@ -524,6 +525,7 @@ struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper) fb_helper->info = info; info->skip_vt_switch = true; + info->skip_panic =drm_panic_is_enabled (fb_helper->dev);return info; err_release:
drivers/video/fbdev/core/fbcon.c +6 -1
@@ -270,12 +270,17 @@ static int fbcon_get_rotate(struct fb_info *info)return (ops) ? ops->rotate :0 ; } +static bool fbcon_skip_panic (struct fb_info *info) +{ +return (info->skip_panic &&unlikely (atomic_read (&panic_cpu) !=PANIC_CPU_INVALID )); +} +static inline int fbcon_is_inactive (struct vc_data *vc,struct fb_info *info) {struct fbcon_ops *ops = info->fbcon_par;return (info->state !=FBINFO_STATE_RUNNING || - vc->vc_mode !=KD_TEXT || ops->graphics); + vc->vc_mode !=KD_TEXT || ops->graphics ||fbcon_skip_panic (info)); } static int get_color(struct vc_data *vc, struct fb_info *info,
include/linux/fb.h +1 -0
@@ -510,6 +510,7 @@ struct fb_info {void *par;bool skip_vt_switch;/* no VT switch on suspend/resume required */ +bool skip_panic;/* Do not write to the fb after a panic */ };/* This will go away
Signature · 1 line
2.45.2
Re: [PATCH 2/3] fbcon: Add an option to disable fbcon in panic.
Quoted 7 lines · Jocelyn Falempe
This is required to avoid conflict between
DRM_PANIC, and fbcon. If a drm device already handle panic withdrm_panic, it should set theskip_panicfield infb_info, so that fbcon will stay quiet, and not overwrite thepanic_screen.Signed-off-by Jocelyn Falempe <[email protected]>---
This makes sense to me as well.
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 2/3] fbcon: Add an option to disable fbcon in panic.
In reply to Jocelyn FalempeQuoted 25 lines · Jocelyn Falempe
This is required to avoid conflict between
DRM_PANIC, and fbcon. If a drm device already handle panic withdrm_panic, it should set theskip_panicfield infb_info, so that fbcon will stay quiet, and not overwrite thepanic_screen.Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 2 ++ drivers/video/fbdev/core/fbcon.c | 7 ++++++- include/linux/fb.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_fb_helper.c +1
-0@@ -40,6 +40,7 @@#include <drm/drm_fourcc.h> #include <drm/drm_framebuffer.h> #include <drm/drm_modeset_helper_vtables.h> +#include <drm/drm_panic.h> #include <drm/drm_print.h> #include <drm/drm_vblank.h>
drivers/gpu/drm/drm_fb_helper.c struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper) · line 531
Quoted 7 lines
drivers/gpu/drm/drm_fb_helper.c +1
-0@@ -524,6 +525,7 @@ struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper) fb_helper->info = info; info->skip_vt_switch = true; + info->skip_panic =drm_panic_is_enabled (fb_helper->dev);return info; err_release:
Bit a bikeshed, but I'd split this patch out since it's for drm's fbdev emulation, not the fbcon core code. With that:
Quoted 38 lines
drivers/video/fbdev/core/fbcon.c +6
-1@@ -270,12 +270,17 @@ static int fbcon_get_rotate(struct fb_info *info)return (ops) ? ops->rotate :0 ; } +static bool fbcon_skip_panic (struct fb_info *info) +{ +return (info->skip_panic &&unlikely (atomic_read (&panic_cpu) !=PANIC_CPU_INVALID )); +} +static inline int fbcon_is_inactive (struct vc_data *vc,struct fb_info *info) {struct fbcon_ops *ops = info->fbcon_par;return (info->state !=FBINFO_STATE_RUNNING || - vc->vc_mode !=KD_TEXT || ops->graphics); + vc->vc_mode !=KD_TEXT || ops->graphics ||fbcon_skip_panic (info)); } static int get_color(struct vc_data *vc, struct fb_info *info,include/linux/fb.h +1
-0@@ -510,6 +510,7 @@ struct fb_info {void *par;bool skip_vt_switch;/* no VT switch on suspend/resume required */ +bool skip_panic;/* Do not write to the fb after a panic */ };/* This will go away Signature · 1 line
2.45.2
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Jocelyn Falempe
maintainerRe: [PATCH 2/3] fbcon: Add an option to disable fbcon in panic.
Quoted 32 lines · Daniel Vetter
Quoted 31 lines · Jocelyn Falempe
This is required to avoid conflict between
DRM_PANIC, and fbcon. If a drm device already handle panic withdrm_panic, it should set theskip_panicfield infb_info, so that fbcon will stay quiet, and not overwrite thepanic_screen.Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 2 ++ drivers/video/fbdev/core/fbcon.c | 7 ++++++- include/linux/fb.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_fb_helper.c +2
-0@@ -40,6 +40,7 @@#include <drm/drm_fourcc.h> #include <drm/drm_framebuffer.h> #include <drm/drm_modeset_helper_vtables.h> +#include <drm/drm_panic.h> #include <drm/drm_print.h> #include <drm/drm_vblank.h> @@ -524,6 +525,7 @@ struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper) fb_helper->info = info; info->skip_vt_switch = true; + info->skip_panic =drm_panic_is_enabled (fb_helper->dev);return info;
Quoted 6 lines
drivers/gpu/drm/drm_fb_helper.c struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper) · line 531
Quoted 1 line
drivers/gpu/drm/drm_fb_helper.c +0
-0err_release:Bit a bikeshed, but I'd split this patch out since it's for drm's fbdev emulation, not the fbcon core code. With that:
Reviewed-by Daniel Vetter <[email protected]>
Agreed, I considered doing that when writing the patch, but as it was 1 line, I kept it with the fbcon change.
Thanks,
Signature · 1 line
Jocelyn
Quoted 1 line
Jocelyn Falempe
maintainerPATCH 3/3 drm/panic: Remove build time dependency with FRAMEBUFFER_CONSOLE
In reply to Jocelyn FalempeNow that fbcon has the skip_panic option, there is no more conflicts between drm_panic and fbcon.
Remove the build time dependency, so they can be both enabled.
--- drivers/gpu/drm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/Kconfig +1 -1
@@ -107,7 +107,7 @@ config DRM_KMS_HELPER config DRM_PANIC bool "Display a user-friendly message when a kernel panic occurs" - depends on DRM && !(FRAMEBUFFER_CONSOLE && VT_CONSOLE) + depends on DRM select FONT_SUPPORT help Enable a drm panic handler, which will display a user-friendly message
Signature · 1 line
2.45.2
Quoted 14 lines · Jocelyn Falempe
Now that fbcon has the
skip_panicoption, there is no more conflicts betweendrm_panicand fbcon.
Remove the build time dependency, so they can be both enabled.Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/Kconfig +0
-0
drivers/gpu/drm/Kconfig config DRM_KMS_HELPER · line 110
Quoted 5 lines
drivers/gpu/drm/Kconfig +1
-1@@ -107,7 +107,7 @@ config DRM_KMS_HELPER config DRM_PANIC bool "Display a user-friendly message when a kernel panic occurs" - depends on DRM && !(FRAMEBUFFER_CONSOLE && VT_CONSOLE) + depends on DRM
This is great. Thanks for finding an alternative approach! I don't see any issues this time, because there is no locking involved. But let's see what others think about it.
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Daniel Vetter
Reviewed-byQuoted 17 lines · Javier Martinez Canillas
Quoted 15 lines · Jocelyn Falempe
Now that fbcon has the
skip_panicoption, there is no more conflicts betweendrm_panicand fbcon.
Remove the build time dependency, so they can be both enabled.Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/Kconfig +0
-0@@ -107,7 +107,7 @@ config DRM_KMS_HELPER
Quoted 8 lines
drivers/gpu/drm/Kconfig config DRM_KMS_HELPER · line 110
Quoted 4 lines
drivers/gpu/drm/Kconfig +1
-1config DRM_PANIC bool "Display a user-friendly message when a kernel panic occurs" - depends on DRM && !(FRAMEBUFFER_CONSOLE && VT_CONSOLE) + depends on DRMThis is great. Thanks for finding an alternative approach! I don't see any issues this time, because there is no locking involved. But let's see what others think about it.
Looks like it should work, I did check the history of fbcon_is_active and we've used that to force/disable panic output for fbcon in the past. So I think it's the right tool.
Quoted 1 line
Reviewed-by Javier Martinez Canillas <[email protected]>
Cheers, Sima
Quoted 8 lines
Signature · 6 lines
-- Best regards, Javier Martinez Canillas Core Platforms Red Hat
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Jocelyn Falempe
maintainerQuoted 6 lines · Jocelyn Falempe
When proposing to enable
DRM_PANICon Fedora, some users raised concern about the need to disableVT_CONSOLE.
So this is my new attempt to avoid fbcon/vt_console to overwrite the panic screen.
This time it doesn't involve any locking, so it should be safe.
I added askip_panicoption in structfb_info, and check if this option and thepanic_cpuare set infb_is_inactive(), to prevent any framebuffer operation. Alsoskip_panicis only true if the drm driver supportsdrm_panic, so you will still get the VT panic info on drivers that don't havedrm_panicsupport yet.
Thanks all,
I've just pushed them to drm-misc-next, with the required changes. (splitting patch 2 in 2, and moving function prototype to drm_crtc_internal.h).
Best regards,
Signature · 1 line
Jocelyn
Quoted 15 lines
Jocelyn Falempe (3):
drm/panic: Adddrm_panic_is_enabled()
fbcon: Add an option to disable fbcon in panic. drm/panic: Remove build time dependency withFRAMEBUFFER_CONSOLEdrivers/gpu/drm/Kconfig | 2 +- drivers/gpu/drm/drm_fb_helper.c | 2 ++ drivers/gpu/drm/drm_panic.c | 20 ++++++++++++++++++++ drivers/video/fbdev/core/fbcon.c | 7 ++++++- include/drm/drm_panic.h | 2 ++ include/linux/fb.h | 1 + 6 files changed, 32 insertions(+), 2 deletions(-)base-commit:
a237f217bad50c381773da5b00442710d1449098