From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chia-I Wu Subject: [PATCH] drm/i915: fix wait ioctl with negative timeout Date: Sun, 12 Oct 2014 01:21:09 +0800 Message-ID: <1413048069-1436-1-git-send-email-olvaffe@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by gabe.freedesktop.org (Postfix) with ESMTP id D98AC6E036 for ; Sat, 11 Oct 2014 10:21:16 -0700 (PDT) Received: by mail-pd0-f172.google.com with SMTP id ft15so3401309pdb.3 for ; Sat, 11 Oct 2014 10:21:16 -0700 (PDT) Received: from holycrap.mydomain (122-116-71-67.HINET-IP.hinet.net. [122.116.71.67]) by mx.google.com with ESMTPSA id h4sm6752372pat.11.2014.10.11.10.21.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Oct 2014 10:21:16 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org When timeout_ns is negative, it really means to wait indefinitely instead of returning immediately. But since userspace can no longer rely on that, I am not sure if there is any point fixing it. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/i915/i915_gem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ad55b06..3da2d62 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2787,9 +2787,9 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) goto out; /* Do this after OLR check to make sure we make forward progress polling - * on this IOCTL with a timeout <=0 (like busy ioctl) + * on this IOCTL with a timeout == 0 (like busy ioctl) */ - if (args->timeout_ns <= 0) { + if (args->timeout_ns == 0) { ret = -ETIME; goto out; } @@ -2798,7 +2798,8 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); mutex_unlock(&dev->struct_mutex); - return __wait_seqno(ring, seqno, reset_counter, true, &args->timeout_ns, + return __wait_seqno(ring, seqno, reset_counter, true, + (args->timeout_ns > 0) ? &args->timeout_ns : NULL, file->driver_priv); out: -- 2.1.1