From patchwork Wed Mar 9 05:17:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 12774745 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 E3434C433EF for ; Wed, 9 Mar 2022 05:17:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 76CFB10E943; Wed, 9 Mar 2022 05:17:02 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id B823C10E936; Wed, 9 Mar 2022 05:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646803020; x=1678339020; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2mP6RRebQUE3vKxzk2Ezz1JjDoe9ZfqAwpTaqOWKV6w=; b=dgUqgIc6u8jmFA9/26c8BLg1RfKR0+Jex+PvoJLbXBx+aLxii3jDQjKa tA4rO3Y5x9OZRKrnQPyPP0bC6rQi4Eqjvu2yyLZsnEDEQ2t+pdtupQ005 zMij+Okit4o8nkRQixfCTfQq01l1nS5+fg4s/9Z5SBmDw2dVFoBVYH5yg u++qEc9Uo94Q6Tq9K+bIYWsdz8YiofkJ0PvNZ78oq5xvKrqVW3zdMplWz NoZtsXBxn/D8In2IW4QY9Lg5n7macj4yDCsBYcBUOdvh4h5jwoXaAusLM VP/gH1BYwLZqbaM0cgT83e7if3EdZC+ZC9rHzpBEpIfOFLX2s1TIoHXfX Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="255081144" X-IronPort-AV: E=Sophos;i="5.90,166,1643702400"; d="scan'208";a="255081144" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 21:17:00 -0800 X-IronPort-AV: E=Sophos;i="5.90,166,1643702400"; d="scan'208";a="711807557" Received: from ramaling-i9x.iind.intel.com ([10.203.144.108]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 21:16:57 -0800 From: Ramalingam C To: intel-gfx , dri-devel Date: Wed, 9 Mar 2022 10:47:07 +0530 Message-Id: <20220309051708.22644-8-ramalingam.c@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220309051708.22644-1-ramalingam.c@intel.com> References: <20220309051708.22644-1-ramalingam.c@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 7/8] 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: lucas.demarchi@intel.com, 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: Joonas Lahtinen Signed-off-by: Ramalingam C --- drivers/gpu/drm/i915/gt/selftest_lrc.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c index d8face764ee4..63fd508fea49 100644 --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c @@ -1530,20 +1530,17 @@ __lrc_isolation(struct intel_engine_cs *engine, u32 poison, bool relative) usleep_range(100, 500); err = poison_registers(B, engine, poison, relative, &sema); - if (err) { - WRITE_ONCE(*sema.va, -1); - i915_request_put(rq); - goto err_result1; - } - - if (i915_request_wait(rq, 0, HZ / 2) < 0) { + if (err == 0 && i915_request_wait(rq, 0, HZ / 2) < 0) { pr_err("%s(%s): wait for results timed out\n", __func__, engine->name); - i915_request_put(rq); err = -ETIME; - goto err_result1; } + + /* Always cancel the semaphore wait, just in case the GPU gets stuck */ + WRITE_ONCE(*sema.va, -1); i915_request_put(rq); + if (err) + goto err_result1; err = compare_isolation(engine, ref, result, A, poison, relative);