Re: [PATCH] block: Fix bug in runtime-resume handling

Alan Stern
2020-08-30T01:06:31Z

On Sat, Aug 29, 2020 at 05:38:50PM -0700, Bart Van Assche wrote:
> On 2020-08-29 11:56, Alan Stern wrote:
> > A third possibility is the approach I outlined before, adding a
> > BLK_MQ_REQ_PM flag. But to avoid the deadlock you pointed out, I would
> > make blk_queue_enter smarter about whether to postpone a request. The
> > logic would go like this:
> >
> > If !blk_queue_pm_only:
> > Allow
> > If !BLK_MQ_REQ_PREEMPT:
> > Postpone
> > If q->rpm_status is RPM_ACTIVE:
> > Allow
> > If !BLK_MQ_REQ_PM:
> > Postpone
> > If q->rpm_status is RPM_SUSPENDED:
> > Postpone
> > Else:
> > Allow
> >
> > The assumption here is that the PREEMPT flag is set whenever the PM flag
> > is.
>
> Hi Alan,
>
> Although interesting, these solutions sound like workarounds to me. How
> about fixing the root cause by modifying the SCSI DV implementation such
> that it doesn't use scsi_device_quiesce() anymore()? That change would
> allow to remove BLK_MQ_REQ_PREEMPT / RQF_PREEMPT from the block layer and
> move these flags into the SCSI and IDE code.

That's a perfectly reasonable approach, but I have no idea how to do it.
Any suggestions?

Alan Stern