From patchwork Wed Apr 5 18:28:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9665397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8BEFF60353 for ; Wed, 5 Apr 2017 18:29:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8405127F94 for ; Wed, 5 Apr 2017 18:29:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79145285A3; Wed, 5 Apr 2017 18:29:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00316285A5 for ; Wed, 5 Apr 2017 18:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933336AbdDES31 (ORCPT ); Wed, 5 Apr 2017 14:29:27 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:33395 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932546AbdDES30 (ORCPT ); Wed, 5 Apr 2017 14:29:26 -0400 Received: by mail-pg0-f54.google.com with SMTP id x125so12190232pgb.0 for ; Wed, 05 Apr 2017 11:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=xbPJCt9016SF4j7gWxZPoiWwXqJSpxqhXi4qUAYCzZ0=; b=BQ7sypF10Zs36E/8WxlaSg+CGjvma753kE2T7BeC6LWJPB2wS0j119nS8XDGFoKowQ StHEXHp58rkjNdBZcsMMQd07BNTf9csanS5hhEFJOVwitUbbWYNWca0bwJtK6m23cUCE QFUEWL/PEFj7/IKcfiz0RufpA+a4QSPKzN5uTRUDWLfnFsD1gsKpvh+gBlm2/5Dc7Fxr bmjrM/2uCnBkqXMqztU2eB4UvU01Nyu7SD1oFrZoIBjpHWm/BE49HKFX16wFZkt2lhe2 jWV+71/KJNlTBd0x7q6fY+TL7as0eiPwbn0cS7AZ8Zch2jbJqJKdhsucWcNgB/qWY285 QG9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=xbPJCt9016SF4j7gWxZPoiWwXqJSpxqhXi4qUAYCzZ0=; b=evUB7jIt2nAS2I2s/XTbLZRPHBCZmLtIEN60W+yk3s6HleDt4RJ0x0vJ8nMjhxzoll hqC06iKkesdZO3Rekad5IoskksRk06LU4MgrcKk+rxHa3rbMKFR9Ttx/vvm3k+mQMCvz PIgI5Sb8XazO7Tigc3nb4rHkbZ+/gdd5LVASSQhe9XygLpXJ6YlTI/VJNRWIdRUNrYQv 5SHTireEdmVyivTTtVbnG3UQDjXwyTRIAevrz8CYRZkMqtQ7sDAm7MIY+/YVkDZ0okL7 VCHjDXMSfAorgom8KoH3lrZcLjgs6qlWpAddqDDB8rRoYPwZqSIRXJGh37aDW3Y0kfWe IfUw== X-Gm-Message-State: AFeK/H0aoRpH5K/4tgFcBgQRRV+7JwJPeb+EFcrdMj820jF471s5HjaWvovOTL6kmgDVJdwb X-Received: by 10.99.8.193 with SMTP id 184mr19559768pgi.189.1491416965985; Wed, 05 Apr 2017 11:29:25 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::a:a8dd]) by smtp.gmail.com with ESMTPSA id x10sm38801490pff.72.2017.04.05.11.29.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 11:29:25 -0700 (PDT) From: Omar Sandoval To: Jens Axboe , linux-block@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH v2 5/8] blk-mq: remap queues when adding/removing hardware queues Date: Wed, 5 Apr 2017 11:28:17 -0700 Message-Id: <97aff6e13605fa243936d9119ecc48ceb6e1e7e5.1491416593.git.osandov@fb.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: References: In-Reply-To: References: Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval blk_mq_update_nr_hw_queues() used to remap hardware queues, which is the behavior that drivers expect. However, commit 4e68a011428a changed blk_mq_queue_reinit() to not remap queues for the case of CPU hotplugging, inadvertently making blk_mq_update_nr_hw_queues() not remap queues as well. This breaks, for example, NBD's multi-connection mode, leaving the added hardware queues unused. Fix it by making blk_mq_update_nr_hw_queues() explicitly remap the queues. Fixes: 4e68a011428a ("blk-mq: don't redistribute hardware queues on a CPU hotplug event") Reviewed-by: Keith Busch Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Signed-off-by: Omar Sandoval --- block/blk-mq.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 53c5c6097be9..4aa3148befe1 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2484,6 +2484,14 @@ static int blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set) return 0; } +static int blk_mq_update_queue_map(struct blk_mq_tag_set *set) +{ + if (set->ops->map_queues) + return set->ops->map_queues(set); + else + return blk_mq_map_queues(set); +} + /* * Alloc a tag set to be associated with one or more request queues. * May fail with EINVAL for various error conditions. May adjust the @@ -2538,10 +2546,7 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) if (!set->mq_map) goto out_free_tags; - if (set->ops->map_queues) - ret = set->ops->map_queues(set); - else - ret = blk_mq_map_queues(set); + ret = blk_mq_update_queue_map(set); if (ret) goto out_free_mq_map; @@ -2633,6 +2638,7 @@ void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues) blk_mq_freeze_queue(q); set->nr_hw_queues = nr_hw_queues; + blk_mq_update_queue_map(set); list_for_each_entry(q, &set->tag_list, tag_set_list) { blk_mq_realloc_hw_ctxs(set, q); blk_mq_queue_reinit(q, cpu_online_mask);