From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C805606A31A for ; Tue, 1 Dec 2026 10:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lh9GXk4/ Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63AD710E242; Tue, 1 Dec 2026 10:01:20 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id BE7EE10E0EE for ; Tue, 1 Dec 2026 10:01:13 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 8C0B9434BB; Tue, 1 Dec 2026 10:01:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD59B1F00897; Tue, 1 Dec 2026 10:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796119273; bh=PI+MtKjlOE6YHuzAwU0i/5/Sl+kB37LfH4Q15fvfvnM=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=lh9GXk4/4w9RCQxYOb+jY+2TipszU7M4S7HnQ4dkLKyti/LHhT5NrxYxRt9ecAU0Z 0FILDGVUh1YPkOKL2zy2dPpDd6+yEqFywOolABRRr+6DzHR6oR9CLWkz5tG8xmukLJ 4AujWgxPC1cQIOfAASwXMIS8YxkjMGQISRtb6Z3c97opivgDIN8kE9OmQuWAR5aSND APeegAAXnI63hQxb1DxwhpLXXNGl0XVP8znQwcpCduyK75sxCy1MCJGNZ1ZA54e363 LyZMyTulYHBkvebgAjNWZusy1Y+M7m3gwuFw72vjbWDttedmKkDKDMooqGV2BsFTmQ gU81sEJy8SHkA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v5 4/4] drm/xe/ras: Serialize RAS workers on an ordered workqueue To: "Riana Tauro" , intel-xe@lists.freedesktop.org In-Reply-To: <20261201094549.3158286-10-riana.tauro@intel.com> References: <20261201094549.3158286-6-riana.tauro@intel.com> <20261201094549.3158286-10-riana.tauro@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 10:01:12 +0000 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] drm/xe/ras: uninitialized XArray spinlock in ras_fini() on probe error - [Medium] drm/xe/ras: circular lock dependency in xe_ras_suspend() flushing ras_wq -- commit 190e744799c17ac8b742cdb2e90b6eebab8fb92c Author: Riana Tauro drm/xe/ras: Serialize RAS workers on an ordered workqueue This commit introduces an ordered RAS workqueue to serialize the sysctrl event worker and per-tile hw error workers, drains it in ras_fini() before destroying offlined_pages, and flushes it during xe_device_suspend(). > diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_devic= e.c > index 36693df655941..b7e0d89e1b043 100644 > --- a/drivers/gpu/drm/xe/xe_device.c > +++ b/drivers/gpu/drm/xe/xe_device.c > @@ -1452,6 +1452,7 @@ int xe_device_suspend(struct xe_device *xe, bool hi= bernate, bool flr) > } > =20 > xe_irq_suspend(xe); > + xe_ras_suspend(xe); [Severity: Medium] Does flushing ras_wq in xe_device_suspend() create a circular lock dependency between vm->lock, xe_pm_block_lockdep_map, and ras_wq->lockdep_map? CPU0 CPU1 CPU2 ---- ---- ---- lock(&vm->lock) lock(xe_pm_block_lockdep_map) lock(ras_wq) lock(&vm->lock) flush_workqueue(ras_wq) lock(xe_pm_block_lockdep_map) *** DEADLOCK *** CPU0: xe_exec_ioctl() -> xe_pm_block_on_suspend() CPU1: xe_pm_suspend() -> xe_device_suspend() -> xe_ras_suspend() CPU2: hw_error_work() / xe_sysctrl_work() -> ... -> xe_ttm_vram_purge_page() xe_pm_suspend() holds xe_pm_block_lockdep_map across xe_device_suspend(), while xe_exec_ioctl() calls xe_pm_block_on_suspend() under vm->lock, and the RAS workers queued on ras_wq acquire vm->lock in xe_ttm_vram_purge_page(). > diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c > index 71585bc8bfe01..207c2706ec8d5 100644 > --- a/drivers/gpu/drm/xe/xe_ras.c > +++ b/drivers/gpu/drm/xe/xe_ras.c > @@ -1437,8 +1437,11 @@ static const struct attribute_group gpu_health_gro= up =3D { > static void ras_fini(void *arg) > { > struct xe_device *xe =3D arg; > + struct xe_ras_state *state =3D &xe->ras.state; > =20 > - xa_destroy(&xe->ras.state.offlined_pages); > + destroy_workqueue(state->ras_wq); > + if (xe->info.has_sysctrl) > + xa_destroy(&state->offlined_pages); > } [ ... ] > @@ -1498,6 +1512,14 @@ int xe_ras_init(struct xe_device *xe) > =20 > xe_drm_ras_init(xe); > =20 > + state->ras_wq =3D alloc_ordered_workqueue("xe-ras-wq", 0); > + if (!state->ras_wq) > + return -ENOMEM; > + > + ret =3D devm_add_action_or_reset(xe->drm.dev, ras_fini, xe); > + if (ret) > + return ret; > + > if (!xe->info.has_sysctrl) > return 0; > =20 > @@ -1513,10 +1535,6 @@ int xe_ras_init(struct xe_device *xe) > =20 > xa_init(&state->offlined_pages); > =20 > - ret =3D devm_add_action_or_reset(xe->drm.dev, ras_fini, xe); > - if (ret) > - return ret; [Severity: Medium] Can devm_add_action_or_reset() invoke ras_fini() before xa_init(&state->offlined_pages) has initialized offlined_pages.xa_lock? On platforms with xe->info.has_sysctrl set, an allocation failure inside devm_add_action_or_reset() calls ras_fini() -> xa_destroy(&state->offlined_pages) right away, locking an uninitialized spinlock because xa_init(&state->offlined_pages) only runs later in xe_ras_init(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201094549.3158= 286-6-riana.tauro@intel.com?part=3D4