From patchwork Mon Nov 27 11:17:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 119670 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp1552981edl; Mon, 27 Nov 2017 03:17:37 -0800 (PST) X-Google-Smtp-Source: AGs4zMYFJ02OfyT6rjkKsWWBwL8uzaTJ8gePiO++HOlC9eYB5FUVwn9ArtG6aG4VoJuj677IvXNd X-Received: by 10.98.212.12 with SMTP id a12mr36113518pfh.164.1511781457249; Mon, 27 Nov 2017 03:17:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511781457; cv=none; d=google.com; s=arc-20160816; b=sCr8FPtIBY9UtUEhmgiU/WUT3t6HNUZU8O1l0igNQO24l8ooJpZaubWwnAhuwcJJCh qCZ0At0hgk8biaMAOaUKgqrnx2BTyko3DPa/je85Ogxe2EWhnKAeMSVnUfXBS3zF2w6A 5DtmEvgCDV20Tk1G6xr/viMLh3MKQG9LbxXstrMBOyif28RI4tPfRwSQTkKrbCBSWpzh nbRkpWSMUXl6tPMSBIZ22ib62t95t0GVQ+tMZy+d6fZipRb9r4VSasQOUoTJtx2sXTU/ PDF/cBnHChbUSUgXJ/YDrxRMlZLhHyl2xo3G0OWAKaENpw2n794Dy2hRCK2qR6e3AH7+ HzEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3C0l3ZJ1k6yphcg9Wg5dTgeVi0okb/RBYzqTIVdDWp8=; b=FgtzN9T2ajZRcv5jGrTXFJ5l11tiOkp2ArSuH2jKFr2Xlj+wzuWNXMdYSLeLVhuB8x XDZ5EWraiSXIm86YHJgDdj7wmTgw58tPhkSJ6lQIJUfB08iPAwRjqWlcSA+1vQsY2dPB CbtMhYejfG98aATRmJsYyejtQT+IKqiD/23za1eyKajdE1x8oESEsg0xdMrp/+Q+P9L6 w3j7/4rvlnmf+4JH47iWPc5wLrd1TCgOAzsKSvN1JvR54LDzRj1HWbTuiyLjVvb3/ejf n2sG1zWc/7cmz3ZF93i3p1phhFL1nM9OAODq+yWfAhFh3x9nhmklurOogriObRGtg/pf mmfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1si22755593pgn.655.2017.11.27.03.17.36; Mon, 27 Nov 2017 03:17:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751684AbdK0LRe (ORCPT + 28 others); Mon, 27 Nov 2017 06:17:34 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:58146 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751292AbdK0LRd (ORCPT ); Mon, 27 Nov 2017 06:17:33 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0MDpnS-1eLz7P00kQ-00H93p; Mon, 27 Nov 2017 12:17:29 +0100 From: Arnd Bergmann To: David Airlie , Arnd Bergmann Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/via: use monotonic time for VIA_WAIT_IRQ Date: Mon, 27 Nov 2017 12:17:03 +0100 Message-Id: <20171127111728.1710742-1-arnd@arndb.de> X-Mailer: git-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== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The normal DRM vblank interrupt events started using monotonic times in commit c61eef726a78 ("drm: add support for monotonic vblank timestamps"), which is useful for a number of reasons, including the possible y2038 overflow. The VIA_WAIT_IRQ ioctl uses the same drm_wait_vblank_reply as DRM_IOCTL_WAIT_VBLANK, but still uses wall-clock time. This converts it to using monotonic time as well, which is more consistent, and avoids problems with the y2038 overflow as well as synchronization issues when the real time skips. I could not find the matching user space that calls the VIA_WAIT_IRQ ioctl to verify that this is safe, but it very likely is. Please either test or review the user space side before applying this. Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/via/via_irq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.9.0 diff --git a/drivers/gpu/drm/via/via_irq.c b/drivers/gpu/drm/via/via_irq.c index 24e71578af4d..c96830ccc0ec 100644 --- a/drivers/gpu/drm/via/via_irq.c +++ b/drivers/gpu/drm/via/via_irq.c @@ -343,7 +343,7 @@ void via_driver_irq_uninstall(struct drm_device *dev) int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv) { drm_via_irqwait_t *irqwait = data; - struct timeval now; + struct timespec64 now; int ret = 0; drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; drm_via_irq_t *cur_irq = dev_priv->via_irqs; @@ -377,9 +377,9 @@ int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv) ret = via_driver_irq_wait(dev, irqwait->request.irq, force_sequence, &irqwait->request.sequence); - do_gettimeofday(&now); + ktime_get_ts64(&now); irqwait->reply.tval_sec = now.tv_sec; - irqwait->reply.tval_usec = now.tv_usec; + irqwait->reply.tval_usec = now.tv_nsec / NSEC_PER_USEC; return ret; }