From patchwork Tue Nov 13 16:40:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1735301 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 1482EDF280 for ; Tue, 13 Nov 2012 16:52:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D44369EF28 for ; Tue, 13 Nov 2012 08:52:01 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com [209.85.215.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A2649E9DB for ; Tue, 13 Nov 2012 08:51:48 -0800 (PST) Received: by mail-ea0-f177.google.com with SMTP id n13so2908133eaa.36 for ; Tue, 13 Nov 2012 08:51:47 -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=HS9hys9fYV7NBdVcDM3FvGkl8GFHL3LNIV0gFw84TYA=; b=UeHl1xRLpp4YJXPR8PyVSk8XbSXe9Zg1L/7W2ZSTYjDvTGWdcI/lCVF+eq6VmVFaVP PD3wgWwOFE0b65ML1NaxC7ZzTar/g2OvcUaWHbYn/bzphPT7MV7cYApHWYq649UtoqiV vkhVXH4WaaDGgoDWXg/+h+tt+W8/uEu2UlAg4= 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=HS9hys9fYV7NBdVcDM3FvGkl8GFHL3LNIV0gFw84TYA=; b=ZyV7D9UH5knRI3971IV6bPdvAj3X+YDsT3M0iYdnxuhAAAIHupSpQfHnWtUejUgCw1 BybeT8LQv8W2hJ+vHBCh6otKLL18hA+9x/VhMv7+CdhQ6PF8ALmHB4dkYTIBoAn09q43 Kp/KwGh4DFOQ6/PSCa6MoDpgoe/JXqSB0YDIsvdTEpDzGuwyzDytO6XEzP2xf7/cQ2lj cv3brWfLXrM8u3nKx0ttkxEuMjqXf401k8wUcIeyjlzm5fKxs16guedWYykoQL4G/LBf CuGgdtC4KZMO4F20M1QFsQFmle6GOSgFCScB1WLSc3NLbsjru1rHAi7PWv+CeqRRa3CS 8zAQ== Received: by 10.14.223.4 with SMTP id u4mr76065605eep.19.1352825507307; Tue, 13 Nov 2012 08:51:47 -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 g47sm23638747eeo.6.2012.11.13.08.51.45 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Nov 2012 08:51:46 -0800 (PST) From: Daniel Vetter To: Intel Graphics Development Date: Tue, 13 Nov 2012 17:40:38 +0100 Message-Id: <1352824839-18911-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: References: X-Gm-Message-State: ALoCoQnn9ysPxLdngOhXbwewLdYaAQHN1GjrtoRTEGwDF5EyFPfYDR2rDT49SqFtD6nRRRNPahP+ Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 1/2] 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. 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 --- 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) {