dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error
@ 2025-10-03  3:23 Chintan Patel
  2025-10-03 11:11 ` Jani Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chintan Patel @ 2025-10-03  3:23 UTC (permalink / raw)
  To: maarten.lankhorst, maxime.ripard, tzimmermann, airlied, simona
  Cc: dri-devel, linux-kernel, syzbot+147ba789658184f0ce04,
	Chintan Patel

When wait_event_timeout() in drm_wait_one_vblank() times out, the
current WARN can cause unnecessary kernel panics in environments
with panic_on_warn set (e.g. CI, fuzzing). These timeouts can happen
under heavy scheduling pressure or in rare cases of delayed vblank
handling, and are not always a kernel bug.

Replace the WARN with drm_err() messages that report the timeout
without crashing the system. Developers can still enable drm.debug
to diagnose genuine problems.

Reported-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=147ba789658184f0ce04
Tested-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
Signed-off-by: Chintan Patel <chintanlike@gmail.com>

v2:
 - Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
 - Remove else branch, only log timeout case

v3:
 - Use drm_err() instead of drm_dbg_kms() (suggested by Ville Syrjälä)
 - Remove unnecessary curr = drm_vblank_count() (suggested by Thomas Zimmermann)
 - Fix commit message wording (“invalid userspace calls” → “delayed vblank handling”)
---
 drivers/gpu/drm/drm_vblank.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 46f59883183d..0664aea1b924 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1305,7 +1305,8 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
 				 last != drm_vblank_count(dev, pipe),
 				 msecs_to_jiffies(100));
 
-	drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
+	if (!ret)
+		drm_err(dev, "vblank wait timed out on crtc %i\n", pipe);
 
 	drm_vblank_put(dev, pipe);
 }
-- 
2.43.0


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

* Re: [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error
  2025-10-03  3:23 [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error Chintan Patel
@ 2025-10-03 11:11 ` Jani Nikula
  2025-10-23  7:51 ` Thomas Zimmermann
  2025-10-24 13:58 ` Thomas Zimmermann
  2 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2025-10-03 11:11 UTC (permalink / raw)
  To: Chintan Patel, maarten.lankhorst, maxime.ripard, tzimmermann,
	airlied, simona
  Cc: dri-devel, linux-kernel, syzbot+147ba789658184f0ce04,
	Chintan Patel

On Thu, 02 Oct 2025, Chintan Patel <chintanlike@gmail.com> wrote:
> When wait_event_timeout() in drm_wait_one_vblank() times out, the
> current WARN can cause unnecessary kernel panics in environments
> with panic_on_warn set (e.g. CI, fuzzing). These timeouts can happen
> under heavy scheduling pressure or in rare cases of delayed vblank
> handling, and are not always a kernel bug.
>
> Replace the WARN with drm_err() messages that report the timeout
> without crashing the system. Developers can still enable drm.debug
> to diagnose genuine problems.

No need to resend for this, can be fixed while applying, but the last
sentence is no longer meaningful with drm_err().

BR,
Jani.

>
> Reported-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=147ba789658184f0ce04
> Tested-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
>
> v2:
>  - Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
>  - Remove else branch, only log timeout case
>
> v3:
>  - Use drm_err() instead of drm_dbg_kms() (suggested by Ville Syrjälä)
>  - Remove unnecessary curr = drm_vblank_count() (suggested by Thomas Zimmermann)
>  - Fix commit message wording (“invalid userspace calls” → “delayed vblank handling”)
> ---
>  drivers/gpu/drm/drm_vblank.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 46f59883183d..0664aea1b924 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -1305,7 +1305,8 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
>  				 last != drm_vblank_count(dev, pipe),
>  				 msecs_to_jiffies(100));
>  
> -	drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
> +	if (!ret)
> +		drm_err(dev, "vblank wait timed out on crtc %i\n", pipe);
>  
>  	drm_vblank_put(dev, pipe);
>  }

-- 
Jani Nikula, Intel

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

