Linux Device Mapper development
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Mike Snitzer <snitzer@redhat.com>
Cc: Keith Busch <keith.busch@intel.com>,
	Christoph Hellwig <hch@infradead.org>,
	device-mapper development <dm-devel@redhat.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Subject: Re: blk-mq request allocation stalls [was: Re: [PATCH v3 0/8] dm: add request-based blk-mq support]
Date: Fri, 09 Jan 2015 17:27:08 -0700	[thread overview]
Message-ID: <54B071DC.9000307@kernel.dk> (raw)
In-Reply-To: <20150109222543.GA1190@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4249 bytes --]

On 01/09/2015 03:25 PM, Mike Snitzer wrote:
> On Fri, Jan 09 2015 at  4:56pm -0500,
> Jens Axboe <axboe@kernel.dk> wrote:
> 
>> On 01/09/2015 02:40 PM, Mike Snitzer wrote:
>>> On Fri, Jan 09 2015 at  4:11pm -0500,
>>> Jens Axboe <axboe@kernel.dk> wrote:
>>>
>>>>
>>>> Actually, try this one instead, it should be a bit more precise than
>>>> the first.
>>>>
>>>
>>> Thanks for the test patch.
>>>
>>> I'm still seeing failures that look wrong (last_tag=127 could be edge
>>> condition not handled properly?):
>>>
>>> [   14.254632] __bt_get: values before for loop: last_tag=127, index=3
>>> [   14.255841] __bt_get: values after  for loop: last_tag=64, index=2
>>> [   14.257036]
>>> [   14.257036] bt_get: __bt_get() returned -1
>>> [   14.258051] queue_num=0, nr_tags=128, reserved_tags=0, bits_per_word=5
>>> [   14.259246] nr_free=128, nr_reserved=0
>>> [   14.259963] active_queues=0
>>>
>>> [  213.115997] __bt_get: values before for loop: last_tag=127, index=3
>>> [  213.117115] __bt_get: values after  for loop: last_tag=96, index=3
>>> [  213.118200]
>>> [  213.118200] bt_get: __bt_get() returned -1
>>> [  213.121593] queue_num=0, nr_tags=128, reserved_tags=0, bits_per_word=5
>>> [  213.123960] nr_free=128, nr_reserved=0
>>> [  213.125880] active_queues=0
>>>
>>> [  239.158079] __bt_get: values before for loop: last_tag=8, index=0
>>> [  239.160363] __bt_get: values after  for loop: last_tag=0, index=0
>>> [  239.162896]
>>> [  239.162896] bt_get: __bt_get() returned -1
>>> [  239.166284] queue_num=0, nr_tags=128, reserved_tags=0, bits_per_word=5
>>> [  239.168623] nr_free=127, nr_reserved=0
>>> [  239.170508] active_queues=0
>>
>> Thanks for testing, can you try this one?
> 
> Huh, at least now we're now seeing some nr_free=0... but the last 3
> failures below look unnecessary still.  E.g. the last_tag=127 case
> 
> [   13.895265] __bt_get: values before for loop: last_tag=59, index=1
> [   13.895265] __bt_get: values after  for loop: last_tag=32, index=1
> [   13.895266] 
> [   13.895266] bt_get: __bt_get() returned -1
> [   13.895267] queue_num=0, nr_tags=128, reserved_tags=0, bits_per_word=5
> [   13.895267] nr_free=0, nr_reserved=0
> [   13.895268] active_queues=0
> 
> [   13.895269] __bt_get: values before for loop: last_tag=0, index=0
> [   13.895270] __bt_get: values after  for loop: last_tag=0, index=0
> [   13.895270] 
> [   13.895270] bt_get: __bt_get() returned -1
> [   13.895271] queue_num=0, nr_tags=128, reserved_tags=0, bits_per_word=5
> [   13.895272] nr_free=0, nr_reserved=0
> [   13.895272] active_queues=0
> [   13.895324] __bt_get: values before for loop: last_tag=0, index=0
> [   13.895324] __bt_get: values after  for loop: last_tag=0, index=0
> [   13.895325] bt_get: __bt_get() _still_ returned -1
> [   13.895325] queue_num=0, nr_tags=128, reserved_tags=0, bits_per_word=5
> [   13.895326] nr_free=0, nr_reserved=0
> [   13.895326] active_queues=0
> 
> [   18.931425] __bt_get: values before for loop: last_tag=127, index=3
> [   18.933317] __bt_get: values after  for loop: last_tag=0, index=0
> [   18.935140] 
> [   18.935140] bt_get: __bt_get() returned -1
> [   18.936807] queue_num=0, nr_tags=128, reserved_tags=0, bits_per_word=5
> [   18.938772] nr_free=128, nr_reserved=0
> [   18.939927] active_queues=0
> 
> [  489.119597] __bt_get: values before for loop: last_tag=95, index=2
> [  489.120621] __bt_get: values after  for loop: last_tag=96, index=3
> [  489.121624]
> [  489.121624] bt_get: __bt_get() returned -1
> [  489.122532] queue_num=0, nr_tags=128, reserved_tags=0, bits_per_word=5
> [  489.123581] nr_free=128, nr_reserved=0
> [  489.124206] active_queues=0
> 
> [  494.705758] __bt_get: values before for loop: last_tag=127, index=3
> [  494.707797] __bt_get: values after  for loop: last_tag=0, index=0
> [  494.709696] 
> [  494.709696] bt_get: __bt_get() returned -1
> [  494.712459] queue_num=0, nr_tags=128, reserved_tags=0, bits_per_word=5
> [  494.714403] nr_free=128, nr_reserved=0
> [  494.715955] active_queues=0

