From patchwork Fri Jan 9 21:56:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 5603041 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3B9E69F1C5 for ; Fri, 9 Jan 2015 22:01:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48F052062C for ; Fri, 9 Jan 2015 22:01:00 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3890E205FF for ; Fri, 9 Jan 2015 22:00:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t09Lufoj006275; Fri, 9 Jan 2015 16:56:42 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t09Luebm027575 for ; Fri, 9 Jan 2015 16:56:40 -0500 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t09LueZb002022 for ; Fri, 9 Jan 2015 16:56:40 -0500 Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t09Ludul016621 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Fri, 9 Jan 2015 16:56:39 -0500 Received: by mail-pd0-f174.google.com with SMTP id fp1so19658745pdb.5 for ; Fri, 09 Jan 2015 13:56:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type; bh=QsAHeGL74OMEy23REumpfvbQzA8IxBltHH6amX89Bkw=; b=NF9rSIBTaC8ZKrFJ/RO0f2j0Po+TjwroTykzIKekIWq150PCMQYHiwYFDG+2+9BVzF AXDJepTR+XuVE3EyT/QJL/z4pZEi0jqHQR1ldCJpV5HhD/Cp8uzYQJ60Eo8rfrhVeIaL mDfQF75nglt/gPGcja3x3bP1UT9C9RKsMhOdQcoQEC3ir9wYcqYG9K7SQAgB5SaFlVfH /ogv2vzo/QXm90YeTw6gAgOk3QwNacri9ndzJ+ib2w9CsU6W2ygQOjT7Q4Bg160/DMw0 8WZ6e/inhlwOSqg6TDvJNS53xV7LSXVKJpzyb3UrRC+0XUhg/6wpssCJTIE6y016ao/c RF0Q== X-Gm-Message-State: ALoCoQlBIlRbsTVXYtc1u6TyuOpaOWxLnOaXL5V72pfAXeRWsLvwJ07lY6UL7+U7YIjQSX1r/vku X-Received: by 10.68.57.144 with SMTP id i16mr26734557pbq.86.1420840599143; Fri, 09 Jan 2015 13:56:39 -0800 (PST) Received: from [172.20.10.3] (mobile-166-171-120-001.mycingular.net. [166.171.120.1]) by mx.google.com with ESMTPSA id i7sm7994067pdp.3.2015.01.09.13.56.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jan 2015 13:56:38 -0800 (PST) Message-ID: <54B04E94.3010403@kernel.dk> Date: Fri, 09 Jan 2015 14:56:36 -0700 From: Jens Axboe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Mike Snitzer References: <54A6DB1D.4030201@acm.org> <20150105213557.GA5030@redhat.com> <54ABAB80.70006@acm.org> <20150106160553.GB10224@redhat.com> <54AC0A39.90801@kernel.dk> <54AD0B63.3010505@acm.org> <20150109194955.GA32641@redhat.com> <54B042FE.2000205@kernel.dk> <54B043FC.8000902@kernel.dk> <20150109214015.GA1032@redhat.com> In-Reply-To: <20150109214015.GA1032@redhat.com> X-RedHat-Spam-Score: -2.034 (BAYES_00, DCC_REPUT_13_19, RCVD_IN_DNSWL_LOW, SPF_SOFTFAIL, URIBL_BLOCKED) 209.85.192.174 mail-pd0-f174.google.com 209.85.192.174 mail-pd0-f174.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: Keith Busch , Christoph Hellwig , device-mapper development , Bart Van Assche , "Jun'ichi Nomura" Subject: Re: [dm-devel] blk-mq request allocation stalls [was: Re: [PATCH v3 0/8] dm: add request-based blk-mq support] X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 01/09/2015 02:40 PM, Mike Snitzer wrote: > On Fri, Jan 09 2015 at 4:11pm -0500, > Jens Axboe 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? diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 60c9d4a93fe4..4130c2bdc6c0 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -143,28 +143,31 @@ 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; org_last_tag = last_tag; end = bm->depth; - do { -restart: - tag = find_next_zero_bit(&bm->word, end, last_tag); + while (1) { + tag = find_next_zero_bit(&bm->word, bm->depth, last_tag); if (unlikely(tag >= end)) { /* * We started with an offset, start from 0 to * exhaust the map. */ - if (wrap) { - wrap = false; + if (org_last_tag) { end = org_last_tag; - last_tag = 0; - goto restart; + 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 +202,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;