Re: [PATCH v3 2/3] scsi: ufs: Fix a race condition btw task management request send and compl

2021-01-31 Thread Bart Van Assche
On 1/28/21 10:29 PM, Can Guo wrote: > On second thought, actually the 1st fix alone is enough to eliminate the > race condition. Because blk_mq_tagset_busy_iter() only iterates over all > requests which are not in IDLE state, if blk_mq_start_request() is called > within the protection of host spin

Re: [PATCH v3 2/3] scsi: ufs: Fix a race condition btw task management request send and compl

2021-01-28 Thread Can Guo
On 2021-01-29 14:06, Can Guo wrote: On 2021-01-29 11:20, Bart Van Assche wrote: On 1/27/21 8:16 PM, Can Guo wrote: ufshcd_compl_tm() looks for all 0 bits in the REG_UTP_TASK_REQ_DOOR_BELL and call complete() for each req who has the req->end_io_data set. There can be a race condition btw tmc s

Re: [PATCH v3 2/3] scsi: ufs: Fix a race condition btw task management request send and compl

2021-01-28 Thread Can Guo
On 2021-01-29 11:20, Bart Van Assche wrote: On 1/27/21 8:16 PM, Can Guo wrote: ufshcd_compl_tm() looks for all 0 bits in the REG_UTP_TASK_REQ_DOOR_BELL and call complete() for each req who has the req->end_io_data set. There can be a race condition btw tmc send/compl, because the req->end_io_d

Re: [PATCH v3 2/3] scsi: ufs: Fix a race condition btw task management request send and compl

2021-01-28 Thread Bart Van Assche
On 1/27/21 8:16 PM, Can Guo wrote: > ufshcd_compl_tm() looks for all 0 bits in the REG_UTP_TASK_REQ_DOOR_BELL > and call complete() for each req who has the req->end_io_data set. There > can be a race condition btw tmc send/compl, because the req->end_io_data is > set, in __ufshcd_issue_tm_cmd(), w

[PATCH v3 2/3] scsi: ufs: Fix a race condition btw task management request send and compl

2021-01-27 Thread Can Guo
ufshcd_compl_tm() looks for all 0 bits in the REG_UTP_TASK_REQ_DOOR_BELL and call complete() for each req who has the req->end_io_data set. There can be a race condition btw tmc send/compl, because the req->end_io_data is set, in __ufshcd_issue_tm_cmd(), without host lock protection, so it is possi