Message ID | 20220427233855.2685505-2-bvanassche@acm.org |
---|---|
State | New |
Headers | show |
Series | Prepare for upstreaming Pixel 6 UFS support | expand |
> Wait at most 20 ms before rechecking the doorbells instead of waiting > for a potentially long time between doorbell checks. > > Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Avri Altman <avri.altman@wdc.com> Nit: An upper bound of 20msec seems reasonable. Maybe we should create some linkage to DOORBELL_CLR_TOUT_US? > --- > drivers/scsi/ufs/ufshcd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 2b4390a1106e..a3fecbb403d3 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -1141,7 +1141,7 @@ static int ufshcd_wait_for_doorbell_clr(struct > ufs_hba *hba, > } > > spin_unlock_irqrestore(hba->host->host_lock, flags); > - schedule(); > + io_schedule_timeout(msecs_to_jiffies(20)); > if (ktime_to_us(ktime_sub(ktime_get(), start)) > > wait_timeout_us) { > timeout = true;
On 4/28/22 00:09, Avri Altman wrote:
> Maybe we should create some linkage to DOORBELL_CLR_TOUT_US?
Hi Avri,
Do you perhaps want me to change
io_schedule_timeout(msecs_to_jiffies(20));
into something like the following?
io_schedule_timeout(msecs_to_jiffies(min(20, remaining_time)));
Documenting that wait_timeout_us may be exceeded by 20 ms seems like the
easier solution to me :-)
Thanks,
Bart.
> On 4/28/22 00:09, Avri Altman wrote: > > Maybe we should create some linkage to DOORBELL_CLR_TOUT_US? > > Hi Avri, > > Do you perhaps want me to change > > io_schedule_timeout(msecs_to_jiffies(20)); > > into something like the following? > > io_schedule_timeout(msecs_to_jiffies(min(20, remaining_time))); > > Documenting that wait_timeout_us may be exceeded by 20 ms seems like > the > easier solution to me :-) I meant some fraction of DOORBELL_CLR_TOUT_US but that's fine - It is going away anyway. Thanks, Avri > > Thanks, > > Bart.
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2b4390a1106e..a3fecbb403d3 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1141,7 +1141,7 @@ static int ufshcd_wait_for_doorbell_clr(struct ufs_hba *hba, } spin_unlock_irqrestore(hba->host->host_lock, flags); - schedule(); + io_schedule_timeout(msecs_to_jiffies(20)); if (ktime_to_us(ktime_sub(ktime_get(), start)) > wait_timeout_us) { timeout = true;
Wait at most 20 ms before rechecking the doorbells instead of waiting for a potentially long time between doorbell checks. Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)