From patchwork Mon Mar 28 17:25:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12793976 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 22D8FC433EF for ; Mon, 28 Mar 2022 17:26:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 731B610E733; Mon, 28 Mar 2022 17:26:37 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id E35AD10E730 for ; Mon, 28 Mar 2022 17:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648488390; x=1680024390; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=UwAg1t85iKs3sigMVX36FFVsnsFmokWgPZCSyA/FAz4=; b=hiupeKr2TCGQpOCrVuyARFnY8YzxbxM2oMiqUtV3fMsMbNRdN6bKDaXR jaGIoyP5Vr4F5lMMfdYBEhVb1IXx/RePDIdwLdK7HPN0guZpAQfEFp1Q3 GO8bSmxKommECMzuRSLgFl1KDw+ovtMY4X24tJb79uD2YaBKYTSViodhF fgo/l5wjXPrBDu9xMVG7BuCEVGwNTkdpKbLDkxRcgjM6UF9e/U2pYThNQ wlG3UDNjQ+IN54NwADoBnlYY1XI6/wDR5Ci5jn6WA0WSCchyIH4+dTFu3 y+qhFpYX6VLIDD9E33k9iQB/wUvl+yJoxUDWq+10OxlL2u3yZz2Rl0I8V w==; X-IronPort-AV: E=McAfee;i="6200,9189,10300"; a="256637145" X-IronPort-AV: E=Sophos;i="5.90,218,1643702400"; d="scan'208";a="256637145" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 10:26:30 -0700 X-IronPort-AV: E=Sophos;i="5.90,218,1643702400"; d="scan'208";a="521107946" Received: from khogan-mobl1.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.252.19.170]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 10:26:29 -0700 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Date: Mon, 28 Mar 2022 18:25:51 +0100 Message-Id: <20220328172551.43309-4-matthew.auld@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220328172551.43309-1-matthew.auld@intel.com> References: <20220328172551.43309-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [CI 4/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: , 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 --- 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 6c394d0c0fb0..c7eead0f0d8f 100644 --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c @@ -1435,18 +1435,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);