On Wed, 2018-08-08 at 14:43 +-0800, jianchao.wang wrote: +AD4- +AD4- On 08/08/2018 02:11 PM, jianchao.wang wrote: +AD4- +AD4- Hi Bart +AD4- +AD4- +AD4- +AD4- On 08/08/2018 06:51 AM, Bart Van Assche wrote: +AD4- +AD4- +AD4- +AEAAQA- -391,6 +-393,9 +AEAAQA- static struct request +ACo-blk+AF8-mq+AF8-get+AF8-request(struct request+AF8-queue +ACo-q, +AD4- +AD4- +AD4- +AH0- +AD4- +AD4- +AD4- +AH0- +AD4- +AD4- +AD4- data-+AD4-hctx-+AD4-queued+-+-+ADs- +AD4- +AD4- +AD4- +- +AD4- +AD4- +AD4- +- blk+AF8-pm+AF8-add+AF8-request(q, rq)+ADs- +AD4- +AD4- +AD4- +- +AD4- +AD4- +AD4- return rq+ADs- +AD4- +AD4- +AD4- +AH0- +AD4- +AD4- +AD4- +AD4- The request+AF8-queue is in pm+AF8-only mode when suspended, who can reach here to do the resume ? +AD4- +AD4- I mean, in the original blk-legacy runtime pm implementation, any new IO could trigger the resume, +AD4- after your patch set, only the pm request could pass the blk+AF8-queue+AF8-enter while the queue is suspended +AD4- and in pm-only mode. But if no resume, where does the pm request come from ? +AD4- +AD4- The blk+AF8-pm+AF8-add+AF8-request should be added to blk+AF8-queue+AF8-enter. +AD4- It looks like as following: +AD4- 1. when an normal io reaches blk+AF8-queue+AF8-enter, if queue is in suspended mode, it invoke blk+AF8-pm+AF8-add+AF8-request +AD4- to trigger the resume, then wait here for the pm+AF8-only mode to be cleared. +AD4- 2. the runtime pm core does the resume work and clear the pm+AF8-only more finally +AD4- 3. the task blocked in blk+AF8-queue+AF8-enter is waked up and proceed. Hello Jianchao, Some but not all blk+AF8-queue+AF8-enter() calls are related to request allocation so I'm not sure that that call should be added into blk+AF8-queue+AF8-enter(). The reason my tests passed is probably because of the scsi+AF8-autopm+AF8-get+AF8-device() calls in the sd and sr drivers. However, not all request submission code is protected by these calls. I will have a closer look at how to preserve the behavior that queueing a new request that is not protected by scsi+AF8-autopm+AF8-get+AF8AKg-() restores full power mode. Bart.