Re: [PATCH 2/4] block: Fix a race between request queue freezing and running queues

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

 



On Tue, 2019-04-02 at 08:53 +-0800, Ming Lei wrote:
+AD4 On Mon, Apr 01, 2019 at 02:20:12PM -0700, Bart Van Assche wrote:
+AD4 +AD4 diff --git a/block/blk-mq.c b/block/blk-mq.c
+AD4 +AD4 index 3ff3d7b49969..652d0c6d5945 100644
+AD4 +AD4 --- a/block/blk-mq.c
+AD4 +AD4 +-+-+- b/block/blk-mq.c
+AD4 +AD4 +AEAAQA -1499,12 +-1499,20 +AEAAQA void blk+AF8-mq+AF8-run+AF8-hw+AF8-queues(struct request+AF8-queue +ACo-q, bool async)
+AD4 +AD4  	struct blk+AF8-mq+AF8-hw+AF8-ctx +ACo-hctx+ADs
+AD4 +AD4  	int i+ADs
+AD4 +AD4  
+AD4 +AD4 +-	/+ACo
+AD4 +AD4 +-	 +ACo Do not run any hardware queues if the queue is frozen or if a
+AD4 +AD4 +-	 +ACo concurrent blk+AF8-cleanup+AF8-queue() call is removing any data
+AD4 +AD4 +-	 +ACo structures used by this function.
+AD4 +AD4 +-	 +ACo-/
+AD4 +AD4 +-	if (+ACE-percpu+AF8-ref+AF8-tryget(+ACY-q-+AD4-q+AF8-usage+AF8-counter))
+AD4 +AD4 +-		return+ADs
+AD4 +AD4  	queue+AF8-for+AF8-each+AF8-hw+AF8-ctx(q, hctx, i) +AHs
+AD4 +AD4  		if (blk+AF8-mq+AF8-hctx+AF8-stopped(hctx))
+AD4 +AD4  			continue+ADs
+AD4 +AD4  
+AD4 +AD4  		blk+AF8-mq+AF8-run+AF8-hw+AF8-queue(hctx, async)+ADs
+AD4 +AD4  	+AH0
+AD4 +AD4 +-	percpu+AF8-ref+AF8-put(+ACY-q-+AD4-q+AF8-usage+AF8-counter)+ADs
+AD4 +AD4  +AH0
+AD4 +AD4  EXPORT+AF8-SYMBOL(blk+AF8-mq+AF8-run+AF8-hw+AF8-queues)+ADs
+AD4 
+AD4 I don't see it is necessary to add percpu+AF8-ref+AF8-tryget()/percpu+AF8-ref+AF8-put()
+AD4 in the fast path if we simply release all hctx resource in hctx's
+AD4 release handler by the following patch:
+AD4 
+AD4 https://lore.kernel.org/linux-block/20190401044247.29881-2-ming.lei+AEA-redhat.com/T/+ACM-u
+AD4 
+AD4 Even we can kill the percpu+AF8-ref+AF8-tryget+AF8-live()/percpu+AF8-ref+AF8-put() in
+AD4 scsi+AF8-end+AF8-request().

The above approach has the advantages of being easy to review and to maintain.

Patch +ACIAWw-PATCH V2 1/3+AF0 blk-mq: free hw queue's resource in hctx's release handler+ACI
makes the block layer more complicated because it introduces a new state for
hardware queues: block driver cleanup has happened (set-+AD4-ops-+AD4-exit+AF8-hctx(...)) but
the hardware queues are still in use by the block layer core.

Let's see what other reviewers think.

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