From patchwork Wed Nov 16 11:25:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 13044970 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 AD994C433FE for ; Wed, 16 Nov 2022 11:26:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A98E310E48A; Wed, 16 Nov 2022 11:26:21 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2936E10E487; Wed, 16 Nov 2022 11:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668597967; x=1700133967; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=caBLKR0K5Hn/2pyKFe7g3RceXmf+MKUWWxkOKzJWFss=; b=XgUUfSCjJ25XdFFcrolhlwPvSRhDQEEZq73duptcPxBVba1M0TdXFu6f DLztgWBKXK6BZSbthFs7qyXqKlbkYPpn39qNnht9psoR6UKvXu9Qg/u34 CxefLFbvTVf9UxFXAMBHfor1TYLQEKUnedutV5vjauzlesML8JoPXU0eA 5MPaseU/NVc4Cs5twmqT7n2dtnZZjtfs6er6yMfkyLp4Pg1/qOakgzi6X 5Ec589CDS+RJ2dm0Mxzl2vlcXDb5dc/WT5uSKbqM/lqJyeeYBEGxTUoJR UUBtfx1bDKlXTg0cnvkQKHaYZnEsAzzrOcyU7J/9Y1arrHN/ftwl8vWOB w==; X-IronPort-AV: E=McAfee;i="6500,9779,10532"; a="295885172" X-IronPort-AV: E=Sophos;i="5.96,167,1665471600"; d="scan'208";a="295885172" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2022 03:26:06 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10532"; a="670468973" X-IronPort-AV: E=Sophos;i="5.96,167,1665471600"; d="scan'208";a="670468973" Received: from jkrzyszt-mobl1.ger.corp.intel.com ([10.213.12.208]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2022 03:26:03 -0800 From: Janusz Krzysztofik To: Tvrtko Ursulin , Joonas Lahtinen Date: Wed, 16 Nov 2022 12:25:32 +0100 Message-Id: <20221116112532.36253-4-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221116112532.36253-1-janusz.krzysztofik@linux.intel.com> References: <20221116112532.36253-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/3] drm/i915: Never return 0 if request wait succeeds 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: intel-gfx@lists.freedesktop.org, Chris Wilson , dri-devel@lists.freedesktop.org, Daniel Vetter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" According to the docs of i915_request_wait_timeout(), its return value "may be zero if the request is unfinished after the timeout expires." However, 0 is also returned when the request is found finished right after the timeout has expired. Since the docs also state: "If the timeout is 0, it will return 1 if the fence is signaled.", return 1 also when the fence is found signaled after non-zero timeout has expired. Fixes: 7e2e69ed4678 ("drm/i915: Fix i915_request fence wait semantics") Signed-off-by: Janusz Krzysztofik Cc: stable@vger.kernel.org # v5.17 --- drivers/gpu/drm/i915/i915_request.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c index f949a9495758a..406ddfafbed4d 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -2079,6 +2079,8 @@ long i915_request_wait_timeout(struct i915_request *rq, timeout = io_schedule_timeout(timeout); } + if (!timeout) /* expired but signaled, we shouldn't return 0 */ + timeout = 1; __set_current_state(TASK_RUNNING); if (READ_ONCE(wait.tsk))