From mboxrd@z Thu Jan 1 00:00:00 1970 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 27E0AC2BB85 for ; Sat, 11 Apr 2020 12:23:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 014F22084D for ; Sat, 11 Apr 2020 12:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586607815; bh=Zsa07Z6uzhOMssZ0/0MH153k2g1cGlURZpFxTOJBW0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zoEvSTBBiBdzTMcKfN1damW5aOjXqAIm/RsuX8wuWOBxct829EL2rXZ5ByvHDmcj9 GFFdlBgRXUAgA2EwRXIqS89qHu5P5nIpBor7DULPXyehDDE0L5SPV0M6GlEd/aOdWf hGIYc7frAysJ5t5s/pN+do85e7pAHba66Dcwb8OM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728770AbgDKMTV (ORCPT ); Sat, 11 Apr 2020 08:19:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:54728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728765AbgDKMTU (ORCPT ); Sat, 11 Apr 2020 08:19:20 -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 7E324206A1; Sat, 11 Apr 2020 12:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586607561; bh=Zsa07Z6uzhOMssZ0/0MH153k2g1cGlURZpFxTOJBW0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wmdQU4sWzhPqV799LmGQGs4LSlVwCZWUeQZwE+dK7EJPJFeQmlRZVuIIuXHAr1n3p CfJaaygwbaO/HTseVeEPAZDdYh7+3FQR9cvu3ZMpwzFO7I/5I2JJscbHeox46bfX2z 8+utniuSlEi/Q61yGTQDUbYijspV1FxeZ3rzO0Wg= 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.5 28/44] blk-mq: Keep set->nr_hw_queues and set->map[].nr_queues in sync Date: Sat, 11 Apr 2020 14:09:48 +0200 Message-Id: <20200411115459.523169319@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200411115456.934174282@linuxfoundation.org> References: <20200411115456.934174282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 @@ -2965,6 +2965,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;