Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] Calling `xe_device_declare_wedged()` during early driver probe fails 
to notify userspace because the DRM device is not yet registered in sysfs.
--

--- Patch [3]: [PATCH v11 3/3] drm/xe: Handle PUNIT errors by requesting 
cold-reset recovery ---
commit e4801339581daca0be0db10f90d94f25e72cfa52
Author: Mallesh Koujalagi <[email protected]>

drm/xe: Handle PUNIT errors by requesting cold-reset recovery

When PUNIT (power management unit) errors are detected that persist across
warm resets, mark the device as wedged with DRM_WEDGE_RECOVERY_COLD_RESET
and notify userspace that a complete device power cycle is required to
restore normal operation.

> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index a31e06b8aa67a..92b4181026cbe 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
[ ... ]
> @@ -236,6 +236,12 @@ static u8 handle_core_compute_errors(struct 
> xe_ras_error_array *arr)
>       return XE_RAS_RECOVERY_ACTION_RECOVERED;
>  }
>  
> +static void punit_error_handler(struct xe_device *xe)
> +{
> +     xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_COLD_RESET);
> +     xe_device_declare_wedged(xe);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[Severity: High]
Does calling xe_device_declare_wedged() here fail to notify userspace when
triggered during early driver probe?

If a PUNIT error is present at driver load, the call chain is:

xe_device_probe()
  xe_ras_init()
    xe_ras_process_errors()
      handle_soc_internal_errors()
        punit_error_handler()
          xe_device_declare_wedged()
            drm_dev_wedged_event()

Since drm_dev_register() has not yet been called at this stage of the probe
path, the sysfs directory for the DRM device does not exist, and the KOBJ_ADD
event has not been emitted.

Consequently, userspace (e.g., udev) will likely drop or ignore the KOBJ_CHANGE
uevent emitted by drm_dev_wedged_event().

Will this cause the device to finish probe successfully but leave userspace
unaware of the wedged state, breaking the automated cold reset recovery
mechanism?

> +}
> +
>  static u8 handle_soc_internal_errors(struct xe_device *xe, struct 
> xe_ras_error_array *arr)
>  {
>       struct xe_ras_soc_error *info = (void *)arr->details;

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to