Re: [PATCH] ACPI: APEI: EINJ: warn on invalid argument when explicitly indicated by platform

From: Shuai Xue
Date: Sun Mar 19 2023 - 22:25:26 EST




On 2023/3/18 AM5:24, Luck, Tony wrote:
> - if (val != EINJ_STATUS_SUCCESS)
> + if (val == EINJ_STATUS_FAIL)
> return -EBUSY;
> + else if (val == EINJ_STATUS_INVAL)
> + return -EINVAL;
>
> The ACPI Specification is really vague here. Documented error codes are
>
> 0 = Success (Linux #define EINJ_STATUS_SUCCESS)
> 1 = Unknown failure (Linux #define EINJ_STATUS_FAIL)
> 2 = Invalid Access (Linux #define EINJ_STATUS_INVAL)

Absolutely right.

>
> I don't see how reporting -EBUSY for the "Unknown Failure" case is
> actually better.

Tony, did you misunderstand this patch?

The original code report -EBUSY for both "Unknown Failure" and
"Invalid Access" cases.

This patch intends to report -EINVAL for "Invalid Access" case
and keeps reporting -EBUSY for "Unknown Failure" case unchanged.
Although -EBUSY for "Unknown Failure" case is not a good choice.
Will -EIO for "Unknown failure" case be better?

By the way, do you think -EIO for time out case is suitable.

for (;;) {
rc = apei_exec_run(&ctx, ACPI_EINJ_CHECK_BUSY_STATUS);
if (rc)
return rc;
val = apei_exec_ctx_get_output(&ctx);
if (!(val & EINJ_OP_BUSY))
break;
if (einj_timedout(&timeout))
return -EIO;

For example, the OSPM will may warn:

Firmware does not respond in time.

And a message is printed on the console:
echo: write error: Input/output error

Will -EBUSY or -ETIME for timeout be better?

>
> -Tony

Thank you for comments.

Best Regards.
Shuai