Received: by 10.213.65.68 with SMTP id h4csp1875276imn; Mon, 19 Mar 2018 16:01:57 -0700 (PDT) X-Google-Smtp-Source: AG47ELtBFlh8SMuVKDbDH8smgNt0l38r9IkI2Knqx8XFBlJfAH+iXjpT1OYDBpGsHWTDwjrkGZrD X-Received: by 10.98.37.132 with SMTP id l126mr11808856pfl.102.1521500517701; Mon, 19 Mar 2018 16:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521500517; cv=none; d=google.com; s=arc-20160816; b=KKpDOzNfNNKrwK1vYj0HmzHYlUmvZazRNwY9yOl+A1RBvBnrnBotjazsS7fg5igat8 TG634cZ8D6V8xm3EFQWKD/Fl3L6aayO0kq8xfZNGVS/BtT6dkmJzZ6YzzE/+SCwD5GrN wWMD7WnvzkJEGy/Iy+q3o7EhSk5QNn6Y2Uva1KLzS/4TC6nLPgDbmNKBkuYagf1QmC5n Mz6AMIeZEEdlTEvB8xM5UGrSaKPVhOjUBjMNoN2hLPCID01U2ZnN7DX8Ca6z4lHhX3s4 zasRoGym338LJbq65n7fcNAw6Dw5itGJYbpJpWsImfiEduINwudSUKvfQnOHs33KQ6rA bYHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=EGhLk87yrXMaB8CaksbCyiUfI9xd+TKWp3PnxsVetkQ=; b=zdw1XFCIEfcuG41ea6mOC5j4q7YzygRGvXBGQrEUhwmZz+ONBTpONgC0s2PfPOnXsx ///aerMDZwUfX3RaUNTPBH2vTuB+jnCMohaSfACq/junSC7KDYhjXYfpIO1s3A4KmzAE fqWF8IdbGbrx05Cy+DE2e7q+PPThGVp4eQj2usUef+39GTmNGJqx2UIBiot3KsyP8oYs fFjdQExfMgdIzOpYrtghppZdiLFcPLdlpswDYqHkAQ9TWpIiH0Bsl8mRyUinvIg5aIrw uXX3XHuwBEEukF/JbunbTHvnf3++Amu9STES1qAFkytaLeTw0BOKV0vsoGzcCfAqt8a8 UFow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=OacZDQBO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b67si202581pga.503.2018.03.19.16.01.42; Mon, 19 Mar 2018 16:01:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=OacZDQBO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934005AbeCSPtr (ORCPT + 99 others); Mon, 19 Mar 2018 11:49:47 -0400 Received: from mail-sn1nam01on0129.outbound.protection.outlook.com ([104.47.32.129]:20557 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933985AbeCSPti (ORCPT ); Mon, 19 Mar 2018 11:49:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EGhLk87yrXMaB8CaksbCyiUfI9xd+TKWp3PnxsVetkQ=; b=OacZDQBOU3B95Gu94XDB4hgqzHQLezTVYj8DMm7PCzkN0nDbG/9U+7HcPmaz4AvJ1sciFBaJVPUOAR1vQpHmz8PtNfr2RsShuNCizEePBHdgHDwn3QUWGwk2ukoW4WAgrvlIa6ptu1NMcwcssGwuQZJX9z4MpUW5VN7n44zFHKc= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0981.namprd21.prod.outlook.com (52.132.133.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:49:36 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:49:36 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Ming Lei , Jens Axboe , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 091/124] blk-mq: fix kernel oops in blk_mq_tag_idle() Thread-Topic: [PATCH AUTOSEL for 4.15 091/124] blk-mq: fix kernel oops in blk_mq_tag_idle() Thread-Index: AQHTv5nACCKnRiB4bUmve/uBBaMucA== Date: Mon, 19 Mar 2018 15:48:41 +0000 Message-ID: <20180319154645.11350-91-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0981;7:iSLXMxIN2ojX8Bwb932V/2rdVZYNtED+t9mbb4uvY6fKgEkAI+edC8DvTyKsNCXWRe3eF0MwpopWpAWl8UzEDtMuEAQubP7J2rRodCj8HHFLn9hA3HtuntBVl1Sz+nzBLGw/WRBdPpeBTmz8LQn/rbP/e3zQTGIwwB0L4/xiiOiNmExrOT2RdSVXO894Xr8k1m5y4GTF+V/JDm7svNz11L88l1aRP8xWKTLQPTuX1TZv/N00iqZumhp1w3etDIZa;20:GM1vj6SY0xExjYLrQapN9ORY6y6uDMdPIb8I7GARaDdb+8mwe4m2slIqAKlnDjHPJ35dnlBMLKcTmHL+Fj9gBjXuwL4dtgEdm8ILNrdPKk6ytkSDcV/eoI9hAF/233qy64ehXKFb/XPDUHw7XUTTzl0wrjyGOr8ilqgQV8prjNc= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9d089272-2300-4fe4-59fa-08d58db10484 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0981; x-ms-traffictypediagnostic: DM5PR2101MB0981: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0981;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0981; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(396003)(376002)(366004)(39860400002)(39380400002)(189003)(199004)(51234002)(66066001)(6486002)(26005)(110136005)(5660300001)(54906003)(3280700002)(6512007)(68736007)(102836004)(6436002)(107886003)(10290500003)(53936002)(186003)(59450400001)(72206003)(14454004)(36756003)(6666003)(2950100002)(316002)(6506007)(22452003)(478600001)(10090500001)(106356001)(105586002)(99286004)(7736002)(3660700001)(86362001)(575784001)(76176011)(305945005)(86612001)(2501003)(97736004)(5250100002)(4326008)(3846002)(6116002)(1076002)(8936002)(25786009)(81156014)(81166006)(8676002)(2900100001)(2906002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0981;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: VDVQcCSGWL280IllJ1x+M/q6I6nmHLfryb4Z6GULlXLPXycLSl5Lgb23+DLTgnQMafxOC5qcM40CIlX8JLpoJpcRqgVURNSBCVwOTo2/z9z5Fipklys2Co6gfKykqYX+XoC+U3EWlHiWi5Wjf0p7+HojLIx8DnWKBSKpBGx6tBQh0LaN2S+BgZiTxMDb5ZacEZ+hB9hvuTX2aG+9I7YkYOG8FluUTtjjU0m01gsqd4f4yYLWVe6H6x+9faLoICm8L8pouHWb0KvnI8sGld1Zr6Qjm/gS2+PQ8KdHjE9msvcJkj9dj0ZS3iYB6IrimIxRlik5VTdZDUnqjoLmeAzqvw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d089272-2300-4fe4-59fa-08d58db10484 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:48:41.2165 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0981 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ming Lei [ Upstream commit 8ab0b7dc73e1b3e2987d42554b2bff503f692772 ] HW queues may be unmapped in some cases, such as blk_mq_update_nr_hw_queues= (), then we need to check it before calling blk_mq_tag_idle(), otherwise the following kernel oops can be triggered, so fix it by checking if the hw queue is unmapped since it doesn't make sense to idle the tags any more after hw queues are unmapped. [ 440.771298] Workqueue: nvme-wq nvme_rdma_del_ctrl_work [nvme_rdma] [ 440.779104] task: ffff894bae755ee0 ti: ffff893bf9bc8000 task.ti: ffff893= bf9bc8000 [ 440.788359] RIP: 0010:[] [] __blk_m= q_tag_idle+0x24/0x40 [ 440.798697] RSP: 0018:ffff893bf9bcbd10 EFLAGS: 00010286 [ 440.805538] RAX: 0000000000000000 RBX: ffff895bb131dc00 RCX: 00000000000= 0011f [ 440.814426] RDX: 00000000ffffffff RSI: 0000000000000120 RDI: ffff895bb13= 1dc00 [ 440.823301] RBP: ffff893bf9bcbd10 R08: 000000000001b860 R09: 4a51d361c00= c0000 [ 440.832193] R10: b5907f32b4cc7003 R11: ffffd6cabfb57000 R12: ffff894bafd= 1e008 [ 440.841091] R13: 0000000000000001 R14: ffff895baf770000 R15: 00000000000= 00080 [ 440.849988] FS: 0000000000000000(0000) GS:ffff894bbdcc0000(0000) knlGS:= 0000000000000000 [ 440.859955] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 440.867274] CR2: 0000000000000008 CR3: 000000103d098000 CR4: 00000000001= 407e0 [ 440.876169] Call Trace: [ 440.879818] [] blk_mq_exit_hctx+0xd8/0xe0 [ 440.887051] [] blk_mq_free_queue+0xf0/0x160 [ 440.894465] [] blk_cleanup_queue+0xd9/0x150 [ 440.901881] [] nvme_ns_remove+0x5b/0xb0 [nvme_core] [ 440.910068] [] nvme_remove_namespaces+0x3b/0x60 [nvme= _core] [ 440.919026] [] __nvme_rdma_remove_ctrl+0x2b/0xb0 [nvm= e_rdma] [ 440.928079] [] nvme_rdma_del_ctrl_work+0x17/0x20 [nvm= e_rdma] [ 440.937126] [] process_one_work+0x17a/0x440 [ 440.944517] [] worker_thread+0x278/0x3c0 [ 440.951607] [] ? manage_workers.isra.24+0x2a0/0x2a0 [ 440.959760] [] kthread+0xcf/0xe0 [ 440.966055] [] ? insert_kthread_work+0x40/0x40 [ 440.973715] [] ret_from_fork+0x58/0x90 [ 440.980586] [] ? insert_kthread_work+0x40/0x40 [ 440.988229] Code: 5b 41 5c 5d c3 66 90 0f 1f 44 00 00 48 8b 87 20 01 00 = 00 f0 0f ba 77 40 01 19 d2 85 d2 75 08 c3 0f 1f 80 00 00 00 00 55 48 89 e5 = ff 48 08 48 8d 78 10 e8 7f 0f 05 00 5d c3 0f 1f 00 66 2e 0f [ 441.011620] RIP [] __blk_mq_tag_idle+0x24/0x40 [ 441.019301] RSP [ 441.024052] CR2: 0000000000000008 Reported-by: Zhang Yi Tested-by: Zhang Yi Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 1372ad3a21d3..ab88ff3314a7 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1996,7 +1996,8 @@ static void blk_mq_exit_hctx(struct request_queue *q, { blk_mq_debugfs_unregister_hctx(hctx); =20 - blk_mq_tag_idle(hctx); + if (blk_mq_hw_queue_mapped(hctx)) + blk_mq_tag_idle(hctx); =20 if (set->ops->exit_request) set->ops->exit_request(set, hctx->fq->flush_rq, hctx_idx); --=20 2.14.1