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 E2522C3ABD8 for ; Wed, 14 May 2025 22:54:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8683B10E047; Wed, 14 May 2025 22:54:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="HObFNCbW"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id B9EE910E047 for ; Wed, 14 May 2025 22:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1747263296; x=1778799296; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Lk74XXUTDGczt1K3klv0Ir9tK7oWof1oulBABmNHKnk=; b=HObFNCbW6qCFS+0LglbkpkqCctACSd2qtTsDEa2OZDHLK+U3zfQAgt4a y66thD3JlTZ5D/xKk65llc/GaRbkvmcyZxU9om0KlJJ6DWM0aAtXdBLou mWrHD+WwJDjPNRZVMQ3VpLCZJ8gu7FpLyWHpc80KkL/+pOYiAWq2uxH7X mM5o3v1XVSri08gkwqDbGEIWjr7ebBd4z3tg2AiiGK+ODRjvaUK4DxVP5 F+C2CJgJnXs75nVe4PjboqCKA2V4+2ITH6L9btzb4Vrletu72f9cMDJ+d NXfjuGttdTF++Kh7X7kOZQ2otyNvMQfhrRVBfDYkt2CJVJYMRoyQDlAV4 A==; X-CSE-ConnectionGUID: Zth+x7UkTKioayVPr0z4XA== X-CSE-MsgGUID: 4InFRQ60Q/WGtBERlHlkjw== X-IronPort-AV: E=McAfee;i="6700,10204,11433"; a="48434019" X-IronPort-AV: E=Sophos;i="6.15,289,1739865600"; d="scan'208";a="48434019" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2025 15:54:55 -0700 X-CSE-ConnectionGUID: N0YvK4XcRJCY/ZxvDV19XQ== X-CSE-MsgGUID: Bi4zFpUGQcmqdWCZB+XsQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,289,1739865600"; d="scan'208";a="138704144" Received: from jesusnar-desk.jf.intel.com ([10.165.21.207]) by orviesa007.jf.intel.com with ESMTP; 14 May 2025 15:54:55 -0700 From: Jesus Narvaez To: intel-gfx@lists.freedesktop.org Cc: Jesus Narvaez , Daniele Ceraolo Spurio , Alan Previn , Anshuman Gupta , Mousumi Jana , Rodrigo Vivi , Matt Roper Subject: [PATCH] drm/i915/guc: Check if expecting reply before decrementing outstanding_submission_g2h Date: Wed, 14 May 2025 15:52:24 -0700 Message-Id: <20250514225224.4142684-1-jesus.narvaez@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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" When sending a H2G message where a reply is expected in guc_submission_send_busy_loop(), outstanding_submission_g2h is incremented before the send. However, if there is an error sending the message, outstanding_submission_g2h is decremented without checking if a reply is expected. Therefore, check if reply is expected when there is a failure before decrementing outstanding_submission_g2h. Fixes: 2f2cc53b5fe7 ("drm/i915/guc: Close deregister-context race against CT-loss") Signed-off-by: Jesus Narvaez Cc: Daniele Ceraolo Spurio Cc: Alan Previn Cc: Anshuman Gupta Cc: Mousumi Jana Cc: Rodrigo Vivi Cc: Matt Roper --- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c index 39696ceea9a5..68bdf0c80ec3 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c @@ -633,7 +633,7 @@ static int guc_submission_send_busy_loop(struct intel_guc *guc, atomic_inc(&guc->outstanding_submission_g2h); ret = intel_guc_send_busy_loop(guc, action, len, g2h_len_dw, loop); - if (ret) + if (ret && g2h_len_dw) atomic_dec(&guc->outstanding_submission_g2h); return ret; -- 2.34.1