Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp273305yba; Fri, 5 Apr 2019 06:29:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzF0tOd/dOvbgaoCjsblnI8b6N2WAWtHXyQeZNN/wDPCo5Ldxn1w+Uu6gEFqJeOpmkDt/fS X-Received: by 2002:a17:902:f01:: with SMTP id 1mr12787084ply.41.1554470989037; Fri, 05 Apr 2019 06:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554470989; cv=none; d=google.com; s=arc-20160816; b=ZJlrMoPXbyMLCEC24Bak8i/yJfhKdfaOafuaq5aVeOzdiYEdhn/vxH7ohBodP1tbJD sPhkFhgrfVBfGWryeKPMCbyCEi46eu43/mIB+lQ9TE0KRnp9RPUe8ws2SgsuazcQE1XR 1tMAlszLrYnPTn7wiKNH7QAtuplAyUo4f3zW89OtbEsXnkYhgoG4o02WR/Lq+6c1Uzqu qfepPZqo+fEhdFL+UC/9CzfgLoE3SFXF+YwRFMLXa3lpc5slXKRbmZR8cdHyUT+9tHNX TN4mkHUoLeitwHSY8VVPOsFsB96orIs46PGWEOQ+Hg5EnNyMhtO6kQWW3I+l/VEorjG9 nJPw== 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=qY3ZgmHgIyQEDdhnym5uVFLipnpfA4sv5wp6iBLV26M=; b=HDb1wlqK5Uk5Z3+aeps2t4ODY6xshcCCuPdHyiisyhGR3xYEtoCwHN/kpZPOzH0liR RAai6LNR58wFdBiQM5D6577HcMkzyaHmhzrr/04c2s/4AlW11r1mq0LJ0Yg+agqYmHF7 RxTmcb9FWrMrbZ+QvDVVLeg4lLNZa1rmDxWOadFquOHxnzbxcwc78yRKCQGi8Q0MKAUP tG1TDph8FYaw79gYxSKEH/57yt/s82AXLd5XGIhmU7dt5k5cduTKLBpNDJEUkCPrfxRI 9/p9+s3ncgk+VXCtwZo9hHQZe5Kh3axMwZ/JxDCIJcAZtMcmdIWWR+iSnbMWH7BWDvb8 TpPg== 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 f16si19127008pgj.149.2019.04.05.06.29.33; Fri, 05 Apr 2019 06:29:49 -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 S1730440AbfDEN2Q (ORCPT + 99 others); Fri, 5 Apr 2019 09:28:16 -0400 Received: from mga03.intel.com ([134.134.136.65]:27646 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbfDEN2Q (ORCPT ); Fri, 5 Apr 2019 09:28:16 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:28:15 -0700 X-IronPort-AV: E=Sophos;i="5.60,312,1549958400"; d="scan'208";a="220877453" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2019 06:28:12 -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 v2] drm/i915: Don't panic on non-empty list of free cachelines Date: Fri, 5 Apr 2019 15:28:06 +0200 Message-Id: <20190405132806.8508-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 From: Janusz Krzysztofik If there are active users of a device during driver unbind, the driver now panics on non-empty list of free cachelines. By design, cachelines which are not in use are kept on a list of free cachelines associated with a timeline and removed from that list either when in use or when the timeline is destroyed. Timelines in turn are assigned to open file descriptors. As long as a device file is open, its associated timeline with its list of free cachelines will be hopefully destroyed on device close, either while outstanding execlists are destroyed or on i915_timeline_put() called directly, so as long as device file descriptors are protected from unwanted user activities by the device being marked unplugged, there should be no reason to panic. Moreover, timeline mutex which is destroyed right after the check for emptyness of a free cacheline list succeeds is never used to protect that list, only a list of active cachelines, so it can be freely destroyed even if the former is not empty. Since the desired behavior is to clean up active contexts first, unpinning the contexts and resources, and so letting the timeline be freed, the panic is there to say that i915_timelines_fini() is called to early. Don't remove the check completely then but convert it from the BUG() to a WARN() so the indication a long term fix is needed is still given. Signed-off-by: Janusz Krzysztofik --- drivers/gpu/drm/i915/i915_timeline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_timeline.c b/drivers/gpu/drm/i915/i915_timeline.c index b2202d2e58a2..965fd3052b25 100644 --- a/drivers/gpu/drm/i915/i915_timeline.c +++ b/drivers/gpu/drm/i915/i915_timeline.c @@ -325,7 +325,7 @@ void i915_timelines_fini(struct drm_i915_private *i915) struct i915_gt_timelines *gt = &i915->gt.timelines; GEM_BUG_ON(!list_empty(>->active_list)); - GEM_BUG_ON(!list_empty(>->hwsp_free_list)); + GEM_WARN_ON(!list_empty(>->hwsp_free_list)); mutex_destroy(>->mutex); } -- 2.20.1