Re: [PATCH V4 1/3] scsi: ufs: Fix error handler clear ua deadlock
From: Bart Van Assche <bvanassche@acm.org>
Date: 2021-09-17 17:58:18
On 9/17/21 10:39 AM, Adrian Hunter wrote:
On 17/09/21 7:09 pm, Bart Van Assche wrote:quoted
On 9/16/21 10:02 AM, Adrian Hunter wrote:quoted
-static void ufshcd_request_sense_done(struct request *rq, blk_status_t error) +static int ufshcd_request_sense_direct(struct ufs_hba *hba, u8 wlun) {[ ... ]quoted
+ /* The command queue cannot be frozen */ + req = blk_get_request(q, REQ_OP_DRV_OUT, 0);hba->cmd_queue shares a tag set with the request queues associated with SCSI LUNs. Since this blk_get_request() call happens from the context of the error handler before SCSI requests are unblocked, it will hang if all tags are in use for SCSI requests before the error handler starts.All the commands sent by ufshcd_probe_hba() take the same approach, so no difference there.
The same comment applies to the commands sent by ufshcd_probe_hba() I think. If you would like to address this issue, how about passing the flag BLK_MQ_REQ_RESERVED to the blk_get_request() call in ufshcd_exec_dev_cmd()? The following additional changes are required to make this work: * Add a 'reserved_tags' member to struct scsi_host_template, e.g. close to tag_alloc_policy. * Modify scsi_mq_setup_tags() such that it copies the reserved_tags value from the host template into tag_set->reserved_tags. * Set 'reserved_tags' in the UFS driver SCSI host template. Thanks, Bart.