mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] drm/amd/display: add an ASSERT() to irq service functions
@ 2022-10-17 16:13 Hamza Mahfooz
  2022-10-17 18:48 ` Harry Wentland
  0 siblings, 1 reply; 2+ messages in thread
From: Hamza Mahfooz @ 2022-10-17 16:13 UTC (permalink / raw)
  To: amd-gfx
  Cc: Roman Li, Hamza Mahfooz, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Alex Deucher, Christian König, Pan,
	Xinhui, David Airlie, Daniel Vetter, Mario Limonciello,
	Nicholas Kazlauskas, Stylon Wang, Alex Hung, dri-devel,
	linux-kernel

Currently, if we encounter unimplemented functions, it is difficult to
tell what caused them just by looking at dmesg and that is compounded by
the fact that it is often hard to reproduce said issues, for instance we
have had reports of this condition being triggered when removing a
secondary display that is setup in mirror mode and is connected using
usb-c. So, to have access to more detailed debugging information, add an
ASSERT() to dal_irq_service_ack() and dal_irq_service_set() that only
triggers when we encounter an unimplemented function.

Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
---
v2: detail specific instance that I'm interested in and use ASSERT()
    instead of WARN().

v3: move ASSERT()s inside the new if blocks.
---
 .../gpu/drm/amd/display/dc/irq/irq_service.c    | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/irq/irq_service.c b/drivers/gpu/drm/amd/display/dc/irq/irq_service.c
index 7bad39bba86b..d100edaedbbb 100644
--- a/drivers/gpu/drm/amd/display/dc/irq/irq_service.c
+++ b/drivers/gpu/drm/amd/display/dc/irq/irq_service.c
@@ -112,8 +112,15 @@ bool dal_irq_service_set(
 
 	dal_irq_service_ack(irq_service, source);
 
-	if (info->funcs && info->funcs->set)
+	if (info->funcs && info->funcs->set) {
+		if (info->funcs->set == dal_irq_service_dummy_set) {
+			DC_LOG_WARNING("%s: src: %d, st: %d\n", __func__,
+				       source, enable);
+			ASSERT(0);
+		}
+
 		return info->funcs->set(irq_service, info, enable);
+	}
 
 	dal_irq_service_set_generic(irq_service, info, enable);
 
@@ -146,8 +153,14 @@ bool dal_irq_service_ack(
 		return false;
 	}
 
-	if (info->funcs && info->funcs->ack)
+	if (info->funcs && info->funcs->ack) {
+		if (info->funcs->ack == dal_irq_service_dummy_ack) {
+			DC_LOG_WARNING("%s: src: %d\n", __func__, source);
+			ASSERT(0);
+		}
+
 		return info->funcs->ack(irq_service, info);
+	}
 
 	dal_irq_service_ack_generic(irq_service, info);
 
-- 
2.38.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] drm/amd/display: add an ASSERT() to irq service functions
  2022-10-17 16:13 [PATCH v3] drm/amd/display: add an ASSERT() to irq service functions Hamza Mahfooz
@ 2022-10-17 18:48 ` Harry Wentland
  0 siblings, 0 replies; 2+ messages in thread
From: Harry Wentland @ 2022-10-17 18:48 UTC (permalink / raw)
  To: Hamza Mahfooz, amd-gfx
  Cc: Stylon Wang, Leo Li, linux-kernel, Pan, Xinhui, Rodrigo Siqueira,
	Roman Li, dri-devel, Nicholas Kazlauskas, David Airlie,
	Alex Hung, Daniel Vetter, Alex Deucher, Christian König,
	Mario Limonciello

On 2022-10-17 12:13, Hamza Mahfooz wrote:
> Currently, if we encounter unimplemented functions, it is difficult to
> tell what caused them just by looking at dmesg and that is compounded by
> the fact that it is often hard to reproduce said issues, for instance we
> have had reports of this condition being triggered when removing a
> secondary display that is setup in mirror mode and is connected using
> usb-c. So, to have access to more detailed debugging information, add an
> ASSERT() to dal_irq_service_ack() and dal_irq_service_set() that only
> triggers when we encounter an unimplemented function.
> 
> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
> v2: detail specific instance that I'm interested in and use ASSERT()
>     instead of WARN().
> 
> v3: move ASSERT()s inside the new if blocks.
> ---
>  .../gpu/drm/amd/display/dc/irq/irq_service.c    | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/irq/irq_service.c b/drivers/gpu/drm/amd/display/dc/irq/irq_service.c
> index 7bad39bba86b..d100edaedbbb 100644
> --- a/drivers/gpu/drm/amd/display/dc/irq/irq_service.c
> +++ b/drivers/gpu/drm/amd/display/dc/irq/irq_service.c
> @@ -112,8 +112,15 @@ bool dal_irq_service_set(
>  
>  	dal_irq_service_ack(irq_service, source);
>  
> -	if (info->funcs && info->funcs->set)
> +	if (info->funcs && info->funcs->set) {
> +		if (info->funcs->set == dal_irq_service_dummy_set) {
> +			DC_LOG_WARNING("%s: src: %d, st: %d\n", __func__,
> +				       source, enable);
> +			ASSERT(0);
> +		}
> +
>  		return info->funcs->set(irq_service, info, enable);
> +	}
>  
>  	dal_irq_service_set_generic(irq_service, info, enable);
>  
> @@ -146,8 +153,14 @@ bool dal_irq_service_ack(
>  		return false;
>  	}
>  
> -	if (info->funcs && info->funcs->ack)
> +	if (info->funcs && info->funcs->ack) {
> +		if (info->funcs->ack == dal_irq_service_dummy_ack) {
> +			DC_LOG_WARNING("%s: src: %d\n", __func__, source);
> +			ASSERT(0);
> +		}
> +
>  		return info->funcs->ack(irq_service, info);
> +	}
>  
>  	dal_irq_service_ack_generic(irq_service, info);
>  


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-17 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 16:13 [PATCH v3] drm/amd/display: add an ASSERT() to irq service functions Hamza Mahfooz
2022-10-17 18:48 ` Harry Wentland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®