On Thu, 2018-07-26 at 10:45 +-0800, jianchao.wang wrote: +AD4- On 07/26/2018 06:26 AM, Bart Van Assche wrote: +AD4- +AD4- +AEAAQA- -102,9 +-109,11 +AEAAQA- int blk+AF8-pre+AF8-runtime+AF8-suspend(struct request+AF8-queue +ACo-q) +AD4- +AD4- return ret+ADs- +AD4- +AD4- +AD4- +AD4- blk+AF8-pm+AF8-runtime+AF8-lock(q)+ADs- +AD4- +AD4- +- blk+AF8-set+AF8-preempt+AF8-only(q)+ADs- +AD4- +AD4- We only stop non-RQF+AF8-PM request entering when RPM+AF8-SUSPENDING and RPM+AF8-RESUMING. +AD4- blk+AF8-pre+AF8-runtime+AF8-suspend should only +AF8-check+AF8- whether runtime suspend is allowed. +AD4- So we should not set preempt+AF8-only here. +AD4- +AD4- +AD4- +- percpu+AF8-ref+AF8-switch+AF8-to+AF8-atomic+AF8-sync(+ACY-q-+AD4-q+AF8-usage+AF8-counter)+ADs- +AD4- +AD4- +AD4- +AD4- spin+AF8-lock+AF8-irq(q-+AD4-queue+AF8-lock)+ADs- +AD4- +AD4- - if (q-+AD4-nr+AF8-pending) +AHs- +AD4- +AD4- +- if (+ACE-percpu+AF8-ref+AF8-is+AF8-zero(+ACY-q-+AD4-q+AF8-usage+AF8-counter)) +AHs- +AD4- +AD4- ret +AD0- -EBUSY+ADs- +AD4- +AD4- pm+AF8-runtime+AF8-mark+AF8-last+AF8-busy(q-+AD4-dev)+ADs- +AD4- +AD4- +AH0- else +AHs- +AD4- +AD4- +AEAAQA- -112,6 +-121,7 +AEAAQA- int blk+AF8-pre+AF8-runtime+AF8-suspend(struct request+AF8-queue +ACo-q) +AD4- +AD4- +AH0- +AD4- +AD4- spin+AF8-unlock+AF8-irq(q-+AD4-queue+AF8-lock)+ADs- +AD4- +AD4- +AD4- +AD4- +- percpu+AF8-ref+AF8-switch+AF8-to+AF8-percpu(+ACY-q-+AD4-q+AF8-usage+AF8-counter)+ADs- +AD4- +AD4- blk+AF8-pm+AF8-runtime+AF8-unlock(q)+ADs- Hello Jianchao, There is only one caller of blk+AF8-post+AF8-runtime+AF8-suspend(), namely sdev+AF8-runtime+AF8-suspend(). That function calls pm-+AD4-runtime+AF8-suspend() before it calls blk+AF8-post+AF8-runtime+AF8-suspend(). I think it would be wrong to set the PREEMPT+AF8-ONLY flag from inside blk+AF8-post+AF8-runtime+AF8-suspend() because that could cause pm-+AD4-runtime+AF8-suspend() while a request is in progress. Bart.