Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Alan Stern <stern@rowland.harvard.edu>,
	Stanley Chu <stanley.chu@mediatek.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Ming Lei <ming.lei@redhat.com>, stable <stable@vger.kernel.org>,
	Can Guo <cang@codeaurora.org>
Subject: Re: [PATCH] block: Fix a race in the runtime power management code
Date: Tue, 25 Aug 2020 15:22:03 -0700	[thread overview]
Message-ID: <1f798c21-241f-59f8-5298-a32fffe2ff01@acm.org> (raw)
In-Reply-To: <20200825182423.GB375466@rowland.harvard.edu>

On 2020-08-25 11:24, Alan Stern wrote:
> A related question concerns the BLK_MQ_REQ_PREEMPT flag.  If it is set 
> then the request is allowed while rpm_status is RPM_SUSPENDING.  But in 
> fact, the only requests which should be allowed at that time are those 
> created by the lower-layer driver as part of its runtime-suspend 
> handling; all other requests should be deferred.  The BLK_MQ_REQ_PREEMPT 
> flag doesn't seem like the right way to achieve this.  Should we be 
> using a different flag?

I think there is already a flag that is used to mark power management
commands, namely RQF_PM.

My understanding is that the BLK_MQ_REQ_PREEMPT/RQF_PREEMPT flags are used
for the following purposes:
* In the SCSI core, scsi_execute() sets the BLK_MQ_PREEMPT flag. As a
  result, SCSI commands submitted with scsi_execute() are processed in
  the SDEV_QUIESCE SCSI device state. Since scsi_execute() is only used
  to submit other than medium access commands, in the SDEV_QUIESCE state
  medium access commands are paused and commands that do not access the
  storage medium (e.g. START/STOP commands) are processed.
* In the IDE-driver, for making one request preempt another request. From
  an old IDE commit (not sure if this is still relevant):
  + * If action is ide_preempt, then the rq is queued at the head of
  + * the request queue, displacing the currently-being-processed
  + * request and this function returns immediately without waiting
  + * for the new rq to be completed.  This is VERY DANGEROUS, and is
  + * intended for careful use by the ATAPI tape/cdrom driver code.

Bart.

  reply	other threads:[~2020-08-25 22:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24  3:06 [PATCH] block: Fix a race in the runtime power management code Bart Van Assche
2020-08-24 14:47 ` Alan Stern
2020-08-25  9:01 ` Stanley Chu
2020-08-25  9:11 ` Stanley Chu
2020-08-25 18:24   ` Alan Stern
2020-08-25 22:22     ` Bart Van Assche [this message]
2020-08-26  1:51       ` Alan Stern
2020-08-27  3:35         ` Bart Van Assche
2020-08-27 20:33           ` Alan Stern
2020-08-28  3:27             ` Bart Van Assche
2020-08-28 15:37               ` Alan Stern
2020-08-29  0:51                 ` Bart Van Assche
2020-08-29  1:12                   ` Alan Stern
2020-08-29  2:57                     ` Bart Van Assche
2020-08-26  2:58   ` Bart Van Assche
2020-08-26  4:00     ` Stanley Chu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f798c21-241f-59f8-5298-a32fffe2ff01@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=cang@codeaurora.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=stanley.chu@mediatek.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox