Re: [PATCH v4 10/10] scsi: ufs: Apply more limitations to user access

From: Bart Van Assche
Date: Thu Jun 24 2021 - 18:25:54 EST


On 6/23/21 7:23 PM, Can Guo wrote:
> On 2021-06-24 05:51, Bart Van Assche wrote:
>> On 6/23/21 12:35 AM, Can Guo wrote:
>> - During system suspend, user space software is paused before the device
>>   driver freeze callbacks are invoked. Hence, the hba->is_sys_suspended
>>   check can be left out.
>
> is_sys_suspended indicates that system resume failed (power/clk is OFF).
>
>> - If a LUN is runtime suspended, it should be resumed if accessed from
>>   user space instead of failing user space accesses. In other words, the
>>   hba->is_wlu_sys_suspended check seems inappropriate to me.
>
> hba->is_wlu_sys_suspended indicates that wl system resume failed, device
> is not operational.

Hi Can,

Thanks for the clarification. How about converting the above two answers
into comments inside ufshcd_is_user_access_allowed()?

Should ufshcd_is_user_access_allowed() perhaps be called after
ufshcd_rpm_get_sync() instead of before to prevent that the value of
hba->is_sys_suspended or hba->is_wlu_sys_suspended changes after having
been checked and before the UFS device is accessed?

Thanks,

Bart.