All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Stanley Chu <stanley.chu@mediatek.com>,
	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>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH] block: Fix a race in the runtime power management code
Date: Wed, 26 Aug 2020 20:35:42 -0700	[thread overview]
Message-ID: <af1b1f57-59ff-0133-8108-0f3d1e1254e1@acm.org> (raw)
In-Reply-To: <20200826015159.GA387575@rowland.harvard.edu>

On 2020-08-25 18:51, Alan Stern wrote:
> Ah, perfect.  So in blk_queue_enter(), pm should be defined in terms of 
> RQF_PM rather than BLK_MQ_REQ_PREEMPT.
> 
> The difficulty is that the flags argument is the wrong type; RQF_PM is 
> defined as req_flags_t, not blk_mq_req_flags_t.  It is associated with a 
> particular request after the request has been created, so after 
> blk_queue_enter() has been called.
> 
> How can we solve this?

The current code looks a bit weird because my focus when modifying the PM
code has been on not breaking any existing code.

scsi_device_quiesce() relies on blk_queue_enter() processing all PREEMPT
requests. A difficulty is that scsi_device_quiesce() is used for two
separate purposes:
* Runtime power management.
* SCSI domain validation. See e.g. https://lwn.net/Articles/75917/.

I think that modifying blk_queue_enter() such that it only accepts PM
requests will require to split scsi_device_quiesce() into two functions:
one function that is used by the runtime power management code and another
function that is used by the SCSI domain validation code. This may require
to introduce new SCSI device states. If new SCSI device states are
introduced, that should be done without modifying the state that is
reported to user space. See also sdev_states[] and show_state_field in
scsi_sysfs.c.

Thanks,

Bart.

  reply	other threads:[~2020-08-27  3:35 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
2020-08-26  1:51       ` Alan Stern
2020-08-27  3:35         ` Bart Van Assche [this message]
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=af1b1f57-59ff-0133-8108-0f3d1e1254e1@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=martin.petersen@oracle.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.