[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <351024f7-fa28-da69-624f-b07f7db97c68@vmware.com>
Date: Tue, 16 Jan 2018 18:28:31 +0100
From: Thomas Hellstrom <thellstrom@...are.com>
To: Arnd Bergmann <arnd@...db.de>,
VMware Graphics <linux-graphics-maintainer@...are.com>,
Sinclair Yeh <syeh@...are.com>, David Airlie <airlied@...ux.ie>
Cc: y2038@...ts.linaro.org, Deepak Singh Rawat <drawat@...are.com>,
Patrik Jakobsson <patrik.r.jakobsson@...il.com>,
Alex Deucher <alexander.deucher@....com>,
Arvind Yadav <arvind.yadav.cs@...il.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [RESEND] vmwgfx: use monotonic event timestamps
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@...db.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);
Powered by blists - more mailing lists