Re: [PATCH v8 6/8] block: Schedule runtime resume earlier

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

 



On Wed, 2018-09-19 at 12:05 +-0800, Ming Lei wrote:
+AD4 Looks this patch may introduce the following race between queue
+AD4 freeze and
+AD4 runtime suspend:
+AD4 
+AD4 -------------------------------------------------------------------
+AD4 -------
+AD4 CPU0				CPU1				
+AD4 		CPU2
+AD4 -------------------------------------------------------------------
+AD4 -------
+AD4 
+AD4 blk+AF8-freeze+AF8-queue()
+AD4 
+AD4 					blk+AF8-mq+AF8-alloc+AF8-request()
+AD4 						blk+AF8-queue+AF8-enter()
+AD4 							blk+AF8-pm+AF8-request+AF8
+AD4 resume()
+AD4 							wait+AF8-event()
+AD4 
+AD4 									
+AD4 			blk+AF8-pre+AF8-runtime+AF8-suspend()
+AD4 									
+AD4 				-+AD4-blk+AF8-set+AF8-pm+AF8-only
+AD4 									
+AD4 			...
+AD4 									
+AD4 			blk+AF8-post+AF8-runtime+AF8-suspend()
+AD4 
+AD4 ...
+AD4 blk+AF8-mq+AF8-unfreeze+AF8-queue()
+AD4 -------------------------------------------------------------------
+AD4 -------
+AD4 - CPU0: queue is frozen
+AD4 
+AD4 - CPU1: one new request comes, and see queue is frozen, but queue
+AD4 isn't
+AD4 runtime-suspended yet, then blk+AF8-pm+AF8-request+AF8-resume() does nothing. So
+AD4 this
+AD4 allocation is blocked in wait+AF8-event().
+AD4 
+AD4 - CPU2: runtime suspend comes, and queue becomes runtime-suspended
+AD4 now
+AD4 
+AD4 - CPU0: queue is unfreeze, but the new request allocation in CPU1 may
+AD4 never
+AD4 be done because the queue is runtime suspended, and wait+AF8-event()
+AD4 won't return.
+AD4 And the expected result is that the queue becomes active and the
+AD4 allocation on
+AD4 CPU1 is done immediately.

Hello Ming,

Just like for the scenario Jianchao reported, I will address this by
only allowing the suspend to proceed if q+AF8-usage+AF8-counter +AD0APQ 0.

Bart.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux