mbox series

[RFC,v3,0/1] Enable power management for ufs wlun

Message ID cover.1613070911.git.asutoshd@codeaurora.org (mailing list archive)
Headers show
Series Enable power management for ufs wlun | expand

Message

Asutosh Das (asd) Feb. 11, 2021, 7:18 p.m. UTC
This patch attempts to fix a deadlock in ufs while sending SSU.
Recently, blk_queue_enter() added a check to not process requests if the
queue is suspended. That leads to a resume of the associated device which
is suspended. In ufs, that device is ufs device wlun and it's parent is
ufs_hba. This resume tries to resume ufs device wlun which in turn tries
to resume ufs_hba, which is already in the process of suspending, thus
causing a deadlock.

This patch takes care of:
* Suspending the ufs device lun only after all other luns are suspended
* Sending SSU during ufs device wlun suspend
* Clearing uac for rpmb and ufs device wlun
* Not sending commands to the device during host suspend

I'm testing it out now, please take a look and let me know.

Asutosh Das (1):
  scsi: ufs: Enable power management for wlun

 drivers/scsi/ufs/ufshcd.c  | 415 +++++++++++++++++++++++++++++++++++++--------
 drivers/scsi/ufs/ufshcd.h  |   4 +
 include/trace/events/ufs.h |  20 +++
 3 files changed, 364 insertions(+), 75 deletions(-)

Comments

Avri Altman Feb. 13, 2021, 8:51 p.m. UTC | #1
> 
> This patch attempts to fix a deadlock in ufs while sending SSU.
> Recently, blk_queue_enter() added a check to not process requests if the
> queue is suspended. That leads to a resume of the associated device which
> is suspended. In ufs, that device is ufs device wlun and it's parent is
> ufs_hba. This resume tries to resume ufs device wlun which in turn tries
> to resume ufs_hba, which is already in the process of suspending, thus
> causing a deadlock.
> 
> This patch takes care of:
> * Suspending the ufs device lun only after all other luns are suspended
ufs device lun -> ufs device wlun
Avri Altman Feb. 14, 2021, 7:48 a.m. UTC | #2
> >
> > This patch attempts to fix a deadlock in ufs while sending SSU.
> > Recently, blk_queue_enter() added a check to not process requests if the
> > queue is suspended. That leads to a resume of the associated device which
> > is suspended. In ufs, that device is ufs device wlun and it's parent is
> > ufs_hba. This resume tries to resume ufs device wlun which in turn tries
> > to resume ufs_hba, which is already in the process of suspending, thus
> > causing a deadlock.
> >
> > This patch takes care of:
> > * Suspending the ufs device lun only after all other luns are suspended
> ufs device lun -> ufs device wlun
You might also want to consider, as a preliminary step in your series,
reverting one or more of the recent "clear uac" patches,
As you are nailing the root cause of the issues/live-lock they witnessed.

Thanks,
Avri