2020-10-23 08:18:51

by Takashi Iwai

[permalink] [raw]
Subject: [PATCH 0/3] 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(-)

--
2.16.4


2020-10-23 14:48:41

by Takashi Iwai

[permalink] [raw]
Subject: [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.

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1177973
Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
---
drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c b/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c
index f67c18375bfd..dac427b68fd7 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c
@@ -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;
--
2.16.4

2020-10-23 14:49:11

by Takashi Iwai

[permalink] [raw]
Subject: [PATCH 2/3] drm/amd/display: Don't invoke kgdb_breakpoint() unconditionally

ASSERT_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
Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
---
drivers/gpu/drm/amd/display/dc/os_types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/os_types.h b/drivers/gpu/drm/amd/display/dc/os_types.h
index 330acaaed79a..32758b245754 100644
--- a/drivers/gpu/drm/amd/display/dc/os_types.h
+++ b/drivers/gpu/drm/amd/display/dc/os_types.h
@@ -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(); \
--
2.16.4

2020-10-24 01:34:58

by Luben Tuikov

[permalink] [raw]
Subject: Re: [PATCH 0/3] drm/amd/display: Fix kernel panic by breakpoint

On 2020-10-23 03:46, Takashi Iwai wrote:
> 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.

This looks like good work and solid. Hopefully it gets picked up.

Regards,
Luben

>
>
> 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(-)
>

2020-10-27 00:00:17

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH 0/3] drm/amd/display: Fix kernel panic by breakpoint

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

On Fri, Oct 23, 2020 at 7:16 PM Luben Tuikov <[email protected]> wrote:
>
> On 2020-10-23 03:46, Takashi Iwai wrote:
> > 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.
>
> This looks like good work and solid. Hopefully it gets picked up.
>
> Regards,
> Luben
>
> >
> >
> > 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(-)
> >
>
> _______________________________________________
> amd-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

2020-10-27 06:57:10

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH 0/3] drm/amd/display: Fix kernel panic by breakpoint

Applied. Thanks!

Alex

On Mon, Oct 26, 2020 at 4:22 PM Kazlauskas, Nicholas
<[email protected]> wrote:
>
> Reviewed-by: Nicholas Kazlauskas <[email protected]>
>
> Looks fine to me. Feel free to apply.
>
> Regards,
> Nicholas Kazlauskas
>
> On 2020-10-26 3:34 p.m., Alex Deucher wrote:
> > 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
> >
> > On Fri, Oct 23, 2020 at 7:16 PM Luben Tuikov <[email protected]> wrote:
> >>
> >> On 2020-10-23 03:46, Takashi Iwai wrote:
> >>> 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.
> >>
> >> This looks like good work and solid. Hopefully it gets picked up.
> >>
> >> Regards,
> >> Luben
> >>
> >>>
> >>>
> >>> 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(-)
> >>>
> >>
> >> _______________________________________________
> >> 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
> >
>

2020-10-27 07:26:21

by Kazlauskas, Nicholas

[permalink] [raw]
Subject: Re: [PATCH 0/3] drm/amd/display: Fix kernel panic by breakpoint

Reviewed-by: Nicholas Kazlauskas <[email protected]>

Looks fine to me. Feel free to apply.

Regards,
Nicholas Kazlauskas

On 2020-10-26 3:34 p.m., Alex Deucher wrote:
> 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
>
> On Fri, Oct 23, 2020 at 7:16 PM Luben Tuikov <[email protected]> wrote:
>>
>> On 2020-10-23 03:46, Takashi Iwai wrote:
>>> 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.
>>
>> This looks like good work and solid. Hopefully it gets picked up.
>>
>> Regards,
>> Luben
>>
>>>
>>>
>>> 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(-)
>>>
>>
>> _______________________________________________
>> 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
>