* Re: [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error
  2025-10-03  3:23 [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error Chintan Patel
  2025-10-03 11:11 ` Jani Nikula
@ 2025-10-23  7:51 ` Thomas Zimmermann
  2025-10-24 13:58 ` Thomas Zimmermann
  2 siblings, 0 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2025-10-23  7:51 UTC (permalink / raw)
  To: Chintan Patel, maarten.lankhorst, maxime.ripard, airlied, simona
  Cc: dri-devel, linux-kernel, syzbot+147ba789658184f0ce04

Hi

Am 03.10.25 um 05:23 schrieb Chintan Patel:
> When wait_event_timeout() in drm_wait_one_vblank() times out, the
> current WARN can cause unnecessary kernel panics in environments
> with panic_on_warn set (e.g. CI, fuzzing). These timeouts can happen
> under heavy scheduling pressure or in rare cases of delayed vblank
> handling, and are not always a kernel bug.
>
> Replace the WARN with drm_err() messages that report the timeout
> without crashing the system. Developers can still enable drm.debug
> to diagnose genuine problems.
>
> Reported-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=147ba789658184f0ce04
> Tested-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>

 From my side

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

See [1] for another such report

[1] 
https://lore.kernel.org/virtualization/202510221555.8c60c069-lkp@intel.com/T/#u

If there's also a way to raise priority of the vblank timer, we should 
explore that as well.

Best regards
Thomas

>
> v2:
>   - Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
>   - Remove else branch, only log timeout case
>
> v3:
>   - Use drm_err() instead of drm_dbg_kms() (suggested by Ville Syrjälä)
>   - Remove unnecessary curr = drm_vblank_count() (suggested by Thomas Zimmermann)
>   - Fix commit message wording (“invalid userspace calls” → “delayed vblank handling”)
> ---
>   drivers/gpu/drm/drm_vblank.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 46f59883183d..0664aea1b924 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -1305,7 +1305,8 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
>   				 last != drm_vblank_count(dev, pipe),
>   				 msecs_to_jiffies(100));
>   
> -	drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
> +	if (!ret)
> +		drm_err(dev, "vblank wait timed out on crtc %i\n", pipe);
>   
>   	drm_vblank_put(dev, pipe);
>   }

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



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

* Re: [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error
  2025-10-03  3:23 [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error Chintan Patel
  2025-10-03 11:11 ` Jani Nikula
  2025-10-23  7:51 ` Thomas Zimmermann
@ 2025-10-24 13:58 ` Thomas Zimmermann
  2025-10-24 23:40   ` Chintan Patel
  2 siblings, 1 reply; 6+ messages in thread
From: Thomas Zimmermann @ 2025-10-24 13:58 UTC (permalink / raw)
  To: Chintan Patel, maarten.lankhorst, maxime.ripard, airlied, simona
  Cc: dri-devel, linux-kernel, syzbot+147ba789658184f0ce04

Hi

Am 03.10.25 um 05:23 schrieb Chintan Patel:
> When wait_event_timeout() in drm_wait_one_vblank() times out, the
> current WARN can cause unnecessary kernel panics in environments
> with panic_on_warn set (e.g. CI, fuzzing). These timeouts can happen
> under heavy scheduling pressure or in rare cases of delayed vblank
> handling, and are not always a kernel bug.
>
> Replace the WARN with drm_err() messages that report the timeout
> without crashing the system. Developers can still enable drm.debug
> to diagnose genuine problems.
>
> Reported-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=147ba789658184f0ce04
> Tested-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
>
> v2:
>   - Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
>   - Remove else branch, only log timeout case
>
> v3:
>   - Use drm_err() instead of drm_dbg_kms() (suggested by Ville Syrjälä)
>   - Remove unnecessary curr = drm_vblank_count() (suggested by Thomas Zimmermann)
>   - Fix commit message wording (“invalid userspace calls” → “delayed vblank handling”)
> ---
>   drivers/gpu/drm/drm_vblank.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 46f59883183d..0664aea1b924 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -1305,7 +1305,8 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
>   				 last != drm_vblank_count(dev, pipe),
>   				 msecs_to_jiffies(100));

Instead of replacing the drm_WARN(), could you please try to increase 
the timeout? Let's say 1000 msec to be on the safe side.

Best regards
Thomas

>   
> -	drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
> +	if (!ret)
> +		drm_err(dev, "vblank wait timed out on crtc %i\n", pipe);
>   
>   	drm_vblank_put(dev, pipe);
>   }

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



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

* Re: [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error
  2025-10-24 13:58 ` Thomas Zimmermann
@ 2025-10-24 23:40   ` Chintan Patel
  2025-10-27  8:49     ` Thomas Zimmermann
  0 siblings, 1 reply; 6+ messages in thread
From: Chintan Patel @ 2025-10-24 23:40 UTC (permalink / raw)
  To: Thomas Zimmermann, maarten.lankhorst, maxime.ripard, airlied,
	simona
  Cc: dri-devel, linux-kernel, syzbot+147ba789658184f0ce04

Hi Thomas,

Thank you Thomas for suggestions!

On 10/24/25 06:58, Thomas Zimmermann wrote:
> Hi
> 
> Am 03.10.25 um 05:23 schrieb Chintan Patel:
>> When wait_event_timeout() in drm_wait_one_vblank() times out, the
>> current WARN can cause unnecessary kernel panics in environments
>> with panic_on_warn set (e.g. CI, fuzzing). These timeouts can happen
>> under heavy scheduling pressure or in rare cases of delayed vblank
>> handling, and are not always a kernel bug.
>>
>> Replace the WARN with drm_err() messages that report the timeout
>> without crashing the system. Developers can still enable drm.debug
>> to diagnose genuine problems.
>>
>> Reported-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
>> Closes: https://syzkaller.appspot.com/bug?extid=147ba789658184f0ce04
>> Tested-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
>> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
>>
>> v2:
>>   - Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
>>   - Remove else branch, only log timeout case
>>
>> v3:
>>   - Use drm_err() instead of drm_dbg_kms() (suggested by Ville Syrjälä)
>>   - Remove unnecessary curr = drm_vblank_count() (suggested by Thomas 
>> Zimmermann)
>>   - Fix commit message wording (“invalid userspace calls” → “delayed 
>> vblank handling”)
>> ---
>>   drivers/gpu/drm/drm_vblank.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 46f59883183d..0664aea1b924 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -1305,7 +1305,8 @@ void drm_wait_one_vblank(struct drm_device *dev, 
>> unsigned int pipe)
>>                    last != drm_vblank_count(dev, pipe),
>>                    msecs_to_jiffies(100));
> 
> Instead of replacing the drm_WARN(), could you please try to increase 
> the timeout? Let's say 1000 msec to be on the safe side.
> 

I tried it locally and also tested with syzbot after increasing the 
timeout to 1000 msec. The issue no longer reproduces with this change.

I’ll send v4 shortly with the updated timeout.



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

* Re: [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error
  2025-10-24 23:40   ` Chintan Patel
@ 2025-10-27  8:49     ` Thomas Zimmermann
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2025-10-27  8:49 UTC (permalink / raw)
  To: Chintan Patel, maarten.lankhorst, maxime.ripard, airlied, simona
  Cc: dri-devel, linux-kernel, syzbot+147ba789658184f0ce04

Hi

Am 25.10.25 um 01:40 schrieb Chintan Patel:
> Hi Thomas,
>
> Thank you Thomas for suggestions!
>
> On 10/24/25 06:58, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 03.10.25 um 05:23 schrieb Chintan Patel:
>>> When wait_event_timeout() in drm_wait_one_vblank() times out, the
>>> current WARN can cause unnecessary kernel panics in environments
>>> with panic_on_warn set (e.g. CI, fuzzing). These timeouts can happen
>>> under heavy scheduling pressure or in rare cases of delayed vblank
>>> handling, and are not always a kernel bug.
>>>
>>> Replace the WARN with drm_err() messages that report the timeout
>>> without crashing the system. Developers can still enable drm.debug
>>> to diagnose genuine problems.
>>>
>>> Reported-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
>>> Closes: https://syzkaller.appspot.com/bug?extid=147ba789658184f0ce04
>>> Tested-by: syzbot+147ba789658184f0ce04@syzkaller.appspotmail.com
>>> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
>>>
>>> v2:
>>>   - Drop unnecessary in-code comment (suggested by Thomas Zimmermann)
>>>   - Remove else branch, only log timeout case
>>>
>>> v3:
>>>   - Use drm_err() instead of drm_dbg_kms() (suggested by Ville Syrjälä)
>>>   - Remove unnecessary curr = drm_vblank_count() (suggested by 
>>> Thomas Zimmermann)
>>>   - Fix commit message wording (“invalid userspace calls” → “delayed 
>>> vblank handling”)
>>> ---
>>>   drivers/gpu/drm/drm_vblank.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_vblank.c 
>>> b/drivers/gpu/drm/drm_vblank.c
>>> index 46f59883183d..0664aea1b924 100644
>>> --- a/drivers/gpu/drm/drm_vblank.c
>>> +++ b/drivers/gpu/drm/drm_vblank.c
>>> @@ -1305,7 +1305,8 @@ void drm_wait_one_vblank(struct drm_device 
>>> *dev, unsigned int pipe)
>>>                    last != drm_vblank_count(dev, pipe),
>>>                    msecs_to_jiffies(100));
>>
>> Instead of replacing the drm_WARN(), could you please try to increase 
>> the timeout? Let's say 1000 msec to be on the safe side.
>>
>
> I tried it locally and also tested with syzbot after increasing the 
> timeout to 1000 msec. The issue no longer reproduces with this change.
>
> I’ll send v4 shortly with the updated timeout.

Ville asked for other approaches before merging the change to the 
warning. Great that it worked.

Best regards
Thomas

>
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



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

end of thread, other threads:[~2025-10-27  8:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-03  3:23 [PATCH v3] drm/vblank: downgrade vblank wait timeout from WARN to error Chintan Patel
2025-10-03 11:11 ` Jani Nikula
2025-10-23  7:51 ` Thomas Zimmermann
2025-10-24 13:58 ` Thomas Zimmermann
2025-10-24 23:40   ` Chintan Patel
2025-10-27  8:49     ` Thomas Zimmermann

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