NACK/CMNT: [SRU][R][PATCH 13/13] drm: ensure that vblank diff is never negative

Werner Sembach wse at tuxedocomputers.com
Fri May 15 11:56:11 UTC 2026


Hello Alice,

Am 14.05.26 um 11:46 schrieb Alice C. Munduruca:
> On Wed May 13, 2026 at 6:48 PM CEST, Werner Sembach wrote:
>> From: Aaron Erhardt <aer at tuxedocomputers.com>
>>
>> Handle cases, where drivers report incorrect timestamps and negative
>> time differences are calculated. If the negative difference is large
>> enough, negative missed vblanks are reported, but stored in an unsigned
>> integer which can causes freezes. This patch prevents this case.
>>
>> This fix has been verified to fix problems with the i915 driver on
>> modern Intel CPUs (e.g. Intel Core Ultra 7 155H).
>>
>> Signed-off-by: Aaron Erhardt <aer at tuxedocomputers.com>
>> Signed-off-by: Werner Sembach <wse at tuxedocomputers.com>
>> ---
>>   drivers/gpu/drm/drm_vblank.c | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index f78bf37f1e0a7..46cf78a514f23 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -1564,7 +1564,14 @@ static void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
>>   	} while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
>>   
>>   	diff_ns = ktime_to_ns(ktime_sub(t_vblank, vblank->time));
>> -	if (framedur_ns)
>> +
>> +	/*
>> +	 * Make sure no bogus diffs result from negative differences
>> +	 * when incorrect timestamps are reported by a driver.
>> +	 */
>> +	if (drm_WARN_ON_ONCE(dev, t_vblank < vblank->time))
>> +		diff = 0;
>> +	else if (framedur_ns)
>>   		diff = DIV_ROUND_CLOSEST_ULL(diff_ns, framedur_ns);
>>   
>>   
> Hi Werner,
>
> Overall the patchset look great :)
>
> There is however a convention that patches that are not yet sent and accepted in an upstream
> tree cannot be accepted by Ubuntu kernels, not even as a "UBUNTU: SAUCE:" patch.

Wouldn't fall that under "3. The patch is never expected to be submitted 
upstream but is of enough value for Ubuntu to carry it in our tree." ?

Dropped it for the time being to net get the rest delayed by that.

>
> A small nitpick would also be to consider the SRU cover letter format [1] for the v2,
> although given you have the impact section I would not NACK just for that :)

Ack hope I did it right in v2.

Best regards,

Werner

>
> Thanks,
>
> Nacked-by: Alice C. Munduruca <alice.munduruca at canonical.com>
>
> [1]: https://documentation.ubuntu.com/kernel/reference/stable-patch-format/



More information about the kernel-team mailing list