Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp181652yba; Fri, 5 Apr 2019 04:42:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPGfeNTH+ovdS7EJnEGutxC9/MjqfzBFHfvV4BPSDtKRF7vWtqMHOqoO4A3RlYCnkXg5pw X-Received: by 2002:a17:902:4643:: with SMTP id o61mr1717252pld.249.1554464520789; Fri, 05 Apr 2019 04:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554464520; cv=none; d=google.com; s=arc-20160816; b=JkVwujyLjydbo18d3ZFRcJyP2rCoZVu43zXkH60G/Y3iqpv9BOUsg6svbnorU215eX 5P4MasHH0dYXKf2TgVYjzMSOmHPSylBMRA8Kt7Vu49rmy01W1xE36l826zvaVdqZDyKy 7Dvon6rVjG5rJ2qdiCnQpfrJw2zpOEKjv7OnN/Pg0CfrFD7D144653t8vShMSTMOREHk t1DQglcNRTDEX6qbjTqr/1W7+f9Xk4dH+AK55IkMcFwqU97Wuzwvdf3HxdjEV/8C/SOd yreVHgZ22V4KT5AEASrnJc3MEpZ1hBCaJsB62pdWJvR73KFmOwlaMzlEAiYNdlxrJj6V 6CuQ== 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 :message-id:date:subject:cc:to:from; bh=yYuXm2MFe7LiM0N0wAm0DWKz/CBb5jbkilQ1UmUbYh4=; b=ITcbwc4nK0W7q55MxPJdqfKXTDUY/EEsIx6qiKCE0eFaWto9aCGxzSWYmckOHAqcuV brqjjquAa4hwwGOpZa21mm6qG6uuHzfyW0mTf5KeX5GMtdcDccfwNg5iK7YOH/QIhfRL HXXXzHZUZZTp8pFo9CdGfO63KAOtKM61VoLRNQzfWMiKPHkrGkV6L1995P2PRTTpWWOY QohMnZcc+HgDM1E+LUgI/lJPChfLXA8xccbYLii581/sPD8lU7pPq8/rZccw8a17qnu+ PJxkhxteRHDUuSDs0IBQEXPLdSf6WIfmtvzdiHwBuHmX8DFAket2+9LIHcyK+7y3HDzR 3w9w== 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 l40si19512138plb.164.2019.04.05.04.41.45; Fri, 05 Apr 2019 04:42:00 -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 S1731059AbfDELkw (ORCPT + 99 others); Fri, 5 Apr 2019 07:40:52 -0400 Received: from mga12.intel.com ([192.55.52.136]:50237 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730596AbfDELkv (ORCPT ); Fri, 5 Apr 2019 07:40:51 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 04:40:51 -0700 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="133226859" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 04:40:48 -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] drm/i915: Mark GEM wedged right after marking device unplugged Date: Fri, 5 Apr 2019 13:40:32 +0200 Message-Id: <20190405114032.5725-1-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.20.1 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. 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