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=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 F1DA8C4320A for ; Tue, 3 Aug 2021 09:07:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9EE0D60F8F for ; Tue, 3 Aug 2021 09:07:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9EE0D60F8F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=cpHx2siLTTZQaBATWjuYQ2f68E3pmrDuYQQoXNxOC8w=; b=cacyCuuoTP1/fZ z1ujXuA5rZ1TVT9w/j9HURcZRtbYy7Zu+ZdDuzXn1gSH9lzRRom/+f13Gk7uZGcUSTvk0uLaeyejj CKDRy/Z+GbRdNtUeBl4lU5gVCprxx/VW33NR+62MCXLPMwTa1q+nvSy3SOGOOuQT278X7UGfbbVpx KV6uiTuRb9YCdVE3+sPbcnhWNG3nexlewQ3z38Ohkd0qwetNakgahq2UVM4ZW1FTd914Ed8ODWJKy 04QVOvQx3Wq9g9dyQCW89h4w2iJybxtyO+JLBD9kCCYINjBbsBbAp2wu/Mt6lVXFdLJBuIM1vibF6 M5Qh9FyYRHT5bUUQG1VA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAqO7-001gnY-80; Tue, 03 Aug 2021 09:07:03 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAqNj-001gk1-Mb for linux-nvme@lists.infradead.org; Tue, 03 Aug 2021 09:06:42 +0000 Received: from dggeme720-chm.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Gf8BB18n3z1CRXK for ; Tue, 3 Aug 2021 17:06:26 +0800 (CST) Received: from huawei.com (10.29.88.127) by dggeme720-chm.china.huawei.com (10.1.199.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 3 Aug 2021 17:06:30 +0800 From: Ruozhu Li To: Subject: [PATCH 0/2] Fix crash when rescan ns after set queue count cmd timeout Date: Tue, 3 Aug 2021 17:06:28 +0800 Message-ID: <20210803090630.14425-1-liruozhu@huawei.com> X-Mailer: git-send-email 2.16.4 MIME-Version: 1.0 X-Originating-IP: [10.29.88.127] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeme720-chm.china.huawei.com (10.1.199.116) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210803_020639_971754_33223E1F X-CRM114-Status: UNSURE ( 8.45 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org Hi, We got a BUG_ON when rescan ns after set queue count cmd timeout: -- BUG_ON(hctx_idx >= ctrl->ctrl.queue_count); //nvme_rdma_init_hctx -- Call trace: nvme_rdma_init_hctx+0x58/0x60 [nvme_rdma] blk_mq_realloc_hw_ctxs+0x140/0x4c0 blk_mq_init_allocated_queue+0x130/0x410 blk_mq_init_queue+0x40/0x88 nvme_validate_ns+0xb8/0x740 nvme_scan_work+0x29c/0x460 process_one_work+0x1f8/0x490 worker_thread+0x50/0x4b8 kthread+0x134/0x138 ret_from_fork+0x10/0x18 -- This happened because: 1) Host set queue count feature timeout in reconnection, set ctrl-> queue_count to 1, and schedule another reconnect. 2) Next reconnection succeed but not create any io queues, because ctrl->queue_count set to 1, host won't configure io queue again. 3) Del/add ns on ctrl causes host rescan ns, kernel BUG_ON when detect hctx_idx greater than ctrl->queue_count. Try to fix it with following patches.Any comments and reviews are welcome. Thanks, Ruozhu Ruozhu Li (2): nvme-rdma: always try to configure io queue when user wants it nvme: don't do scan work if io queue count is zero drivers/nvme/host/core.c | 6 ++++-- drivers/nvme/host/rdma.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) -- 2.16.4 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme