On 2023/3/21 AM12:32, Luck, Tony wrote: >>> 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. > > I mixed up what was already in the kernel with what the patch was changing. > >> 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? > > Is this for some real use case? > > Do you have a BIOS EINJ implementation that is returning these different codes? Yes, our BIOS tester complains that EINJ always reports EBUSY, and he has no idea about it. It can not help him determine whether it is a BIOS bug or an injection operation error. > What will the user do differently if they see these different error strings? > > # echo 1 > error_inject > ... different error messages here ... For example, with original code: # select a invalid core or device to inject # echo 1 > error_inject echo: write error: Device or resource busy When tester sees that, he will submit a bug to BIOS developer. Actually, firmware will do some platform dependent sanity checks and returns different error codes. In this case, user injects to a invalid device, platform returns "Invalid Access". And user is expected to see: # select a invalid core or device to inject # echo 1 > error_inject echo: write error: Invalid argument Then user is expected to check his injection argument first. > > -Tony > Best Regards, Shuai