* Re: [PATCH] [RESEND] vmwgfx: use monotonic event timestamps
@ 2018-01-16 17:28 ` Thomas Hellstrom
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Hellstrom @ 2018-01-16 17:28 UTC (permalink / raw)
To: Arnd Bergmann, VMware Graphics, Sinclair Yeh, David Airlie
Cc: y2038, linux-kernel, dri-devel, Alex Deucher, Arvind Yadav,
Deepak Singh Rawat
Hi, Arnd,
Sinclair's on paternal leave and I thought this patch was already in
drm-next. My bad.
Dave, is it too late to pull this in for the next merge window?
/Thomas
On 01/16/2018 06:18 PM, Arnd Bergmann wrote:
> DRM_VMW_EVENT_FENCE_SIGNALED (struct drm_vmw_event_fence) and
> DRM_EVENT_VBLANK (struct drm_event_vblank) pass timestamps in 32-bit
> seconds/microseconds format.
>
> As of commit c61eef726a78 ("drm: add support for monotonic vblank
> timestamps"), other DRM drivers use monotonic times for drm_event_vblank,
> but vmwgfx still uses CLOCK_REALTIME for both events, which suffers from
> the y2038/y2106 overflow as well as time jumps.
>
> For consistency, this changes vmwgfx to use ktime_get_ts64 as well,
> which solves those problems and avoids the deprecated do_gettimeofday()
> function.
>
> This should be transparent to to user space, as long as it doesn't
> compare the time against the result of gettimeofday().
>
> Link: https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.kernel.org_patch_10076599_&d=DwIBAg&c=uilaK90D4TOVoH58JNXRgQ&r=wnSlgOCqfpNS4d02vP68_E9q2BNMCwfD2OZ_6dCFVQQ&m=8M6vawBo0zDsjbqhzV0xpOwAzX7Zm-uyGlIDnQ7-Gms&s=sHGuz0aoE9aLjVp5GALo8mYrN1bwOHW6mGpJIZmhwAc&e=
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> Originally sent on Nov 27. Sinclair Yeh said he'd pick it up
> for the next pull request, but it's not in linux-next yet.
>
> Resending the unchanged patch, please pick it up when you have time,
> or feel free to ignore this email in case it's already in some tree
> that just isn't part of linux-next but will be sent during the
> next merge window.
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> index 6c5c75cf5e6c..9ed544f8958f 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> @@ -901,11 +901,12 @@ static void vmw_event_fence_action_seq_passed(struct vmw_fence_action *action)
> spin_lock_irq(&dev->event_lock);
>
> if (likely(eaction->tv_sec != NULL)) {
> - struct timeval tv;
> + struct timespec64 ts;
>
> - do_gettimeofday(&tv);
> - *eaction->tv_sec = tv.tv_sec;
> - *eaction->tv_usec = tv.tv_usec;
> + ktime_get_ts64(&ts);
> + /* monotonic time, so no y2038 overflow */
> + *eaction->tv_sec = ts.tv_sec;
> + *eaction->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
> }
>
> drm_send_event_locked(dev, eaction->event);
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [RESEND] vmwgfx: use monotonic event timestamps
2018-01-16 17:28 ` Thomas Hellstrom
@ 2018-01-16 21:39 ` Woody Suwalski
-1 siblings, 0 replies; 11+ messages in thread
From: Woody Suwalski @ 2018-01-16 21:39 UTC (permalink / raw)
To: Thomas Hellstrom, Arnd Bergmann, VMware Graphics, Sinclair Yeh,
David Airlie
Cc: y2038, Deepak Singh Rawat, Patrik Jakobsson, Alex Deucher,
Arvind Yadav, dri-devel, linux-kernel
Thomas Hellstrom wrote:
> Hi, Arnd,
>
> Sinclair's on paternal leave and I thought this patch was already in
> drm-next. My bad.
> Dave, is it too late to pull this in for the next merge window?
>
> /Thomas
>
>
> On 01/16/2018 06:18 PM, Arnd Bergmann wrote:
>> DRM_VMW_EVENT_FENCE_SIGNALED (struct drm_vmw_event_fence) and
>> DRM_EVENT_VBLANK (struct drm_event_vblank) pass timestamps in 32-bit
>> seconds/microseconds format.
>>
>> As of commit c61eef726a78 ("drm: add support for monotonic vblank
>> timestamps"), other DRM drivers use monotonic times for
>> drm_event_vblank,
>> but vmwgfx still uses CLOCK_REALTIME for both events, which suffers from
>> the y2038/y2106 overflow as well as time jumps.
>>
>> For consistency, this changes vmwgfx to use ktime_get_ts64 as well,
>> which solves those problems and avoids the deprecated do_gettimeofday()
>> function.
>>
>> This should be transparent to to user space, as long as it doesn't
>> compare the time against the result of gettimeofday().
>>
>> Link:
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.kernel.org_patch_10076599_&d=DwIBAg&c=uilaK90D4TOVoH58JNXRgQ&r=wnSlgOCqfpNS4d02vP68_E9q2BNMCwfD2OZ_6dCFVQQ&m=8M6vawBo0zDsjbqhzV0xpOwAzX7Zm-uyGlIDnQ7-Gms&s=sHGuz0aoE9aLjVp5GALo8mYrN1bwOHW6mGpJIZmhwAc&e=
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> Originally sent on Nov 27. Sinclair Yeh said he'd pick it up
>> for the next pull request, but it's not in linux-next yet.
>>
>> Resending the unchanged patch, please pick it up when you have time,
>> or feel free to ignore this email in case it's already in some tree
>> that just isn't part of linux-next but will be sent during the
>> next merge window.
>> ---
>> drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>> b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>> index 6c5c75cf5e6c..9ed544f8958f 100644
>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>> @@ -901,11 +901,12 @@ static void
>> vmw_event_fence_action_seq_passed(struct vmw_fence_action *action)
>> spin_lock_irq(&dev->event_lock);
>> if (likely(eaction->tv_sec != NULL)) {
>> - struct timeval tv;
>> + struct timespec64 ts;
>> - do_gettimeofday(&tv);
>> - *eaction->tv_sec = tv.tv_sec;
>> - *eaction->tv_usec = tv.tv_usec;
>> + ktime_get_ts64(&ts);
>> + /* monotonic time, so no y2038 overflow */
>> + *eaction->tv_sec = ts.tv_sec;
>> + *eaction->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
>> }
>> drm_send_event_locked(dev, eaction->event);
>
>
Thomas, the same way my DRM patch has disappeared:
Date
Tue, 19 Dec 2017 11:50:57 -0800
>From Sinclair Yeh <>
Subject Re: [PATCH v.2] 4.15 vmgfx boot warning
This looks okay to me.
On Mon, Dec 18, 2017 at 07:26:03PM -0500, Woody Suwalski wrote:
> The 4.15 drm_atomic_helper driver shows a warning during boot (both 32 and
> 64 bit x86)
> It is caused by a mismatch between the result of vmw_enable_vblank() and
> what the drm_atomic_helper expects:
> /...
> ret = drm_crtc_vblank_get(crtc);
> WARN_ONCE(ret != -EINVAL, "driver forgot to call
> drm_crtc_vblank_off()\n");
> /...
>
> Signed-off by: Woody Suwalski <terraluna977@gmail.com>
>
> --- a/drivers/gpu/drm/drm_atomic_helper.c 2017-12-16 09:55:33.853374561
> -0500
> +++ b/drivers/gpu/drm/drm_atomic_helper.c 2017-12-16 10:55:56.089090752
> -0500
> @@ -889,7 +889,7 @@ disable_outputs(struct drm_device *dev,
> continue;
>
> ret = drm_crtc_vblank_get(crtc);
> - WARN_ONCE(ret != -EINVAL, "driver forgot to call
> drm_crtc_vblank_off()\n");
> + WARN_ONCE((ret != -EINVAL && ret != -ENOSYS), "driver forgot to
> call drm_crtc_vblank_off()\n");
> if (ret == 0)
> drm_crtc_vblank_put(crtc);
> }
>
===============================================
The 4.15 drm_atomic_helper driver shows a warning during boot.
It is caused by a mismatch between the result of vmw_enable_vblank() and
what the drm_atomic_helper expects:
/...
ret = drm_crtc_vblank_get(crtc);
WARN_ONCE(ret != -EINVAL, "driver forgot to call drm_crtc_vblank_off()\n");
/...
Signed-off by: Woody Suwalski <terraluna977@gmail.com>
--- a/drivers/gpu/drm/drm_atomic_helper.c 2017-12-16 09:55:33.853374561 -0500
+++ b/drivers/gpu/drm/drm_atomic_helper.c 2017-12-16 10:55:56.089090752 -0500
@@ -889,7 +889,7 @@ disable_outputs(struct drm_device *dev,
continue;
ret = drm_crtc_vblank_get(crtc);
- WARN_ONCE(ret != -EINVAL, "driver forgot to call drm_crtc_vblank_off()\n");
+ WARN_ONCE((ret != -EINVAL && ret != -ENOSYS), "driver forgot to call drm_crtc_vblank_off()\n");
if (ret == 0)
drm_crtc_vblank_put(crtc);
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [RESEND] vmwgfx: use monotonic event timestamps
@ 2018-01-16 21:39 ` Woody Suwalski
0 siblings, 0 replies; 11+ messages in thread
From: Woody Suwalski @ 2018-01-16 21:39 UTC (permalink / raw)
To: Thomas Hellstrom, Arnd Bergmann, VMware Graphics, Sinclair Yeh,
David Airlie
Cc: y2038, linux-kernel, dri-devel, Patrik Jakobsson, Alex Deucher,
Arvind Yadav, Deepak Singh Rawat
Thomas Hellstrom wrote:
> Hi, Arnd,
>
> Sinclair's on paternal leave and I thought this patch was already in
> drm-next. My bad.
> Dave, is it too late to pull this in for the next merge window?
>
> /Thomas
>
>
> On 01/16/2018 06:18 PM, Arnd Bergmann wrote:
>> DRM_VMW_EVENT_FENCE_SIGNALED (struct drm_vmw_event_fence) and
>> DRM_EVENT_VBLANK (struct drm_event_vblank) pass timestamps in 32-bit
>> seconds/microseconds format.
>>
>> As of commit c61eef726a78 ("drm: add support for monotonic vblank
>> timestamps"), other DRM drivers use monotonic times for
>> drm_event_vblank,
>> but vmwgfx still uses CLOCK_REALTIME for both events, which suffers from
>> the y2038/y2106 overflow as well as time jumps.
>>
>> For consistency, this changes vmwgfx to use ktime_get_ts64 as well,
>> which solves those problems and avoids the deprecated do_gettimeofday()
>> function.
>>
>> This should be transparent to to user space, as long as it doesn't
>> compare the time against the result of gettimeofday().
>>
>> Link:
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.kernel.org_patch_10076599_&d=DwIBAg&c=uilaK90D4TOVoH58JNXRgQ&r=wnSlgOCqfpNS4d02vP68_E9q2BNMCwfD2OZ_6dCFVQQ&m=8M6vawBo0zDsjbqhzV0xpOwAzX7Zm-uyGlIDnQ7-Gms&s=sHGuz0aoE9aLjVp5GALo8mYrN1bwOHW6mGpJIZmhwAc&e=
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> Originally sent on Nov 27. Sinclair Yeh said he'd pick it up
>> for the next pull request, but it's not in linux-next yet.
>>
>> Resending the unchanged patch, please pick it up when you have time,
>> or feel free to ignore this email in case it's already in some tree
>> that just isn't part of linux-next but will be sent during the
>> next merge window.
>> ---
>> drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>> b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>> index 6c5c75cf5e6c..9ed544f8958f 100644
>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>> @@ -901,11 +901,12 @@ static void
>> vmw_event_fence_action_seq_passed(struct vmw_fence_action *action)
>> spin_lock_irq(&dev->event_lock);
>> if (likely(eaction->tv_sec != NULL)) {
>> - struct timeval tv;
>> + struct timespec64 ts;
>> - do_gettimeofday(&tv);
>> - *eaction->tv_sec = tv.tv_sec;
>> - *eaction->tv_usec = tv.tv_usec;
>> + ktime_get_ts64(&ts);
>> + /* monotonic time, so no y2038 overflow */
>> + *eaction->tv_sec = ts.tv_sec;
>> + *eaction->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
>> }
>> drm_send_event_locked(dev, eaction->event);
>
>
Thomas, the same way my DRM patch has disappeared:
Date
Tue, 19 Dec 2017 11:50:57 -0800
From Sinclair Yeh <>
Subject Re: [PATCH v.2] 4.15 vmgfx boot warning
This looks okay to me.
On Mon, Dec 18, 2017 at 07:26:03PM -0500, Woody Suwalski wrote:
> The 4.15 drm_atomic_helper driver shows a warning during boot (both 32 and
> 64 bit x86)
> It is caused by a mismatch between the result of vmw_enable_vblank() and
> what the drm_atomic_helper expects:
> /...
> ret = drm_crtc_vblank_get(crtc);
> WARN_ONCE(ret != -EINVAL, "driver forgot to call
> drm_crtc_vblank_off()\n");
> /...
>
> Signed-off by: Woody Suwalski <terraluna977@gmail.com>
>
> --- a/drivers/gpu/drm/drm_atomic_helper.c 2017-12-16 09:55:33.853374561
> -0500
> +++ b/drivers/gpu/drm/drm_atomic_helper.c 2017-12-16 10:55:56.089090752
> -0500
> @@ -889,7 +889,7 @@ disable_outputs(struct drm_device *dev,
> continue;
>
> ret = drm_crtc_vblank_get(crtc);
> - WARN_ONCE(ret != -EINVAL, "driver forgot to call
> drm_crtc_vblank_off()\n");
> + WARN_ONCE((ret != -EINVAL && ret != -ENOSYS), "driver forgot to
> call drm_crtc_vblank_off()\n");
> if (ret == 0)
> drm_crtc_vblank_put(crtc);
> }
>
===============================================
The 4.15 drm_atomic_helper driver shows a warning during boot.
It is caused by a mismatch between the result of vmw_enable_vblank() and
what the drm_atomic_helper expects:
/...
ret = drm_crtc_vblank_get(crtc);
WARN_ONCE(ret != -EINVAL, "driver forgot to call drm_crtc_vblank_off()\n");
/...
Signed-off by: Woody Suwalski <terraluna977@gmail.com>
--- a/drivers/gpu/drm/drm_atomic_helper.c 2017-12-16 09:55:33.853374561 -0500
+++ b/drivers/gpu/drm/drm_atomic_helper.c 2017-12-16 10:55:56.089090752 -0500
@@ -889,7 +889,7 @@ disable_outputs(struct drm_device *dev,
continue;
ret = drm_crtc_vblank_get(crtc);
- WARN_ONCE(ret != -EINVAL, "driver forgot to call drm_crtc_vblank_off()\n");
+ WARN_ONCE((ret != -EINVAL && ret != -ENOSYS), "driver forgot to call drm_crtc_vblank_off()\n");
if (ret == 0)
drm_crtc_vblank_put(crtc);
}
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 11+ messages in thread
* drm: fix vmwgfx boot warning WAS Re: [PATCH] [RESEND] vmwgfx: use monotonic event timestamps
2018-01-16 21:39 ` Woody Suwalski
@ 2018-01-17 6:33 ` Thomas Hellstrom
-1 siblings, 0 replies; 11+ messages in thread
From: Thomas Hellstrom @ 2018-01-17 6:33 UTC (permalink / raw)
To: Woody Suwalski, VMware Graphics, David Airlie
Cc: y2038, Deepak Singh Rawat, Patrik Jakobsson, Alex Deucher,
Arvind Yadav, dri-devel, linux-kernel
Hi, Woody,
On 01/16/2018 10:39 PM, Woody Suwalski wrote:
> Thomas, the same way my DRM patch has disappeared:
> Date
>
> Tue, 19 Dec 2017 11:50:57 -0800
> From Sinclair Yeh <>
> Subject Re: [PATCH v.2] 4.15 vmgfx boot warning
>
>
>
>
> This looks okay to me.
Since this is a core DRM patch I think Sinclair was expecting it to be
pulled in using the drm-misc tree. Did you get a comment from Daniel on
this patch?
Thanks,
Thomas
^ permalink raw reply [flat|nested] 11+ messages in thread
* drm: fix vmwgfx boot warning WAS Re: [PATCH] [RESEND] vmwgfx: use monotonic event timestamps
@ 2018-01-17 6:33 ` Thomas Hellstrom
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Hellstrom @ 2018-01-17 6:33 UTC (permalink / raw)
To: Woody Suwalski, VMware Graphics, David Airlie
Cc: y2038, linux-kernel, dri-devel, Alex Deucher, Arvind Yadav,
Deepak Singh Rawat
Hi, Woody,
On 01/16/2018 10:39 PM, Woody Suwalski wrote:
> Thomas, the same way my DRM patch has disappeared:
> Date
>
> Tue, 19 Dec 2017 11:50:57 -0800
> From Sinclair Yeh <>
> Subject Re: [PATCH v.2] 4.15 vmgfx boot warning
>
>
>
>
> This looks okay to me.
Since this is a core DRM patch I think Sinclair was expecting it to be
pulled in using the drm-misc tree. Did you get a comment from Daniel on
this patch?
Thanks,
Thomas
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: drm: fix vmwgfx boot warning WAS Re: [PATCH] [RESEND] vmwgfx: use monotonic event timestamps
2018-01-17 6:33 ` Thomas Hellstrom
@ 2018-01-17 8:19 ` Thomas Hellstrom
-1 siblings, 0 replies; 11+ messages in thread
From: Thomas Hellstrom @ 2018-01-17 8:19 UTC (permalink / raw)
To: Thomas Hellstrom, Woody Suwalski, VMware Graphics, David Airlie
Cc: y2038, linux-kernel, dri-devel, Alex Deucher, Arvind Yadav,
Deepak Singh Rawat
On 01/17/2018 07:33 AM, Thomas Hellstrom wrote:
> Hi, Woody,
>
> On 01/16/2018 10:39 PM, Woody Suwalski wrote:
>> Thomas, the same way my DRM patch has disappeared:
>> Date
>>
>> Tue, 19 Dec 2017 11:50:57 -0800
>> From Sinclair Yeh <>
>> Subject Re: [PATCH v.2] 4.15 vmgfx boot warning
>>
>>
>>
>>
>> This looks okay to me.
>
> Since this is a core DRM patch I think Sinclair was expecting it to be
> pulled in using the drm-misc tree. Did you get a comment from Daniel
> on this patch?
>
> Thanks,
> Thomas
>
Actually, checkpatch.pl complains about -ENOSYS, so I'm sending a pull
request for v1 of this patch instead, to make everybody happy. I've
rephrased the commit log somewhat. Hope that's OK.
/Thomas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: drm: fix vmwgfx boot warning WAS Re: [PATCH] [RESEND] vmwgfx: use monotonic event timestamps
@ 2018-01-17 8:19 ` Thomas Hellstrom
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Hellstrom @ 2018-01-17 8:19 UTC (permalink / raw)
To: Thomas Hellstrom, Woody Suwalski, VMware Graphics, David Airlie
Cc: y2038, linux-kernel, dri-devel, Alex Deucher, Arvind Yadav,
Deepak Singh Rawat
On 01/17/2018 07:33 AM, Thomas Hellstrom wrote:
> Hi, Woody,
>
> On 01/16/2018 10:39 PM, Woody Suwalski wrote:
>> Thomas, the same way my DRM patch has disappeared:
>> Date
>>
>> Tue, 19 Dec 2017 11:50:57 -0800
>> From Sinclair Yeh <>
>> Subject Re: [PATCH v.2] 4.15 vmgfx boot warning
>>
>>
>>
>>
>> This looks okay to me.
>
> Since this is a core DRM patch I think Sinclair was expecting it to be
> pulled in using the drm-misc tree. Did you get a comment from Daniel
> on this patch?
>
> Thanks,
> Thomas
>
Actually, checkpatch.pl complains about -ENOSYS, so I'm sending a pull
request for v1 of this patch instead, to make everybody happy. I've
rephrased the commit log somewhat. Hope that's OK.
/Thomas
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] [RESEND] vmwgfx: use monotonic event timestamps
2018-01-16 17:28 ` Thomas Hellstrom
(?)
(?)
@ 2018-01-16 21:53 ` Arnd Bergmann
-1 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-01-16 21:53 UTC (permalink / raw)
To: Thomas Hellstrom
Cc: VMware Graphics, Sinclair Yeh, David Airlie, y2038 Mailman List,
Deepak Singh Rawat, Patrik Jakobsson, Alex Deucher, Arvind Yadav,
dri-devel, Linux Kernel Mailing List
On Tue, Jan 16, 2018 at 6:28 PM, Thomas Hellstrom <thellstrom@vmware.com> wrote:
> Hi, Arnd,
>
> Sinclair's on paternal leave and I thought this patch was already in
> drm-next. My bad.
No worries.
> Dave, is it too late to pull this in for the next merge window?
The patch isn't urgent, it's fine to wait until after the merge window, I just
want to avoid having to send it once more as I make my way through
the remaining 'timeval' and 'timespec' users.
Arnd
^ permalink raw reply [flat|nested] 11+ messages in thread