[PATCH v1] ufs: core: decouple CQE processing from spinlock critical section
Bart Van Assche
bvanassche at acm.org
Thu May 14 09:22:54 PDT 2026
On 5/14/26 1:26 AM, peter.wang at mediatek.com wrote:
> 4. In both ufshcd_mcq_compl_all_cqes_lock() and
> ufshcd_mcq_poll_cqe_lock(), snapshot the starting CQE pointer before
> advancing the head slot under the spinlock, then process the collected
> CQEs after releasing the lock using the new helper.
This can't work reliably. ufshcd_mcq_poll_cqe_lock() may be called
concurrently from different CPU cores, e.g. from a UFS completion
interrupt and from ufshcd_poll(). Processing CQEs without holding
hwq->cq_lock may lead to overwriting of CQEs before these have been
processed.
Thanks,
Bart.
More information about the Linux-mediatek
mailing list