From patchwork Thu Sep 5 09:09:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11132481 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2125A1395 for ; Thu, 5 Sep 2019 09:10:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 055BB2145D for ; Thu, 5 Sep 2019 09:10:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 055BB2145D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E309B89D1D; Thu, 5 Sep 2019 09:10:00 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE05689CFA for ; Thu, 5 Sep 2019 09:09:58 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2019 02:09:59 -0700 X-IronPort-AV: E=Sophos;i="5.64,470,1559545200"; d="scan'208";a="173878654" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.17]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2019 02:09:55 -0700 From: Janusz Krzysztofik To: Chris Wilson , Daniele Ceraolo Spurio , Tvrtko Ursulin Date: Thu, 5 Sep 2019 11:09:49 +0200 Message-Id: <20190905090949.30424-1-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915: Don't unwedge if reset is disabled X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" When trying to reset a device with reset capability disabled or not supported while rings are full of requests, it has been observed when running in execlists submission mode that command stream buffer tail tends to be incremented by apparently still running GPU regardless of all requests being already cancelled and command stream buffer pointers reset. As a result, kernel panic on NULL pointer dereference occurs when a trace_ports() helper is called with command stream buffer tail incremented but request pointers being NULL during final __intel_gt_set_wedged() operation called from intel_gt_reset(). Skip actual reset procedure if reset is disabled or not supported. Suggested-by: Daniele Ceraolo Spurio Signed-off-by: Janusz Krzysztofik --- drivers/gpu/drm/i915/gt/intel_reset.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c index b9d84d52e986..d75da124e280 100644 --- a/drivers/gpu/drm/i915/gt/intel_reset.c +++ b/drivers/gpu/drm/i915/gt/intel_reset.c @@ -932,25 +932,35 @@ void intel_gt_reset(struct intel_gt *gt, GEM_BUG_ON(!test_bit(I915_RESET_BACKOFF, >->reset.flags)); mutex_lock(>->reset.mutex); - /* Clear any previous failed attempts at recovery. Time to try again. */ - if (!__intel_gt_unset_wedged(gt)) - goto unlock; - if (reason) dev_notice(gt->i915->drm.dev, "Resetting chip for %s\n", reason); - atomic_inc(>->i915->gpu_error.reset_count); - - awake = reset_prepare(gt); if (!intel_has_gpu_reset(gt->i915)) { if (i915_modparams.reset) dev_err(gt->i915->drm.dev, "GPU reset not supported\n"); else DRM_DEBUG_DRIVER("GPU reset disabled\n"); - goto error; + + /* + * Don't unwedge if reset is disabled or not supported + * because we can't guarantee what the hardware status is. + */ + if (intel_gt_is_wedged(gt)) + goto unlock; } + /* Clear any previous failed attempts at recovery. Time to try again. */ + if (!__intel_gt_unset_wedged(gt)) + goto unlock; + + atomic_inc(>->i915->gpu_error.reset_count); + + awake = reset_prepare(gt); + + if (!intel_has_gpu_reset(gt->i915)) + goto error; + if (INTEL_INFO(gt->i915)->gpu_reset_clobbers_display) intel_runtime_pm_disable_interrupts(gt->i915);