Re: [PATCH v6 2/2] ufs: mcq: poll OCS after sq cleanup for device management commands
From: Bart Van Assche
Date: Thu Nov 05 2026 - 23:40:16 EST
On 11/5/26 5:56 PM, Kiwoong Kim wrote:
>> That's not what I meant. An interrupt is generated after the status has
>> been changed to OCS_ABORTED, isn't it? Has it been considered to wait for
>> that interrupt instead of polling the OCS status?
>
> Okay, got it. From what I understand, it's a loop to call
> ufshcd_mcq_poll_cqe_lock and check OCS. If I get yours wrong, please
> let me know.
That's fine with me. Waiting for the interrupt is not possible without
introducing a new completion mechanism: scsi_timeout() sets
SCMD_STATE_COMPLETE before ufshcd_abort() is called, so the scsi_done()
call from the interrupt handler has no effect on the command that is
being aborted. Calling ufshcd_mcq_poll_cqe_lock() from the polling loop
instead processes the CQE with OCS = ABORTED as soon as it has been
posted. It does not depend on interrupt delivery, and it is serialized
against the interrupt handler via hwq->cq_lock. Please introduce a
helper function that calls ufshcd_mcq_poll_cqe_lock() and then returns
the OCS value, and pass that helper to read_poll_timeout().
Thanks,
Bart.