Re: [PATCH] block: Fix a race in the runtime power management code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux