From patchwork Tue Sep 13 15:21:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12974920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 903DFC6FA89 for ; Tue, 13 Sep 2022 15:22:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BCECA10E771; Tue, 13 Sep 2022 15:22:55 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3414810E76C for ; Tue, 13 Sep 2022 15:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663082549; x=1694618549; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zwm0cflx4rRzBaeo2K4jHOVDUAkgjCAw0Na93+sxBEc=; b=Af2lr4UGmlgwyixGYZgWS1yRHxXtjvA+nrDhHrr7EuxqorItOpWWp6BP SaNVb9GroUsvR94Zv7r7TeMglOS0lGNPUUen1Ke18Xwp7jVv1tnJC3/IW Lek+JP0qwq94fa5MvUuj2evK18JFtbND1sm9pfOsceJPlkXOGJ2YlYWGx gzinJSG2O67V/4yDr5juJlEDufmoXCyT5tREv4DDdQZLy8pqs+AfBhJvu KF+22jRdYF7w3QSvzyEthAh7HsWY6W0Ov7sLCXvNuF1E9ztBYbucidkCw R4DkgMj4vvb8zSKlUimg7Mz+0acZ79PBRikavp70Cld/uzSLZU3YlAeEl w==; X-IronPort-AV: E=McAfee;i="6500,9779,10469"; a="298963991" X-IronPort-AV: E=Sophos;i="5.93,313,1654585200"; d="scan'208";a="298963991" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2022 08:22:29 -0700 X-IronPort-AV: E=Sophos;i="5.93,313,1654585200"; d="scan'208";a="593977936" Received: from abaczek-mobl.ger.corp.intel.com (HELO kdrobnik-desk.toya.net.pl) ([10.213.8.5]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2022 08:22:25 -0700 From: Karolina Drobnik To: intel-gfx@lists.freedesktop.org Date: Tue, 13 Sep 2022 17:21:50 +0200 Message-Id: <8b7781f7dbaf2791156491b76d5faa7852e5cbbb.1663081418.git.karolina.drobnik@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v5 3/4] drm/i915/selftest: Always cancel semaphore on error X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Hellstrom , Ramalingam C , Ramalingam C , Chris Wilson , Chris Wilson , CQ Tang Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Chris Wilson Ensure that we always signal the semaphore when timing out, so that if it happens to be stuck waiting for the semaphore we will quickly recover without having to wait for a reset. Reported-by: CQ Tang Signed-off-by: Chris Wilson Cc: CQ Tang cc: Joonas Lahtinen Signed-off-by: Ramalingam C Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/i915/gt/selftest_lrc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c index 8320eab7ac36..71e664fc87e9 100644 --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c @@ -1460,18 +1460,17 @@ static int __lrc_isolation(struct intel_engine_cs *engine, u32 poison) } err = poison_registers(B, poison, sema); - if (err) { - WRITE_ONCE(*sema, -1); - i915_request_put(rq); - goto err_result1; - } - - if (i915_request_wait(rq, 0, HZ / 2) < 0) { - i915_request_put(rq); + if (err == 0 && i915_request_wait(rq, 0, HZ / 2) < 0) { + pr_err("%s(%s): wait for results timed out\n", + __func__, engine->name); err = -ETIME; - goto err_result1; } + + /* Always cancel the semaphore wait, just in case the GPU gets stuck */ + WRITE_ONCE(*sema, -1); i915_request_put(rq); + if (err) + goto err_result1; err = compare_isolation(engine, ref, result, A, poison);