It's just difficult for me to determine retry count and timeout value, maybe retry=0, timeout=IPMI_TIMEOUT is OK.
If I understand this correctly, the problem would be if:
rem_time = wait_for_completion_timeout(&tx_msg->tx_complete,
returns on a timeout, then checks msg_done and races with something setting
msg_done. If that is the case, you would need the smp_rmb() before checking
However, the timeout above is unnecessary. You are using
ipmi_request_settime(), so you can set the timeout when the IPMI command
fails and returns a failure message. The driver guarantees a return message
for each request. Just remove the timeout from the completion, set the
timeout and retries in the ipmi request, and the completion should handle the
The code of the timeout completion is already there, I think the quick fix code should not introduce this logic.
I'll add a new patch to apply your comment.
Plus, from a quick glance at the code, it doesn't look like it will properly handle aPATCH 07 fixed this issue.
situation where the timeout occurs and is handled then the response comes in
Here we just need the smp_rmb() or holding tx_msg_lock() around the acpi_format_ipmi_response().
Thanks for commenting.