From mboxrd@z Thu Jan 1 00:00:00 1970 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 3B070E9A05A for ; Thu, 19 Feb 2026 18:07:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C6A9810E731; Thu, 19 Feb 2026 18:07:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="byLL3nrv"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id B358B10E72F for ; Thu, 19 Feb 2026 18:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1771524423; x=1803060423; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x5KbasrZW1NhJyEvXTUpMkf75LQDh4/qIunrmj1G5qI=; b=byLL3nrvRwIYz8yT3vI/9zftPeafKuIoI3CgEq6gvDanZj3TLSWM4Ktv VJdXz7mYcm9U4fY6hW8nq1CJXH/LWCVVxgsMed/wYXOeV5s9kJD7FMmrP MrG4ZFjM++7PVYcavOCZ0NASQiyq6s5zB/L1sAtOCEB1yacA9LBrRPMYh orDP66HyrBRv++JNExZBvkOGfiNNkA4LWUjhDcE35VdNJ3XGkQ+4e8ULT HxXPo3eo3aA1PXljpJruprmU4TzxG1RY1s/bv3CqhsV1Wu0LHr/CLE/Cr KM66mglI3LPTMEol/GYa7UuAwBher3QWHGKPrB7hu7jt8GcIHjx/olrxd A==; X-CSE-ConnectionGUID: zTu70/h2Sn+taERejC/0Gg== X-CSE-MsgGUID: tRLU8aw8RmamuEtV8x9UKQ== X-IronPort-AV: E=McAfee;i="6800,10657,11706"; a="76482815" X-IronPort-AV: E=Sophos;i="6.21,300,1763452800"; d="scan'208";a="76482815" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2026 10:07:03 -0800 X-CSE-ConnectionGUID: Dbzul6f1S9WPPSLsUfD5HA== X-CSE-MsgGUID: 5hD4jGYRSQKPPdVSHbA+DQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,300,1763452800"; d="scan'208";a="245189024" Received: from guc-pnp-dev-box-1.fm.intel.com ([10.1.39.24]) by orviesa002.jf.intel.com with ESMTP; 19 Feb 2026 10:07:03 -0800 From: Zhanjun Dong To: intel-xe@lists.freedesktop.org Cc: Wajdeczko@freedesktop.org, Michal , Zhanjun Dong , stable@vger.kernel.org, Matthew Brost Subject: [PATCH v7 3/7] drm/xe: Trigger queue cleanup if not in wedged mode 2 Date: Thu, 19 Feb 2026 13:06:57 -0500 Message-Id: <20260219180701.2418453-4-zhanjun.dong@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219180701.2418453-1-zhanjun.dong@intel.com> References: <20260219180701.2418453-1-zhanjun.dong@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" The intent of wedging a device is to allow queues to continue running only in wedged mode 2. In other modes, queues should initiate cleanup and signal all remaining fences. Fix xe_guc_submit_wedge to correctly clean up queues when wedge mode != 2. Fixes: 7dbe8af13c18 ("drm/xe: Wedge the entire device") Cc: stable@vger.kernel.org Signed-off-by: Matthew Brost Signed-off-by: Zhanjun Dong --- drivers/gpu/drm/xe/xe_guc_submit.c | 34 ++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c index bfb176c201c7..91c7600a59f5 100644 --- a/drivers/gpu/drm/xe/xe_guc_submit.c +++ b/drivers/gpu/drm/xe/xe_guc_submit.c @@ -1319,6 +1319,7 @@ static void disable_scheduling_deregister(struct xe_guc *guc, */ void xe_guc_submit_wedge(struct xe_guc *guc) { + struct xe_device *xe = guc_to_xe(guc); struct xe_gt *gt = guc_to_gt(guc); struct xe_exec_queue *q; unsigned long index; @@ -1333,20 +1334,27 @@ void xe_guc_submit_wedge(struct xe_guc *guc) if (!guc->submission_state.initialized) return; - err = devm_add_action_or_reset(guc_to_xe(guc)->drm.dev, - guc_submit_wedged_fini, guc); - if (err) { - xe_gt_err(gt, "Failed to register clean-up in wedged.mode=%s; " - "Although device is wedged.\n", - xe_wedged_mode_to_string(XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET)); - return; - } + if (xe->wedged.mode == 2) { + err = devm_add_action_or_reset(guc_to_xe(guc)->drm.dev, + guc_submit_wedged_fini, guc); + if (err) { + xe_gt_err(gt, "Failed to register clean-up on wedged.mode=2; " + "Although device is wedged.\n"); + return; + } - mutex_lock(&guc->submission_state.lock); - xa_for_each(&guc->submission_state.exec_queue_lookup, index, q) - if (xe_exec_queue_get_unless_zero(q)) - set_exec_queue_wedged(q); - mutex_unlock(&guc->submission_state.lock); + mutex_lock(&guc->submission_state.lock); + xa_for_each(&guc->submission_state.exec_queue_lookup, index, q) + if (xe_exec_queue_get_unless_zero(q)) + set_exec_queue_wedged(q); + mutex_unlock(&guc->submission_state.lock); + } else { + /* Forcefully kill any remaining exec queues, signal fences */ + xe_guc_softreset(guc); + xe_guc_submit_stop(guc); + xe_uc_fw_sanitize(&guc->fw); + xe_guc_submit_pause_abort(guc); + } } static bool guc_submit_hint_wedged(struct xe_guc *guc) -- 2.34.1