Re: [PATCH v6 11/12] block: Change the runtime power management approach (2/2)

Bart Van Assche
2018-08-10T15:22:57Z

On Fri, 2018-08-10 at 09:51 +0800, jianchao.wang wrote:
> On 08/10/2018 03:41 AM, Bart Van Assche wrote:
> > +
> > + blk_set_pm_only(q);
> > + /*
> > + * This function only gets called if the most recent
> > + * pm_request_resume() call occurred at least au=
tosuspend_delay_ms
> > + * ago. Since blk_queue_enter() is called by the=
request allocation
> > + * code before pm_request_resume(), if no reques=
ts have a tag assigned
> > + * it is safe to suspend the device.
> > + */
> > + ret = -EBUSY;
> > + if (blk_requests_in_flight(q) == 0) {
> > + /*
> > + * Call synchronize_rcu() such that later blk_q=
ueue_enter()
> > + * calls see the preempt-only state. See also
> > + *=20
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__l=
wn.net_Articles_573497_&d=DwIBAg&c=RoP1YumCXCgaWH=
vlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=7WdAxUBeiTUTCy8v-7zXyr4qk7sx26A=
Tvfo6QSTvZyQ&m=U9uPCJD2WnkXvdzrWaKPh2wJuk8-IHvxZ9sWDVrg2Tg&s=
0-c9E23TPCpNQkiZpuzGztwHxjWF8qrESfRnPmI-e-Z48&e=
> > .
> > + */
> > + synchronize_rcu();
> > + if (blk_requests_in_flight(q) == 0)
> > + ret = 0;
> > + }
>=20
> I still think blk_set_pm_only should be moved after blk=
F8-requests_in_flight.
> Otherwise, the normal IO will be blocked for a little while if there =
are still
> busy requests.

Hi Jianchao,

Although I think it is unlikely that the scenario you described will happen=
, I
will make the change you requested.

Bart.