I sent out the half-done v3, unfortunately. Can you try this? Both the
cases with substantial nr_free are at the end of an index.

If this one doesn't solve it, I'll reproduce it myself to save the
ping-pong effort :-)


-- 
Jens Axboe


[-- Attachment #2: tag-v4.patch --]
[-- Type: text/x-patch, Size: 1474 bytes --]

diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 60c9d4a93fe4..1ce031a56080 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -142,29 +142,29 @@ static inline bool hctx_may_queue(struct blk_mq_hw_ctx *hctx,
 
 static int __bt_get_word(struct blk_align_bitmap *bm, unsigned int last_tag)
 {
-	int tag, org_last_tag, end;
-	bool wrap = last_tag != 0;
+	int tag, org_last_tag = last_tag;
 
-	org_last_tag = last_tag;
-	end = bm->depth;
-	do {
-restart:
-		tag = find_next_zero_bit(&bm->word, end, last_tag);
-		if (unlikely(tag >= end)) {
+	while (1) {
+		tag = find_next_zero_bit(&bm->word, bm->depth, last_tag);
+		if (unlikely(tag >= bm->depth)) {
 			/*
 			 * We started with an offset, start from 0 to
 			 * exhaust the map.
 			 */
-			if (wrap) {
-				wrap = false;
-				end = org_last_tag;
-				last_tag = 0;
-				goto restart;
+			if (org_last_tag) {
+				last_tag = org_last_tag = 0;
+				continue;
 			}
 			return -1;
 		}
+
+		if (!test_and_set_bit(tag, &bm->word))
+			break;
+
 		last_tag = tag + 1;
-	} while (test_and_set_bit(tag, &bm->word));
+		if (last_tag >= bm->depth - 1)
+			last_tag = 0;
+	}
 
 	return tag;
 }
@@ -199,9 +199,13 @@ static int __bt_get(struct blk_mq_hw_ctx *hctx, struct blk_mq_bitmap_tags *bt,
 			goto done;
 		}
 
-		last_tag = 0;
-		if (++index >= bt->map_nr)
+		index++;
+		last_tag = (index << bt->bits_per_word);
+
+		if (index >= bt->map_nr) {
 			index = 0;
+			last_tag = 0;
+		}
 	}
 
 	*tag_cache = 0;

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2015-01-10  0:27 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17  3:59 [PATCH v3 0/8] dm: add request-based blk-mq support Mike Snitzer
2014-12-17  3:59 ` [PATCH v3 1/8] block: require blk_rq_prep_clone() be given an initialized clone request Mike Snitzer
2014-12-17  3:59 ` [PATCH v3 2/8] block: initialize bio member of blk-mq request to NULL Mike Snitzer
2014-12-17  3:59 ` [PATCH v3 3/8] block: add blk-mq support to blk_insert_cloned_request() Mike Snitzer
2014-12-17  4:00 ` [PATCH v3 4/8] block: mark blk-mq devices as stackable Mike Snitzer
2014-12-17  4:00 ` [PATCH v3 5/8] dm: remove exports for request-based interfaces without external callers Mike Snitzer
2014-12-17  4:00 ` [PATCH v3 6/8] dm: split request structure out from dm_rq_target_io structure Mike Snitzer
2014-12-17  4:00 ` [PATCH v3 7/8] dm: submit stacked requests in irq enabled context Mike Snitzer
2014-12-17  4:00 ` [PATCH v3 8/8] dm: allocate requests from target when stacking on blk-mq devices Mike Snitzer
2014-12-17 22:35   ` Mike Snitzer
2014-12-17 21:42 ` [PATCH v3 0/8] dm: add request-based blk-mq support Keith Busch
2014-12-17 21:43   ` Jens Axboe
2014-12-17 23:06     ` Mike Snitzer
2014-12-18  1:41       ` Keith Busch
2014-12-18  4:58         ` Mike Snitzer
2014-12-19 14:32       ` Bart Van Assche
2014-12-19 15:38         ` Mike Snitzer
2014-12-19 17:14           ` Mike Snitzer
2014-12-22 15:28             ` Bart Van Assche
2014-12-22 18:49               ` Mike Snitzer
2014-12-23 16:24                 ` Bart Van Assche
2014-12-23 17:13                   ` Mike Snitzer
2014-12-23 21:42                     ` Mike Snitzer
2014-12-24 13:02                       ` Bart Van Assche
2014-12-24 18:21                         ` Mike Snitzer
2014-12-24 18:55                           ` Mike Snitzer
2014-12-24 19:26                             ` Mike Snitzer
2015-01-02 17:53                               ` Bart Van Assche
2015-01-05 21:35                                 ` Mike Snitzer
2015-01-06  8:59                                   ` Christoph Hellwig
2015-01-06  9:31                                   ` Bart Van Assche
2015-01-06 16:05                                     ` blk-mq request allocation stalls [was: Re: [PATCH v3 0/8] dm: add request-based blk-mq support] Mike Snitzer
2015-01-06 16:15                                       ` Jens Axboe
2015-01-07 10:33                                         ` Bart Van Assche
2015-01-07 15:32                                           ` Jens Axboe
2015-01-07 16:15                                             ` Mike Snitzer
2015-01-07 16:18                                               ` Jens Axboe
2015-01-07 16:22                                               ` Mike Snitzer
2015-01-07 16:24                                                 ` Jens Axboe
2015-01-07 17:18                                                   ` Mike Snitzer
2015-01-07 17:35                                                     ` Jens Axboe
2015-01-07 20:09                                                       ` Mike Snitzer
2015-01-07 20:40                                           ` Keith Busch
2015-01-09 19:49                                             ` Mike Snitzer
2015-01-09 21:07                                               ` Jens Axboe
2015-01-09 21:11                                                 ` Jens Axboe
2015-01-09 21:40                                                   ` Mike Snitzer
2015-01-09 21:56                                                     ` Jens Axboe
2015-01-09 22:25                                                       ` Mike Snitzer
2015-01-10  0:27                                                         ` Jens Axboe [this message]
2015-01-10  1:48                                                           ` Mike Snitzer
2015-01-10  1:59                                                             ` Jens Axboe
2015-01-10  3:10                                                               ` Mike Snitzer
2015-01-12 14:46                                                                 ` blk-mq request allocation stalls Bart Van Assche
2015-01-12 15:42                                                                   ` Jens Axboe
2015-01-12 16:12                                                                     ` Bart Van Assche
2015-01-12 16:34                                                                       ` Jens Axboe
2015-01-12 16:58                                                                         ` Mike Snitzer
2015-01-12 16:59                                                                           ` Jens Axboe
2015-01-12 17:04                                                                         ` Bart Van Assche
2015-01-12 17:09                                                                           ` Jens Axboe
2015-01-12 17:53                                                                             ` Keith Busch
2015-01-12 18:12                                                                               ` Jens Axboe
2015-01-12 18:22                                                                                 ` Keith Busch
2015-01-12 18:35                                                                                   ` Keith Busch
2015-01-12 19:11                                                                                     ` Mike Snitzer
2015-01-12 20:21                                                                                       ` Mike Snitzer
2015-01-13 12:29                                                                                         ` Bart Van Assche
2015-01-13 14:17                                                                                           ` Mike Snitzer
2015-01-13 14:28                                                                                             ` dm + blk-mq soft lockup complaint Bart Van Assche
2015-01-13 16:20                                                                                               ` Mike Snitzer
2015-01-14  9:16                                                                                                 ` Bart Van Assche
2015-01-14 18:59                                                                                                   ` Mike Snitzer
2015-01-15  8:11                                                                                                     ` Bart Van Assche
2015-01-15 15:43                                                                                                       ` Mike Snitzer
2015-01-15 15:55                                                                                                         ` Bart Van Assche
2015-01-13 14:59                                                                                     ` blk-mq request allocation stalls Jens Axboe
2015-01-13 15:11                                                                                       ` Keith Busch
2015-01-13 15:27                                                                                         ` Keith Busch
2015-01-13 15:41                                                                                         ` Mike Snitzer
2015-01-13 15:14                                                                                       ` Mike Snitzer
2015-01-27 18:42                                                                                       ` blk-mq DM changes for 3.20 [was: Re: blk-mq request allocation stalls] Mike Snitzer
2015-01-28 16:42                                                                                         ` Jens Axboe
2015-01-28 17:44                                                                                           ` Mike Snitzer
2015-01-28 17:49                                                                                             ` Jens Axboe
2015-01-28 18:10                                                                                               ` Mike Snitzer
2015-01-29 22:43                                                                                               ` blk-mq DM changes for 3.20 [was: Re: blk-mq request allocation stalls]X Keith Busch
2015-01-29 23:09                                                                                                 ` Mike Snitzer
2015-01-29 23:44                                                                                                   ` Keith Busch
2015-01-30  0:32                                                                                                     ` Mike Snitzer
2015-01-12 19:05                                                                                   ` blk-mq request allocation stalls Jens Axboe
2015-01-12 19:07                                                                                 ` Mike Snitzer
2015-01-12 18:19                                                                           ` Mike Snitzer
2014-12-17 22:51   ` [PATCH v3 0/8] dm: add request-based blk-mq support Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54B071DC.9000307@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=keith.busch@intel.com \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox