linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: replace BUG_ON with WARN_ON
@ 2019-12-18 16:15 Aditya Pakki
  2019-12-19 16:29 ` Mikita Lipski
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Pakki @ 2019-12-18 16:15 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Harry Wentland, Leo Li, Alex Deucher, Christian König,
	David (ChunMing) Zhou, David Airlie, Daniel Vetter,
	Nicholas Kazlauskas, Bhawanpreet Lakha, David Francis,
	Mario Kleiner, amd-gfx, dri-devel, linux-kernel

In skip_modeset label within dm_update_crtc_state(), the dc stream
cannot be NULL. Using BUG_ON as an assertion is not required and
can be removed. The patch replaces the check with a WARN_ON in case
dm_new_crtc_state->stream is NULL.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 7aac9568d3be..03cb30913c20 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7012,7 +7012,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
 	 * 3. Is currently active and enabled.
 	 * => The dc stream state currently exists.
 	 */
-	BUG_ON(dm_new_crtc_state->stream == NULL);
+	WARN_ON(!dm_new_crtc_state->stream);
 
 	/* Scaling or underscan settings */
 	if (is_scaling_state_different(dm_old_conn_state, dm_new_conn_state))
-- 
2.20.1


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

* Re: [PATCH] drm/amd/display: replace BUG_ON with WARN_ON
  2019-12-18 16:15 [PATCH] drm/amd/display: replace BUG_ON with WARN_ON Aditya Pakki
@ 2019-12-19 16:29 ` Mikita Lipski
  2019-12-19 17:06   ` Aditya Pakki
  0 siblings, 1 reply; 3+ messages in thread
From: Mikita Lipski @ 2019-12-19 16:29 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: David (ChunMing) Zhou, Mario Kleiner, Leo Li, Bhawanpreet Lakha,
	David Francis, kjlu, linux-kernel, amd-gfx, Nicholas Kazlauskas,
	David Airlie, dri-devel, Daniel Vetter, Alex Deucher,
	Harry Wentland, Christian König



On 12/18/19 11:15 AM, Aditya Pakki wrote:
> In skip_modeset label within dm_update_crtc_state(), the dc stream
> cannot be NULL. Using BUG_ON as an assertion is not required and
> can be removed. The patch replaces the check with a WARN_ON in case
> dm_new_crtc_state->stream is NULL.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 7aac9568d3be..03cb30913c20 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7012,7 +7012,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
>   	 * 3. Is currently active and enabled.
>   	 * => The dc stream state currently exists.
>   	 */
> -	BUG_ON(dm_new_crtc_state->stream == NULL);
> +	WARN_ON(!dm_new_crtc_state->stream);
>   

Thanks for the patch, but this is NAK from me since it doesn't really do 
anything to prevent it or fix it.

If the stream is NULL and it passed this far in the function then 
something really wrong has happened and the process should be stopped.

I'm currently dealing with an issue where dm_new_crtc_state->stream is 
NULL. One of the scenarios could be that driver creates stream for a 
fake sink instead of failing, that is connected over MST, and calls 
dm_update_crtc_state to enable CRTC.

>   	/* Scaling or underscan settings */
>   	if (is_scaling_state_different(dm_old_conn_state, dm_new_conn_state))
> 

-- 
Thanks,
Mikita Lipski
Software Engineer, AMD
mikita.lipski@amd.com

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

* Re: [PATCH] drm/amd/display: replace BUG_ON with WARN_ON
  2019-12-19 16:29 ` Mikita Lipski
@ 2019-12-19 17:06   ` Aditya Pakki
  0 siblings, 0 replies; 3+ messages in thread
From: Aditya Pakki @ 2019-12-19 17:06 UTC (permalink / raw)
  To: Mikita Lipski
  Cc: David (ChunMing) Zhou, Mario Kleiner, Leo Li, Bhawanpreet Lakha,
	David Francis, kjlu, linux-kernel, amd-gfx, Nicholas Kazlauskas,
	David Airlie, dri-devel, Daniel Vetter, Alex Deucher,
	Harry Wentland, Christian König

On 12/19/19 10:29 AM, Mikita Lipski wrote:
> 
> 
> On 12/18/19 11:15 AM, Aditya Pakki wrote:
>> In skip_modeset label within dm_update_crtc_state(), the dc stream
>> cannot be NULL. Using BUG_ON as an assertion is not required and
>> can be removed. The patch replaces the check with a WARN_ON in case
>> dm_new_crtc_state->stream is NULL.
>>
>> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 7aac9568d3be..03cb30913c20 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -7012,7 +7012,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
>>        * 3. Is currently active and enabled.
>>        * => The dc stream state currently exists.
>>        */
>> -    BUG_ON(dm_new_crtc_state->stream == NULL);
>> +    WARN_ON(!dm_new_crtc_state->stream);
>>   
> 
> Thanks for the patch, but this is NAK from me since it doesn't really do anything to prevent it or fix it.
> 
> If the stream is NULL and it passed this far in the function then something really wrong has happened and the process should be stopped.
> 
> I'm currently dealing with an issue where dm_new_crtc_state->stream is NULL. One of the scenarios could be that driver creates stream for a fake sink instead of failing, that is connected over MST, and calls dm_update_crtc_state to enable CRTC.
> 
>>       /* Scaling or underscan settings */
>>       if (is_scaling_state_different(dm_old_conn_state, dm_new_conn_state))
>>
> 

Thanks Mikita for your advice regarding the patch. However, would a better error handling 
in this scenario be helpful ? Clearly, the stream variable is dereferenced in 
update_stream_scaling_settings would have the same impact as a crash ?

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

end of thread, other threads:[~2019-12-19 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 16:15 [PATCH] drm/amd/display: replace BUG_ON with WARN_ON Aditya Pakki
2019-12-19 16:29 ` Mikita Lipski
2019-12-19 17:06   ` Aditya Pakki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).