From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380638; b=hjnrt3ghI87dLKQmS57TttdVogHiG49kB5nXhCcWJ7uonpeI2YJEUtN7cntTN4oLIXN0 umFTkKW6ALE+sQ677TN3ENaRnB3D0NHXPFWaYmHZm3e1KCCLkblSxf3538fA7x/Wqvd6C Ndz3mQcMTkmcWwhjz9ISqybqq4kA3SJOYazJhWoTJKAJo4SCdJCVsTdNnBO4sU6vQV79g 0501y8KWpC53mbVgEV2v3bJgSBBQGOnNC1iirM6MmDhn5A69MjjEbwfnxjppobMSQlJJH 7f6xG42/Lom6aknUHokaDZHpNsmcC6TcWSQptyUrueqEqyr9I9AXmb1oHmxSqavu+Bg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380638; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=6jAU5ZsESw1knCX7s51FOMqcHkUcTqFt8zo/3LAMr1I=; b=4ro+tWSDYrAZ+TAPhczNn1IzvtyN3CjWvuh2YEMO4EE3bXnhS43gKxFlrv89QC62imcu mhVZFUyoMt37JyxGEJnLJFW92aFef3ad99FMlFBmqd5CiqAsR+Vd0JDO6xZ2EZX4GGFsO QfrG6184GpbJxajaF5gg6O7pJsRfzqTHKsSozqH67cwYf/rl1j3aJ0A+BVkhoSwB3G+er c7Qb8RJYjYoADOLmnwylei4VgG25GohR5SlSdZPXNrvVRmysALVpy8WBER8KKjw/HmQ2Q GOeZrp30m0reQbOX/V4CUvdVycRewGJQRdV4JU9W9gzZbvff+Stv0OOdcMjAPoTQdTA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=V3l8IvSn; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7441606A32D; Fri, 4 Dec 2026 10:37:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=V3l8IvSn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DC6C1F00931; Fri, 4 Dec 2026 10:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380638; bh=6jAU5ZsESw1knCX7s51FOMqcHkUcTqFt8zo/3LAMr1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=V3l8IvSnFaM5oPkGyVnigr5c9Fd7yF4TNd8V3vpt4tYLhuPlaD87mVK4yLzMJqy+h 5QTYXW7uRna/GYfCZzM1ltjCS4n7ccVLY0rs5Q+GsemRPCpXsEndkC+5cVrYcoItri anIkYw3CxzoH5itR5zgXx/69HN9ThNz/1inFejNA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Matthew Brost , Zongyao Bai , Shuicheng Lin Subject: [PATCH 7.3 362/742] drm/xe/guc: Treat CT-disabled TLB invalidation as cancelled Date: Fri, 4 Dec 2026 19:03:46 +0900 Message-ID: <20261204100644.696208087@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zongyao Bai commit b865310c41f5b68c7de3bec86f205ba8cd284fd1 upstream. During a GT reset the GuC CT channel goes through two states before it is enabled again: gt_reset_worker() xe_uc_stop() ENABLED -> STOPPED send: -ECANCELED xe_tlb_inval_reset() do_gt_reset() do_gt_restart() xe_uc_sanitize_reset() STOPPED -> DISABLED send: -ENODEV GuC load, CT enable DISABLED -> ENABLED xe_tlb_inval_issue() treats -ECANCELED as "undelivered, report done", but -ENODEV is propagated to the caller. A userptr invalidation from an MMU notifier (e.g. munmap() on a fault-mode VM) issued in the DISABLED window thus trips the XE_WARN_ON() in xe_vma_userptr_do_inval() and taints the kernel: Tile0: GT1: GT: reset started WARNING: drivers/gpu/drm/xe/xe_userptr.c:133 at xe_vma_userptr_do_inval+0x340/0x4a0 [xe] RAX: 00000000ffffffed xe_vma_userptr_invalidate_start+0x4b7/0x7c0 [xe] __mmu_notifier_invalidate_range_start+0x247/0x370 unmap_vmas+0x1af/0x1c0 unmap_region+0x91/0xf0 ... The TLB invalidation ops contract is that the backend returns -ECANCELED when it is mid-reset. The reset invalidates all TLBs, so there is nothing left to do. Map -ENODEV to -ECANCELED in send_tlb_inval() so that every GuC TLB invalidation type handles it the same way, instead of only send_tlb_inval_ggtt_full() as done so far. The CT is also DISABLED across system suspend and runtime suspend. On resume from system suspend the GuC is reloaded with all TLBs invalid, so nothing is lost there either; user space and the MM kernel threads are frozen by then, so such a request is not expected anyway. A request issued while runtime suspended violates the PM rules and is still reported by the "Missing outer runtime PM protection" warning in xe_tlb_inval_fence_init(). Fixes: db16f9d90c1d ("drm/xe: Split TLB invalidation code in frontend and backend") Cc: stable@vger.kernel.org # v6.18+ Cc: Matthew Brost Signed-off-by: Zongyao Bai Reviewed-by: Shuicheng Lin Link: https://patch.msgid.link/20261116192220.3872267-2-zongyao.bai@intel.com Signed-off-by: Shuicheng Lin (cherry picked from commit c17474e39028c7fb5cd6b2fb0f0413d07b1bf232) Signed-off-by: Matthew Brost Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/xe/xe_guc_tlb_inval.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c +++ b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c @@ -31,12 +31,22 @@ static int send_tlb_inval(struct xe_guc *guc, const u32 *action, int len) { struct xe_gt *gt = guc_to_gt(guc); + int ret; xe_gt_assert(gt, action[1]); /* Seqno */ xe_gt_stats_incr(gt, XE_GT_STATS_ID_TLB_INVAL, 1); - return xe_guc_ct_send(&guc->ct, action, len, - G2H_LEN_DW_TLB_INVALIDATE, 1); + ret = xe_guc_ct_send(&guc->ct, action, len, G2H_LEN_DW_TLB_INVALIDATE, 1); + + /* + * A disabled CT can't deliver the request, and the GuC is reloaded + * with all TLBs invalid before the CT is enabled again, so there is + * nothing left to invalidate. Report it as cancelled, like a stopped CT. + */ + if (ret == -ENODEV) + return -ECANCELED; + + return ret; } #define MAKE_INVAL_OP_FLUSH(type, flush_cache) ((type << XE_GUC_TLB_INVAL_TYPE_SHIFT) | \