On 16/09/21 1:41 am, Bart Van Assche wrote: > On 9/15/21 8:35 AM, Adrian Hunter wrote: >> Thanks for the idea. Unfortunately it does not work for pass-through >> requests, refer scsi_noretry_cmd(). sdev_ufs_device and sdev_rpmb are >> used with pass-through requests. > > How about allocating and submitting the REQUEST SENSE command from the context > of a workqueue, or in other words, switching back to scsi_execute()? Although > that approach doesn't guarantee that the unit attention condition is cleared > before the first SCSI command is received from outside the UFS driver, I don't > see any other solution since my understanding is that the deadlock between > blk_mq_freeze_queue() and blk_get_request() from inside ufshcd_err_handler() > can also happen without "ufs: Synchronize SCSI and UFS error handling". The issue can also be fixed by sending REQUEST SENSE directly avoiding the SCSI queues. Please see V4. > > The only code I know of that relies on the UFS driver clearing unit attentions > is this code: > https://android.googlesource.com/platform/system/core/+/master/trusty/storage/proxy/rpmb.c > The code that submits a REQUEST SENSE was added in the UFS driver as the result > of a request from the team that maintains the Trusty code. Earlier today I have > been promised that unit attention handling support will be added in Trusty but I > do not when this will be realized. > > Bart. > >