Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp248949yba; Fri, 5 Apr 2019 06:04:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8yuVeIialupIn3JZ3kCL038cqGJPMccnIdqsTScVtUyanXPgDTclMmkYFD0tl8Li6v2dD X-Received: by 2002:a63:8848:: with SMTP id l69mr7560654pgd.137.1554469468938; Fri, 05 Apr 2019 06:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554469468; cv=none; d=google.com; s=arc-20160816; b=isXtmfHZ52L5yx2UsN6ZnIepzEgjbM1MMAskS5Othnyb2VjiIE/OTbm73oFBaGdJYp L54OPTPuOd4PdSIFXcPM+25UZPH2/dtE+zrdVBXTm08B+AqaN/YdqliVDDDyuZhJiuVl LUksFZDfZChEflEtL6vk3zAyyYJActsgKtflTsPGAiJVcSnvST8F9fsgyLyvYjxgzr3m R+JOME7ah7RA8qlSeNC6FXVDuhC5IKaPoNSUzfUdKUVc2XaNYZCTdVwOYdjMQm4gT0Nb WIuKXk/m9p8OxHa57azpjFKEiYdNLhjOm3M0LR+xDtkLuvZUz+KS7Gx/6zTc4sISo2/S ruRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RB6AcqjbDRrda7+NUU6/0Y3mLH1eWC490XYDD0LdzNE=; b=RiJdk0Dru/eZOpVam+p0WAPLf4TjuxDLkMRMb8KebOcXg8b4oMt3hEreks7XES5A39 BlSgA5MZ/4+POJGnzdX8wuoRqWIyhvRJjnmediM8Sw6W3PsRmIbXfasmVfgXRu/dxV/o GC3HaTM6TOdqVBSZRlWoO6JgH0IsRO5TrtGoxpdfJaWokl091u47H4W/LrFWyulHkM0g +54ywcdjFxFl4Koq+LlqAlpQOMvLzDSjgi/wl+GByOt5fPY1PtadHhctUu9ON6708P1M znYRPilEfvPFj6/IJJzeri/+RKzUi8ntqMF0mrYHXD1I/nOyv3MkHYqP01vtycbbwYS0 aVcw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n15si19383020pgg.308.2019.04.05.06.04.11; Fri, 05 Apr 2019 06:04:28 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730866AbfDENC7 (ORCPT + 99 others); Fri, 5 Apr 2019 09:02:59 -0400 Received: from mga05.intel.com ([192.55.52.43]:19432 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbfDENC6 (ORCPT ); Fri, 5 Apr 2019 09:02:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:02:58 -0700 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="148330402" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:02:55 -0700 From: Janusz Krzysztofik To: Joonas Lahtinen , Jani Nikula , Rodrigo Vivi Cc: David Airlie , Daniel Vetter , Chris Wilson , michal.wajdeczko@intel.com, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: [PATCH 2/2] drm/i915: Mark GEM wedged right after marking device unplugged Date: Fri, 5 Apr 2019 15:02:35 +0200 Message-Id: <20190405130235.7707-3-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190405130235.7707-1-janusz.krzysztofik@linux.intel.com> References: <20190405130235.7707-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As soon as a device is considered unplugged, not only prevent pending users from accessing the device structures but also cancel all their pending requests so all consumed resources can be cleaned up as soon as possible. Suggested-by: Chris Wilson Signed-off-by: Janusz Krzysztofik Reviewed-by: Chris Wilson --- drivers/gpu/drm/i915/i915_drv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 66163378c481..03a563ce7e6b 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1598,6 +1598,13 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv) i915_teardown_sysfs(dev_priv); drm_dev_unplug(&dev_priv->drm); + /* + * After unregistering the device to prevent any new users, cancel + * all in-flight requests so that we can quickly unbind the active + * resources. + */ + i915_gem_set_wedged(dev_priv); + i915_gem_shrinker_unregister(dev_priv); } -- 2.20.1