Received: by 10.223.164.202 with SMTP id h10csp1860593wrb; Mon, 27 Nov 2017 08:25:37 -0800 (PST) X-Google-Smtp-Source: AGs4zMY8Be4q5QIRs3Egra6d966BXwplsDiJglCsHLq5GZdxKYVz1ycruOM34oEOEQAbO82BVV4m X-Received: by 10.101.90.8 with SMTP id y8mr27471138pgs.21.1511799937281; Mon, 27 Nov 2017 08:25:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511799937; cv=none; d=google.com; s=arc-20160816; b=mdwEXm+2kxwUOn49Esk3tLFES69fH9p4NdAqCXtWC9WkaqaPU3Nxd+GYCvlpy4HwPO YYfaCqTV1Dx54c4kK134hG7nHADLhbmV61i2QPn32MoVeMLSmnEeblwB3NQgSVurFAV/ 7ERo7b7i9wPovesqr9RMJatGX0Dud0Jn9bvhcAHLSp7zmR+Vaw75xIrBToCe+bye1n0E m9EoGx6EW7d4K+EhtWTZJU5FSnOqFeQup5h3gh7mrWqLOpVYVfdRmpjRJSl/poUOd1x3 wV+xCjJMExRc0Dx7Hv+9VmlQN6eXcGC9ypJwT5+VWPPH1xdtDS+IzedZOrHYgcYPNFL+ 6bIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=cqawPmUFU6qVbm5pW0Bdk5xR1TwHy3nEchFhcUIBuV0=; b=TjFGqjiGYckgRnEuuInERou/dQM/zl0u0M1g1s+6YbgEIFOchPmoSLBSHzjFsxaAe/ Av0m8EBmvdavE+/Cizj1CO1G9FCrchVtBYUkY6Ht48y0p3AGfeu8VXTShdYaxql/z/kn nu6E+PZScvNDfeTpWoqzR8mCqWeTytUlUqorQluY1+4/i5zr5Cioi2YM8L2F9MuFUfxL k37V64mIe2xq43dTQtCL03KsygCJMPWPwNTtDqgE6xvSE3slIDWVIBDE1XzKiJB2A8YH bCojcFQ7vgLVekyOvyxnNNmLPWcgMnkJQl10/kxCscMtPOD+FCwaVvhzJJT9foWJi59R jlSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=N+KNbuv2; 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 b75si25850711pfk.86.2017.11.27.08.25.25; Mon, 27 Nov 2017 08:25: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; dkim=fail header.i=@ffwll.ch header.s=google header.b=N+KNbuv2; 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 S1753371AbdK0QYs (ORCPT + 78 others); Mon, 27 Nov 2017 11:24:48 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34873 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753211AbdK0QYr (ORCPT ); Mon, 27 Nov 2017 11:24:47 -0500 Received: by mail-wm0-f68.google.com with SMTP id w73so7437965wmw.0 for ; Mon, 27 Nov 2017 08:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=cqawPmUFU6qVbm5pW0Bdk5xR1TwHy3nEchFhcUIBuV0=; b=N+KNbuv2bsaY7GTvvUSFAffY5WwBl+05U1kEn9QM25u9nRzYSaTXNGlx4gYeydo7gg 4+K5/Z9tQAC/H0ZlLY+9PMEsUQw6U4mtwZMu0bPNz15y6PjsJWfSSg5SjvndpwCgcCd8 Gv3VOmJwOJtRbB0egFVHzp4NUrHVqzvctKyJk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=cqawPmUFU6qVbm5pW0Bdk5xR1TwHy3nEchFhcUIBuV0=; b=HrNtn7GlH6TM53uj7YmkZVEMud0ACP3fjPGnxHvQyqcxkm7h2mG29uC4ctMynzrzQ3 E5RK87Ype8VbGniwF1Z+OEZ6xuJGEHm3XHbQsv4gkeNV6QXlWlpbF3wQlyWxgsJL9Rto JQBycdK/HogBDmXq1iHCfiVqanhDjes8iS+uvtje/svGKhQeinGA2K3rtJYajYsqkc5L gW5r2iRR4nndPyG4h5lXxzppliBMszvOzlqltzh5ENhBvEIGaASUguhh/OfJrhhllECt dpb001wS3xGf1hBPAd/e18aaiycj4mA0x7EPGrQOoHFF/ZPG8fdF2Lm67jnBhq9SvVMl /2kA== X-Gm-Message-State: AJaThX6IGxEXPv0Btk3v/iZJGruewhdNI45eeHUeB2pW5kkxRYQe1KZV RYXMql50I8voL2HJDYNZG9Gnew== X-Received: by 10.80.131.230 with SMTP id 93mr53092760edi.12.1511799885550; Mon, 27 Nov 2017 08:24:45 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id h20sm4154137edh.69.2017.11.27.08.24.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Nov 2017 08:24:44 -0800 (PST) Date: Mon, 27 Nov 2017 17:24:42 +0100 From: Daniel Vetter To: Arnd Bergmann Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] drm/via: use monotonic time for VIA_WAIT_IRQ Message-ID: <20171127162442.brlncy5wq3kntm45@phenom.ffwll.local> Mail-Followup-To: Arnd Bergmann , David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20171127111728.1710742-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171127111728.1710742-1-arnd@arndb.de> X-Operating-System: Linux phenom 4.13.0-1-amd64 User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 27, 2017 at 12:17:03PM +0100, Arnd Bergmann wrote: > 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. You need to check out _seriously_ old versions of mesa and X (plus it's drivers). Git ftw. The only caller I've found (in the Xv implementation of the via/openchrome ddx) doesn't even care about the timestamp. I'm mildly tempted to just report 0 always, but via isn't worth that much bother really. Applied, thanks for the patch. -Daniel > > Signed-off-by: Arnd Bergmann > --- > drivers/gpu/drm/via/via_irq.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > 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; > } > -- > 2.9.0 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch From 1585217844977779198@xxx Mon Nov 27 11:19:04 +0000 2017 X-GM-THRID: 1585217844977779198 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread