From patchwork Wed Nov 14 16:14:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1742671 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 294173FC64 for ; Wed, 14 Nov 2012 16:28:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 02E15A02E8 for ; Wed, 14 Nov 2012 08:28:26 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B12CA02BB for ; Wed, 14 Nov 2012 08:25:29 -0800 (PST) Received: by mail-ee0-f49.google.com with SMTP id c1so385161eek.36 for ; Wed, 14 Nov 2012 08:25:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=KaQLf6V/TC7inprOkfvv6f4O7CWin9PIolGTWuqRPxI=; b=Vk9UZ8jzVYA65a1wvrR2kxCKAWEuu/fkiLuOMMFh5raM87mc4oEHbTwySZOc06kzTo eRb10UIo/vTKbk53fiBl+MJhAvtHyRwOmMORGtxh8m1KvIxOlpv286l8FLUN5fRUwGzr s+oqsA5hSJgpFnY65ck8xBFadNMw7D88q4weY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=KaQLf6V/TC7inprOkfvv6f4O7CWin9PIolGTWuqRPxI=; b=WV5F5Q/1kwDmdXb7m3wnidq6m5d/de+orDma+MVUGNX32NxwYEsVIqHtgaoXEIf3LS TzIzIMBteggVxRhxhFeawNf0wV4KflMT0wagAsDKtiBnPBKwciYnfy8nK/1M08nnGDl8 7SRDB6y+sMJowZkgoiHoOZYCwD9cweaPPY9poinQ8S0BXvOUSbhdSnDEgut3vP1A8CxE deD8smmnj/SLa239OYDyyuxbNvxi3HOVnOqKTPPTrG4b/ad9QVNPJ/XJ/EuzKtIPVnv5 6mTyvvrVeOta0hVDUR1bmdiTTD+W3BxmS7SnPjbYQvQVlclPtmVmwZi7RPo5z/a2GPLr nFYA== Received: by 10.14.178.195 with SMTP id f43mr88845765eem.44.1352910329054; Wed, 14 Nov 2012 08:25:29 -0800 (PST) Received: from fliege.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id b44sm30409682eep.12.2012.11.14.08.25.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Nov 2012 08:25:28 -0800 (PST) From: Daniel Vetter To: Intel Graphics Development Date: Wed, 14 Nov 2012 17:14:06 +0100 Message-Id: <1352909648-21514-5-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1352909648-21514-1-git-send-email-daniel.vetter@ffwll.ch> References: <1352909648-21514-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQnDwmDZWs8lM6YnFT7+06o7R/uDffwSxF2P5uywW0BiawwBXCAH4EsxqJNuEsje73eNdJ5L Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 4/6] drm/i915: fix reset handling in the throttle ioctl X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org While auditing the code I've noticed one place (the throttle ioctl) which does not yet wait for the reset handler to complete and doesn't properly decode the wedge state into -EAGAIN/-EIO. Fix this up by calling the right helpers. This might explain the oddball "my compositor just died in a successfull gpu reset" reports. Or maybe not, since current mesa doesn't use this ioctl to throttle command submission. The throttle ioctl doesn't take the struct_mutex, so to avoid busy-looping with -EAGAIN while a reset is in process, check for errors first and wait for the handler to complete if a reset is pending by calling i915_gem_wait_for_error. Signed-off-by: Daniel Vetter Reviewed-by: Damien Lespiau --- drivers/gpu/drm/i915/i915_gem.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index b2620c7..55cdad9 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -3402,8 +3402,13 @@ i915_gem_ring_throttle(struct drm_device *dev, struct drm_file *file) u32 seqno = 0; int ret; - if (atomic_read(&dev_priv->gpu_error.wedged)) - return -EIO; + ret = i915_gem_wait_for_error(&dev_priv->gpu_error); + if (ret) + return ret; + + ret = i915_gem_check_wedge(&dev_priv->gpu_error, false); + if (ret) + return ret; spin_lock(&file_priv->mm.lock); list_for_each_entry(request, &file_priv->mm.request_list, client_list) {