From patchwork Sat Apr 11 12:09:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 228032 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1D44C2BA2B for ; Sat, 11 Apr 2020 12:24:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98D7C20787 for ; Sat, 11 Apr 2020 12:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586607856; bh=si/5L5aBCOmz5fCXhPA3GghvYAVm3te4zHrc+nXHuUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ynGjtSZuUnVnKK6oLGH6MFn6tG0dLDvjXZwRpjRDV+OVJ3OHz6cBAjH5v2QrKCQ5f mCb8n4zRTvwRd4z0rRKgVq/S2bMjJekICYbvAwqDg0Eidfznze3cH8Bq2BxIXmL3pv DguEdz/qQ1mpzo9mvxnOUt7SIWido62/iAwL7G1U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728595AbgDKMSW (ORCPT ); Sat, 11 Apr 2020 08:18:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:53268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728564AbgDKMSV (ORCPT ); Sat, 11 Apr 2020 08:18:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8BE6C20692; Sat, 11 Apr 2020 12:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586607501; bh=si/5L5aBCOmz5fCXhPA3GghvYAVm3te4zHrc+nXHuUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdnZN2PbdR/tTfGLh9/7wveImx+4Hw3TKfePJkxN4VvHGhEcLmTOxMi1H/QxO12z2 zeEzdaMD2/DQhsAehyNnc+fSf4TIgcFshuJrO8AazqS6G/OT9cmI8zLettvTJz/E00 AVgx5kA86AY95kb8NdR80NEKs7h6RhGkgbW6SlWk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+d44e1b26ce5c3e77458d@syzkaller.appspotmail.com, Bart Van Assche , Ming Lei , Chaitanya Kulkarni , Johannes Thumshirn , Hannes Reinecke , Christoph Hellwig , Jens Axboe Subject: [PATCH 5.4 38/41] blk-mq: Keep set->nr_hw_queues and set->map[].nr_queues in sync Date: Sat, 11 Apr 2020 14:09:47 +0200 Message-Id: <20200411115506.857351630@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200411115504.124035693@linuxfoundation.org> References: <20200411115504.124035693@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bart Van Assche commit 6e66b49392419f3fe134e1be583323ef75da1e4b upstream. blk_mq_map_queues() and multiple .map_queues() implementations expect that set->map[HCTX_TYPE_DEFAULT].nr_queues is set to the number of hardware queues. Hence set .nr_queues before calling these functions. This patch fixes the following kernel warning: WARNING: CPU: 0 PID: 2501 at include/linux/cpumask.h:137 Call Trace: blk_mq_run_hw_queue+0x19d/0x350 block/blk-mq.c:1508 blk_mq_run_hw_queues+0x112/0x1a0 block/blk-mq.c:1525 blk_mq_requeue_work+0x502/0x780 block/blk-mq.c:775 process_one_work+0x9af/0x1740 kernel/workqueue.c:2269 worker_thread+0x98/0xe40 kernel/workqueue.c:2415 kthread+0x361/0x430 kernel/kthread.c:255 Fixes: ed76e329d74a ("blk-mq: abstract out queue map") # v5.0 Reported-by: syzbot+d44e1b26ce5c3e77458d@syzkaller.appspotmail.com Signed-off-by: Bart Van Assche Reviewed-by: Ming Lei Reviewed-by: Chaitanya Kulkarni Cc: Johannes Thumshirn Cc: Hannes Reinecke Cc: Ming Lei Cc: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-mq.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3007,6 +3007,14 @@ static int blk_mq_alloc_rq_maps(struct b static int blk_mq_update_queue_map(struct blk_mq_tag_set *set) { + /* + * blk_mq_map_queues() and multiple .map_queues() implementations + * expect that set->map[HCTX_TYPE_DEFAULT].nr_queues is set to the + * number of hardware queues. + */ + if (set->nr_maps == 1) + set->map[HCTX_TYPE_DEFAULT].nr_queues = set->nr_hw_queues; + if (set->ops->map_queues && !is_kdump_kernel()) { int i;