Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] amdxdna: ignoring timeout in aie4_config_fw() leaves device wedged
--

commit 22f93820c29f525444ddc497eafd8728678db445
Author: David Zhang <[email protected]>
accel/amdxdna: Add context switch hysteresis with debugfs control

This commit adds aie4_set_ctx_hysteresis() to configure the AIE4 context
switch hysteresis timeout via the SET_RUNTIME_CONFIG message, and it exposes a
debugfs node to change the timeout at runtime.

> diff --git a/drivers/accel/amdxdna/aie4_pci.c 
> b/drivers/accel/amdxdna/aie4_pci.c
> index 95e682a3a4b75..60348ec5bc53b 100644
> --- a/drivers/accel/amdxdna/aie4_pci.c
> +++ b/drivers/accel/amdxdna/aie4_pci.c
[ ... ]
> @@ -325,6 +327,20 @@ int aie4_restore_power_mode(struct amdxdna_dev_hdl *ndev)
>       return aie4_msg_set_power_mode(ndev, ndev->pw_mode);
>  }
>  
> +static int aie4_config_fw(struct amdxdna_dev_hdl *ndev)
> +{
> +     int ret;
> +
> +     ret = aie4_attach_work_buffer(ndev);
> +     if (ret)
> +             return ret;
> +
> +     /* Best-effort tuning knob; failure is warned inside and does not fail 
> hw start */
> +     aie4_set_ctx_hysteresis(ndev, ndev->ctx_switch_hysteresis_us);

[Severity: Medium]
Does ignoring the return value of aie4_set_ctx_hysteresis() leave the device
in a wedged state if a timeout occurs?

If the firmware hangs or times out while processing the context hysteresis
configuration message during initialization or resume, aie_send_mgmt_msg_wait()
returns -ETIME and destroys the management channel.

Because aie4_config_fw() explicitly ignores all errors to treat the knob as
"best-effort", initialization will falsely succeed even if the management
channel has been destroyed. This leaves the device silently unusable. Is there
a way to distinguish between non-fatal errors and fatal timeouts to prevent
the probe from succeeding with a destroyed management channel?

> +
> +     return 0;
> +}
> +
>  static int aie4_pf_hw_start(struct amdxdna_dev_hdl *ndev)
>  {
>       int ret;

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

Reply via email to