drm/amd/display: Fix kernel panic by breakpoint
Subsystems (3)
cover drm/amd/display: Fix kernel panic by breakpoint
Hi,
the amdgpu driver's ASSERT_CRITICAL() macro calls the kgdb_breakpoing() even if no debug option is set, and this leads to a kernel panic on distro kernels. The first two patches are the oneliner fixes for those, while the last one is the cleanup of those debug macros.
Takashi
===
Takashi Iwai (3):
drm/amd/display: Fix kernel panic by dal_gpio_open() error drm/amd/display: Don't invoke kgdb_breakpoint() unconditionally drm/amd/display: Clean up debug macros
drivers/gpu/drm/amd/display/Kconfig | 1 + drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c | 4 +-- drivers/gpu/drm/amd/display/dc/os_types.h | 33 +++++++++---------------- 3 files changed, 15 insertions(+), 23 deletions(-)
Signature · 6 lines
2.16.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/3 drm/amd/display: Fix kernel panic by dal_gpio_open() error
Currently both error code paths handled in dal_gpio_open_ex() issues ASSERT_CRITICAL(), and this leads to a kernel panic unnecessarily if CONFIG_KGDB is enabled. Since basically both are non-critical errors and can be recovered, drop those assert calls and use a safer one, BREAK_TO_DEBUGGER(), for allowing the debugging, instead.
--- drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c +2 -2
@@ -63,13 +63,13 @@ enum gpio_result dal_gpio_open_ex( enum gpio_mode mode) {if (gpio->pin) { -ASSERT_CRITICAL (false); +BREAK_TO_DEBUGGER ();return GPIO_RESULT_ALREADY_OPENED ; }// No action if allocation failed during gpio construct if (!gpio->hw_container.ddc) { -ASSERT_CRITICAL (false); +BREAK_TO_DEBUGGER ();return GPIO_RESULT_NON_SPECIFIC_ERROR ; } gpio->mode = mode;
Signature · 6 lines
2.16.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/3 drm/amd/display: Don't invoke kgdb_breakpoint() unconditionally
In reply to Takashi IwaiASSERT_CRITICAL() invokes kgdb_breakpoint() whenever either CONFIG_KGDB or CONFIG_HAVE_KGDB is set. This, however, may lead to a kernel panic when no kdb stuff is attached, since the kgdb_breakpoint() call issues INT3. It's nothing but a surprise for normal end-users.
For avoiding the pitfall, make the kgdb_breakpoint() call only when CONFIG_DEBUG_KERNEL_DC is set.
https://bugzilla.opensuse.org/show_bug.cgi?id=1177973
--- drivers/gpu/drm/amd/display/dc/os_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/os_types.h +1 -1
@@ -94,7 +94,7 @@* general debug capabilities * */ -#if defined(CONFIG_HAVE_KGDB ) || defined(CONFIG_KGDB ) +#if defined(CONFIG_DEBUG_KERNEL_DC ) && (defined(CONFIG_HAVE_KGDB ) || defined(CONFIG_KGDB ))#define ASSERT_CRITICAL (expr) do { \ if (WARN_ON(!(expr))) { \ kgdb_breakpoint(); \
Signature · 6 lines
2.16.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amd/display: Clean up debug macros
In reply to Takashi IwaiThis patch simplifies the ASSERT*() and BREAK_TO_DEBUGGER() macros:
- Move the dependency check of CONFIG_KGDB into Kconfig
- Unify the kgdb_breakpoint() call
- Drop the non-existing CONFIG_HAVE_KGDB
Also align the behavior of ASSERT() macro in both cases with and without CONFIG_DEBUG_KERNEL_DC.
--- drivers/gpu/drm/amd/display/Kconfig | 1 + drivers/gpu/drm/amd/display/dc/os_types.h | 33 +++++++++++-------------------- 2 files changed, 13 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/Kconfig +1 -0
@@ -42,6 +42,7 @@ config DRM_AMD_DC_SI config DEBUG_KERNEL_DC bool "Enable kgdb break in DC" depends on DRM_AMD_DC + depends on KGDB help Choose this option if you want to hit kdgb_break in assert.
drivers/gpu/drm/amd/display/dc/os_types.h +12 -21
@@ -94,36 +94,27 @@* general debug capabilities * */ -#if defined(CONFIG_DEBUG_KERNEL_DC ) && (defined(CONFIG_HAVE_KGDB ) || defined(CONFIG_KGDB )) -#define ASSERT_CRITICAL (expr) do { \ - if (WARN_ON(!(expr))) { \ - kgdb_breakpoint(); \ - } \ -} while (0) +#ifdef CONFIG_DEBUG_KERNEL_DC +#define dc_breakpoint () kgdb_breakpoint()#else -#define ASSERT_CRITICAL (expr) do { \ - if (WARN_ON(!(expr))) { \ - ; \ - } \ -} while (0) +#define dc_breakpoint () do {} while (0)#endif -#if defined(CONFIG_DEBUG_KERNEL_DC ) -#define ASSERT (expr) ASSERT_CRITICAL(expr) +#define ASSERT_CRITICAL (expr) do { \ + if (WARN_ON(!(expr))) \ + dc_breakpoint(); \ + } while (0) -#else -#define ASSERT (expr) WARN_ON_ONCE(!(expr)) -#endif +#define ASSERT (expr) do { \ + if (WARN_ON_ONCE(!(expr))) \ + dc_breakpoint(); \ + } while (0) -#if defined(CONFIG_DEBUG_KERNEL_DC ) && (defined(CONFIG_HAVE_KGDB ) || defined(CONFIG_KGDB ))#define BREAK_TO_DEBUGGER () \ do { \ DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__); \ - kgdb_breakpoint(); \ + dc_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.16.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 7 lines · Takashi Iwai
Hi,
the amdgpu driver's
ASSERT_CRITICAL()macro calls thekgdb_breakpoing()even if no debug option is set, and this leads to a kernel panic on distro kernels. The first two patches are the oneliner fixes for those, while the last one is the cleanup of those debug macros.
This looks like good work and solid. Hopefully it gets picked up.
Regards,
Luben
Quoted 11 lines
Takashi
===
Takashi Iwai (3):
drm/amd/display: Fix kernel panic bydal_gpio_open()error drm/amd/display: Don't invokekgdb_breakpoint()unconditionally drm/amd/display: Clean up debug macros
Quoted 5 lines
drivers/gpu/drm/amd/display/Kconfig | 1 + drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c | 4 +-- drivers/gpu/drm/amd/display/dc/os_types.h | 33 +++++++++---------------- 3 files changed, 15 insertions(+), 23 deletions(-)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
Acked-byYes, looks good to me as well. Series is:
I'll give the display guys a few more days to look this over, but if there are no objections, I'll apply them.
Thanks!
Alex
Quoted 32 lines · Luben Tuikov
Quoted 7 lines · Takashi Iwai
Hi,
the amdgpu driver's
ASSERT_CRITICAL()macro calls thekgdb_breakpoing()even if no debug option is set, and this leads to a kernel panic on distro kernels. The first two patches are the oneliner fixes for those, while the last one is the cleanup of those debug macros.This looks like good work and solid. Hopefully it gets picked up.
Regards,
LubenQuoted 11 lines
Takashi
===
Takashi Iwai (3):
drm/amd/display: Fix kernel panic bydal_gpio_open()error drm/amd/display: Don't invokekgdb_breakpoint()unconditionally drm/amd/display: Clean up debug macrosQuoted 5 lines
drivers/gpu/drm/amd/display/Kconfig | 1 + drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c | 4 +-- drivers/gpu/drm/amd/display/dc/os_types.h | 33 +++++++++---------------- 3 files changed, 15 insertions(+), 23 deletions(-)
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Kazlauskas, Nicholas
Reviewed-byLooks fine to me. Feel free to apply.
Regards,
Nicholas Kazlauskas
Quoted 42 lines · Alex Deucher
Yes, looks good to me as well. Series is:
Acked-by Alex Deucher <[email protected]>I'll give the display guys a few more days to look this over, but if there are no objections, I'll apply them.
Thanks!
Alex
Quoted 32 lines · Luben Tuikov
Quoted 7 lines · Takashi Iwai
Hi,
the amdgpu driver's
ASSERT_CRITICAL()macro calls thekgdb_breakpoing()even if no debug option is set, and this leads to a kernel panic on distro kernels. The first two patches are the oneliner fixes for those, while the last one is the cleanup of those debug macros.This looks like good work and solid. Hopefully it gets picked up.
Regards,
LubenQuoted 16 lines
Takashi
===
Takashi Iwai (3):
drm/amd/display: Fix kernel panic bydal_gpio_open()error drm/amd/display: Don't invokekgdb_breakpoint()unconditionally drm/amd/display: Clean up debug macrosdrivers/gpu/drm/amd/display/Kconfig | 1 + drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c | 4 +-- drivers/gpu/drm/amd/display/dc/os_types.h | 33 +++++++++---------------- 3 files changed, 15 insertions(+), 23 deletions(-)
Quoted 9 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 61 lines · Nicholas
Reviewed-by Nicholas Kazlauskas <[email protected]>Looks fine to me. Feel free to apply.
Regards,
Nicholas KazlauskasQuoted 51 lines · Alex Deucher
Yes, looks good to me as well. Series is:
Acked-by Alex Deucher <[email protected]>I'll give the display guys a few more days to look this over, but if there are no objections, I'll apply them.
Thanks!
Alex
Quoted 32 lines · Luben Tuikov
Quoted 7 lines · Takashi Iwai
Hi,
the amdgpu driver's
ASSERT_CRITICAL()macro calls thekgdb_breakpoing()even if no debug option is set, and this leads to a kernel panic on distro kernels. The first two patches are the oneliner fixes for those, while the last one is the cleanup of those debug macros.This looks like good work and solid. Hopefully it gets picked up.
Regards,
LubenQuoted 11 lines
Takashi
===
Takashi Iwai (3):
drm/amd/display: Fix kernel panic bydal_gpio_open()error drm/amd/display: Don't invokekgdb_breakpoint()unconditionally drm/amd/display: Clean up debug macrosQuoted 5 lines
drivers/gpu/drm/amd/display/Kconfig | 1 + drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c | 4 +-- drivers/gpu/drm/amd/display/dc/os_types.h | 33 +++++++++---------------- 3 files changed, 15 insertions(+), 23 deletions(-)Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx