From patchwork Fri Mar 25 17:58:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Ceraolo Spurio X-Patchwork-Id: 12791894 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 981CEC433EF for ; Fri, 25 Mar 2022 18:04:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A15E8933C; Fri, 25 Mar 2022 18:04:19 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F63B10E769; Fri, 25 Mar 2022 18:04:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648231457; x=1679767457; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=uIj2vn0NEDn6EEIzxQkqGz+Rh1kiEMIU4TpCRurFyb8=; b=nyONb+KUIGs22afKGDvFuQUAMKmTkYBctAX5Zkt2Fz8Z2s04Xa8Eow0a Emo4mXuX3/l0bkYYvSA4ENyH1qqs1WN8iPQVx4IJOwsnBk4SbhF/sKK0Z 55lP4tuyQ496+ZWZTp1TU7oK3aoNrygGetr4Auvw0RwELXiLWV7QdhE8c /gbxiCew8Cgi/0/pjcz4nrgqKXKDXYnM1v32+6bkTlGjcDkDEvNIUIwSv VwsHZO6SHa1QUBXfAncsH2DvUOFfHLyBWw9fLe2zjKJ+EyDUZ0taitlHx /POLGmpF1//curwyoPXon7rtMFjnz+dGsbUKhEMFN0Mn9v1LyQ6e3mgMM w==; X-IronPort-AV: E=McAfee;i="6200,9189,10297"; a="258880162" X-IronPort-AV: E=Sophos;i="5.90,211,1643702400"; d="scan'208";a="258880162" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2022 11:04:10 -0700 X-IronPort-AV: E=Sophos;i="5.90,211,1643702400"; d="scan'208";a="561922917" Received: from valcore-skull-1.fm.intel.com ([10.1.27.19]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2022 11:04:10 -0700 From: Daniele Ceraolo Spurio To: intel-gfx@lists.freedesktop.org Date: Fri, 25 Mar 2022 10:58:39 -0700 Message-Id: <20220325175839.2717499-1-daniele.ceraolospurio@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915: fix remaining_timeout in intel_gt_retire_requests_timeout 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: dri-devel@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" In intel_gt_wait_for_idle, we use the remaining timeout returned from intel_gt_retire_requests_timeout to wait on the GuC being idle. However, the returned variable can have a negative value if something goes wrong during the wait, leading to us hitting a GEM_BUG_ON in the GuC wait function. To fix this, make sure to only return the timeout if it is positive. Fixes: b97060a99b01b ("drm/i915/guc: Update intel_gt_wait_for_idle to work with GuC") Signed-off-by: Daniele Ceraolo Spurio Cc: Matthew Brost Cc: John Harrison Reviewed-by: Matthew Brost --- drivers/gpu/drm/i915/gt/intel_gt_requests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt_requests.c b/drivers/gpu/drm/i915/gt/intel_gt_requests.c index edb881d756309..ef70c209976d8 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_requests.c +++ b/drivers/gpu/drm/i915/gt/intel_gt_requests.c @@ -197,7 +197,7 @@ out_active: spin_lock(&timelines->lock); active_count++; if (remaining_timeout) - *remaining_timeout = timeout; + *remaining_timeout = timeout > 0 ? timeout : 0; return active_count ? timeout : 0; }