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 87B78606A322 for ; Thu, 3 Dec 2026 13:38:44 +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=aFRrthyP Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D22810E701; Thu, 3 Dec 2026 13:38:39 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7E8A10E701 for ; Thu, 3 Dec 2026 13:38:33 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D873561DF7; Thu, 3 Dec 2026 13:38:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ECBA1F00893; Thu, 3 Dec 2026 13:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796305112; bh=9VdXtTu8l9tRHafRTtr2uSV9ljstSFNrk/VNumfhr2U=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=aFRrthyPnrfe7CZzB3obINJ/ywGi3TFK9drk/YhqIT4PuiokF8nqQ05m3cg51EK4B Ny1uFo/1/moVRJVc9aOGLrxZq71/t51P80lnq2cf6LeNs6ycpd3C1PGdzVlgbbzXRz vI8gZSSa7cA0uOItROjzmp4YTF1m46rgaB3zFW1QMNampB4JQrBv6CUX6WQ5zOdsok vBmfHtqWrqyVd8jpgxMtBAcPhfmkSOPItEmKWQNYaOEsJohD/n8xr0el8JNv+siNbr 2oFKDdCTRG/aUiw65j8nGUPymeyZfArmJ9fmqgptFzTAQIF/otVoUairtosAb3LYQc c3qdtJGPxLwAQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 2/2] drm/xe/ras: Wedge device if page offline list is full at probe To: "Soham Purkait" , intel-xe@lists.freedesktop.org In-Reply-To: <20261203131610.1375755-6-soham.purkait@intel.com> References: <20261203131610.1375755-4-soham.purkait@intel.com> <20261203131610.1375755-6-soham.purkait@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 13:38:32 +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.7 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, T_PDS_OTHER_BAD_TLD 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 6 potential issues to consider: - [High] drm/xe/ras: wedging in xe_ras_init() races wedge_work() and breaks uevent - [High] drm/xe/ras: xe_wedged() check in xe_ras_init() breaks survivability mode - [High] drm/xe/ras: xe_ras_init() drains fw queues after get_offline_list() wedges - [Medium] drm/xe/ras: process_offline_pages() wedges when page offlining is disabled - [Medium] drm/xe/ras: full-list check in process_offline_pages() bypassed on errors - [Low] drm/xe/ras: gpu_health sysfs exposed in xe_ras_init() before xe_wedged() check -- commit ded7ea6d0d1b2641c02d725a1cf8b2ad9008e692 Author: Soham Purkait drm/xe/ras: Wedge device if page offline list is full at probe This commit declares the device wedged during probe when the firmware's page offline list has reached its maximum capacity, and fails xe_ras_init() with -ECANCELED if the device is wedged. > diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c > index b65c4ef42e459..ac4cfb1d1c7cd 100644 > --- a/drivers/gpu/drm/xe/xe_ras.c > +++ b/drivers/gpu/drm/xe/xe_ras.c > @@ -467,6 +467,11 @@ static void process_offline_pages(struct xe_device *= xe, u32 cmd, void *req, size > return; > } > } while (common->additional_data); > + > + if (!xe_wedged(xe) && list_req && state->max_pages && total_pages >=3D = state->max_pages) { > + xe_err(xe, "[RAS]: page offline list is full\n"); > + xe_wedge_declare(xe, 0); > + } > } [Severity: High] Does wedging here and then failing probe with -ECANCELED in xe_ras_init() race wedge_work() with probe-failure teardown and break the wedged uevent? xe_device_probe() calls xe_ras_init() before drm_dev_register(). When process_offline_pages() schedules xe->wedged.work and xe_ras_init() returns -ECANCELED, devres teardown runs xe_wedge_fini() in parallel with wedge_work(): CPU0 (probe) kworker xe_ras_init() process_offline_pages() xe_wedge_declare(xe, 0) schedule_work(&wedged.work) return -ECANCELED devres_release_all() ... xe_wedge_fini() wedge_work() disable_work_sync(...) drm_dev_wedged_event() kobject_uevent_env(...) <-- KOBJ_CHANGE before device_add() If xe_wedge_fini() runs first, disable_work_sync() cancels wedge_work() and userspace gets no uevent. If wedge_work() runs first, drm_dev_wedged_event= () emits KOBJ_CHANGE on an unregistered primary kdev whose parent is still NUL= L, producing a malformed DEVPATH=3D/cardN for a minor that is immediately free= d. More broadly, wedging expects the driver to stay bound so userspace receives the uevent and sees -ECANCELED on IOCTLs, whereas failing probe unbinds the driver and tears down the DRM device. [Severity: Medium] Should this check !xe_ras_get_disable_vram_page_offline(xe) before wedging the device? When VRAM page offlining is disabled via configfs, handle_page_offline() runs in logging-only mode and never asks firmware to add new offline entrie= s. Wedging here prevents an administrator from probing a device with a full offline list even when page offlining is explicitly disabled. [Severity: Medium] Can an error on a later chunk or a zero pages_returned response bypass this full-list check? state->max_pages and common->total_pages are known on the first response, y= et an early return from xe_sysctrl_send_command() on a later chunk skips this check. If the first chunk has pages_returned =3D=3D 0, the loop also breaks before assigning total_pages =3D common->total_pages, leaving total_pages a= t 0. Checking on the first response would avoid both bypasses and skip fetching and soft-offlining the remaining chunks when the list is already full. [ ... ] > @@ -1523,5 +1528,8 @@ int xe_ras_init(struct xe_device *xe) > if (ret) > return ret; > =20 > + if (xe_wedged(xe)) > + return -ECANCELED; [Severity: High] Will checking xe_wedged(xe) after xe_ras_process_errors() break runtime survivability mode? On a CSC firmware error in xe_ras_process_errors(), xe_survivability_mode_runtime_enable() sets up survivability sysfs and calls xe_wedge_declare() while expecting probe to stay bound for xe_nvm_init() and xe_heci_gsc_init(). Returning -ECANCELED aborts probe and removes that sys= fs. Separately, booting with xe.wedged_mode=3D0 (XE_WEDGED_MODE_NEVER) makes xe_wedge_declare() return early without setting xe->wedged.ref, so xe_wedged(xe) stays false and probe succeeds despite a full offline list. [Severity: High] Does waiting until the end of xe_ras_init() to abort let get_offline_queue() and xe_ras_process_errors() drain firmware queues before probe fails? get_offline_queue() passes notify_fw =3D true, so handle_page_offline() sen= ds XE_RAS_PAGE_ACTION_REMOVE to drop queued poison pages from firmware SRAM before probe failure discards the volatile TTM reservations. xe_ras_process_errors() then drains pending SoC error records as well. [Severity: Low] Why is gpu_health_group registered before the xe_wedged(xe) check? Exposing gpu_health right before returning -ECANCELED opens a window where concurrent reads or writes in gpu_health_show() / gpu_health_store() can issue sysctrl mailbox commands to the wedged device before devres removes t= he attribute, since neither handler checks xe_wedged(xe). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203131610.1375= 755-4-soham.purkait@intel.com?part=3D2