From patchwork Sat Oct 11 17:21:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chia-I Wu X-Patchwork-Id: 5069631 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 44DAE9F295 for ; Sat, 11 Oct 2014 17:21:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7DFD32017D for ; Sat, 11 Oct 2014 17:21:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 953DC20160 for ; Sat, 11 Oct 2014 17:21:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AF796E036; Sat, 11 Oct 2014 10:21:18 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=jQPXOl3T9HKBylRTCggGpwf3S48UnHUv7uvNB9l06WI=; b=SYJazIBAol0FbbcjhEDhcoJB+swCmtZNrua9lYgBRtfjutVAwt6xn8atNxCDkTEloi Wbpj/i0w8QBYIJH7Xz5lqfcNy+vKislbewUlYZCzibn6Xo/Uqh6JFHpmMdE1lC5cbohn IhMeSBq2B9gYhwLiKaxgmpgt/yMw8sxWpv1axirfod44O6J8QBsli++Ia7nkqUvdu262 L//9X0Mkv2NSoe9Kzz3PjDy3oJaacRk06cRnLLtq8k1nxe1tWWv6Dec0w3cy8dYGUOLP rrNeCbr9aH0wgqwRsjoH5nxBu8UNznlin+CHEFdgFwV3EqC3JIH8QagHEDDacNA/D78I 8pPA== X-Received: by 10.66.140.76 with SMTP id re12mr2150723pab.141.1413048076563; 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) From: Chia-I Wu To: intel-gfx@lists.freedesktop.org Date: Sun, 12 Oct 2014 01:21:09 +0800 Message-Id: <1413048069-1436-1-git-send-email-olvaffe@gmail.com> X-Mailer: git-send-email 2.1.1 Subject: [Intel-gfx] [PATCH] drm/i915: fix wait ioctl with negative timeout X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: