drm/amd/display: Make BREAK_TO_DEBUGGER() a debug print
Subsystems (3)
PATCH 1/1 drm/amd/display: Make BREAK_TO_DEBUGGER() a debug print
[Why]
Warnings in the kernel are generally treated as errors.
The BREAK_TO_DEBUGGER macro is not a critical error or warning, but rather intended for developer use to help investigate behavior and sequences for other issues.
We do still make use of DC_ERROR/ASSERT(0) in various places in the code for things that are genuine issues.
Since most developers don't actually KGDB while debugging the kernel these essentially would have no value on their own since the KGDB breakpoint wouldn't trigger - ASSERT(0) was used as a shortcut to get a stacktrace.
[How]
Turn it into a DRM_DEBUG_DRIVER print instead. We unfortunately lose the stacktrace, but we still do retain some of the useful debug information this offers by having at least the function and line number loggable.
If KGDB is supported in the kernel this will still trigger a real breakpoint as well.
--- drivers/gpu/drm/amd/display/dc/os_types.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/os_types.h +9 -1
@@ -111,7 +111,15 @@#define ASSERT (expr) WARN_ON_ONCE(!(expr))#endif -#define BREAK_TO_DEBUGGER () ASSERT(0) +#if defined(CONFIG_HAVE_KGDB ) || defined(CONFIG_KGDB ) +#define BREAK_TO_DEBUGGER () \ + do { \ + DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__); \ + kgdb_breakpoint(); \ + } while (0) +#else +#define BREAK_TO_DEBUGGER () DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__) +#endif #define DC_ERR (...) do { \ dm_error(__VA_ARGS__); \
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 21 lines · Nicholas Kazlauskas
[Why]
Warnings in the kernel are generally treated as errors.The
BREAK_TO_DEBUGGERmacro is not a critical error or warning, but rather intended for developer use to help investigate behavior and sequences for other issues.We do still make use of DC_ERROR/ASSERT(0) in various places in the code for things that are genuine issues.
Since most developers don't actually KGDB while debugging the kernel these essentially would have no value on their own since the KGDB breakpoint wouldn't trigger - ASSERT(0) was used as a shortcut to get a stacktrace.
[How]
Turn it into aDRM_DEBUG_DRIVERprint instead. We unfortunately lose the stacktrace, but we still do retain some of the useful debug information this offers by having at least the function and line number loggable.
Quoted 8 lines
If KGDB is supported in the kernel this will still trigger a real breakpoint as well.
Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc Rodrigo Siqueira <[email protected]>Signed-off-by Nicholas Kazlauskas <[email protected]>
Harry
Quoted 16 lines
--- drivers/gpu/drm/amd/display/dc/os_types.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/os_types.h +2
-1@@ -111,7 +111,15 @@#define ASSERT (expr) WARN_ON_ONCE(!(expr))#endif -#define BREAK_TO_DEBUGGER () ASSERT(0) +#if defined(CONFIG_HAVE_KGDB ) || defined(CONFIG_KGDB ) +#define BREAK_TO_DEBUGGER () \
drivers/gpu/drm/amd/display/dc/os_types.h line 125
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/os_types.h +7
-0+do { \ +DRM_DEBUG_DRIVER ("%s():%d\n" , __func__, __LINE__); \ +kgdb_breakpoint (); \ + } while (0) +#else +#define BREAK_TO_DEBUGGER () DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__) +#endif #define DC_ERR (...) do { \ dm_error(__VA_ARGS__); \
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 15 lines · Nicholas Kazlauskas
[Why]
Warnings in the kernel are generally treated as errors.The
BREAK_TO_DEBUGGERmacro is not a critical error or warning, but rather intended for developer use to help investigate behavior and sequences for other issues.We do still make use of DC_ERROR/ASSERT(0) in various places in the code for things that are genuine issues.
Since most developers don't actually KGDB while debugging the kernel these essentially would have no value on their own since the KGDB breakpoint wouldn't trigger - ASSERT(0) was used as a shortcut to get a stacktrace.
Quoted 8 lines
[How]
Turn it into aDRM_DEBUG_DRIVERprint instead. We unfortunately lose the stacktrace, but we still do retain some of the useful debug information this offers by having at least the function and line number loggable.If KGDB is supported in the kernel this will still trigger a real breakpoint as well.
Not sure this makes sense now that WARN_ON_ONCE is used for ASSERT(). The name "BREAK_TO_DEBUGGER" implies that something unexpected happened which needs to be investigated, so having a backtrace seems important to me.
Signature · 6 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx