From patchwork Wed Oct 2 12:48:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11171037 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 C54F917E1 for ; Wed, 2 Oct 2019 12:48:57 +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 AB29220842 for ; Wed, 2 Oct 2019 12:48:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB29220842 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 5BAF96E20A; Wed, 2 Oct 2019 12:48:56 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 58D9C6E20A for ; Wed, 2 Oct 2019 12:48:54 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Oct 2019 05:48:54 -0700 X-IronPort-AV: E=Sophos;i="5.64,574,1559545200"; d="scan'208";a="221394721" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.17]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Oct 2019 05:48:51 -0700 From: Janusz Krzysztofik To: Petri Latvala Date: Wed, 2 Oct 2019 14:48:20 +0200 Message-Id: <20191002124820.1862-1-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH] drm/i915/debugfs: Only wedge if we have reset available 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" If we process DROP_RESET_ACTIVE and cancel all outstanding requests by forcing a GPU reset on a hardware with reset capabilities disabled or not supported, we certainly end up with a terminally wedged GPU, impossible to recover. That's probably not what we want. Before setting the GPU wedged, verify if we have GPU reset available and fail with -EBUSY if not. Suggested-by: Petri Latvala Signed-off-by: Janusz Krzysztofik Cc: Michał Wajdeczko Cc: Michał Winiarski Cc: Piotr Piórkowski Cc: Tomasz Lis Cc: Petri Latvala Cc: Tvrtko Ursulin Cc: Martin Peres --- drivers/gpu/drm/i915/i915_debugfs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index fec9fb7cc384..0774ca6e2a05 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -3627,8 +3627,17 @@ i915_drop_caches_set(void *data, u64 val) if (val & DROP_RESET_ACTIVE && wait_for(intel_engines_are_idle(&i915->gt), - I915_IDLE_ENGINES_TIMEOUT)) + I915_IDLE_ENGINES_TIMEOUT)) { + /* + * Only wedge if reset is supported and not disabled, otherwise + * we certainly end up with the GPU terminally wedged. Inform + * userspace about the problem instead. + */ + if (!intel_has_gpu_reset(&i915->gt)) + return -EBUSY; + intel_gt_set_wedged(&i915->gt); + } /* No need to check and wait for gpu resets, only libdrm auto-restarts * on ioctls on -EAGAIN. */