From patchwork Thu Jul 27 14:47:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 794468 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xJFbX1X0Yz9s06 for ; Fri, 28 Jul 2017 01:03:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="n7FYH4vQ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xJFbX08R4zDrKx for ; Fri, 28 Jul 2017 01:03:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="n7FYH4vQ"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org X-Greylist: delayed 616 seconds by postgrey-1.36 at bilbo; Fri, 28 Jul 2017 00:57:51 AEST Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.b="n7FYH4vQ"; dkim-atps=neutral Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xJFTD3HmdzDrJT for ; Fri, 28 Jul 2017 00:57:50 +1000 (AEST) X-IronPort-AV: E=Sophos;i="5.40,419,1496073600"; d="scan'208";a="37390141" Received: from mail-dm3nam03lp0024.outbound.protection.outlook.com (HELO NAM03-DM3-obe.outbound.protection.outlook.com) ([207.46.163.24]) by ob1.hgst.iphmx.com with ESMTP; 27 Jul 2017 22:47:31 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=foRCAilbeppKvc/P8X68PCX6LQ5V9weKBAqzOT6S88A=; b=n7FYH4vQ30r4HiKa+NqaYpKyy94LrCAqcRBastpvwaEZzU4ydxKgxGaOmUtCc7PJrhhBPOAo+RlYSV7zGCzAzlpVxYudc+MgYWXVcX2KeEoMgrDVtugntFKaEQmyO+AvCwLNIjaFBIXwqpAurEIO1vTaGTXpfg1onfrihHi/sK8= Received: from CY1PR0401MB1536.namprd04.prod.outlook.com (10.163.19.154) by CY1PR0401MB1533.namprd04.prod.outlook.com (10.163.19.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1282.10; Thu, 27 Jul 2017 14:47:29 +0000 Received: from CY1PR0401MB1536.namprd04.prod.outlook.com ([10.163.19.154]) by CY1PR0401MB1536.namprd04.prod.outlook.com ([10.163.19.154]) with mapi id 15.01.1282.021; Thu, 27 Jul 2017 14:47:29 +0000 From: Bart Van Assche To: "mpe@ellerman.id.au" , "axboe@kernel.dk" Subject: Re: blk_mq_sched_insert_request: inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage Thread-Topic: blk_mq_sched_insert_request: inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage Thread-Index: AQHTBpbYyx2cmVtqXUGNBRJ+OE1bb6JntOSAgAAMdAA= Date: Thu, 27 Jul 2017 14:47:28 +0000 Message-ID: <1501166846.2516.1.camel@wdc.com> References: <87a83qfosu.fsf@concordia.ellerman.id.au> <073ed79c-11ce-e86c-a905-91fd28675d47@kernel.dk> In-Reply-To: <073ed79c-11ce-e86c-a905-91fd28675d47@kernel.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; x-originating-ip: [63.163.107.100] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY1PR0401MB1533; 20:KcFcEOvkIeLacdwSD5dGnDr+d7WCLOntcxAZ6fJp4ylqUHMMxL4VSxyFhuf/BKjnBr911dejKcaRAapzeBv/+gj3QNV1ZUGNDgZ9Foq8MF369gz5/KvAlY4fSNVC8ZaJS/Vlm6DMRz3YCJ/f+Ya7KqQqwbROd3jJKJKw0T3dqC8= x-ms-office365-filtering-correlation-id: 7254c25e-614b-4c55-ba68-08d4d4fe67a3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254075)(300000503095)(300135400095)(48565401081)(2017052603031)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY1PR0401MB1533; x-ms-traffictypediagnostic: CY1PR0401MB1533: wdcipoutbound: EOP-TRUE x-exchange-antispam-report-test: UriScan:; x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR0401MB1533; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR0401MB1533; x-forefront-prvs: 03818C953D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(39850400002)(39410400002)(39860400002)(39450400003)(39400400002)(39840400002)(199003)(24454002)(377424004)(189002)(105586002)(230783001)(2900100001)(189998001)(106356001)(33646002)(36756003)(478600001)(25786009)(3846002)(2501003)(575784001)(66066001)(3660700001)(3280700002)(102836003)(2906002)(6116002)(6436002)(86362001)(2950100002)(101416001)(103116003)(229853002)(76176999)(50986999)(305945005)(6506006)(7736002)(54356999)(4326008)(38730400002)(6246003)(72206003)(97736004)(5660300001)(68736007)(53936002)(54906002)(81166006)(81156014)(6512007)(8936002)(14454004)(99286003)(77096006)(6486002)(8676002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0401MB1533; H:CY1PR0401MB1536.namprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: wdc.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <3AE2FE7ECBCBA94C969EA425D4CAE2A2@namprd04.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jul 2017 14:47:28.9616 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0401MB1533 X-Mailman-Approved-At: Fri, 28 Jul 2017 01:01:43 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-block@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, 2017-07-27 at 08:02 -0600, Jens Axboe wrote: > The bug looks like SCSI running the queue inline from IRQ > context, that's not a good idea. Can you confirm the below works for > you? > > > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index f6097b89d5d3..78740ebf966c 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -497,7 +497,7 @@ static void scsi_run_queue(struct request_queue *q) > scsi_starved_list_run(sdev->host); > > if (q->mq_ops) > - blk_mq_run_hw_queues(q, false); > + blk_mq_run_hw_queues(q, true); > else > blk_run_queue(q); > } Hello Jens, scsi_run_queue() works fine if no scheduler is configured. Additionally, that code predates the introduction of blk-mq I/O schedulers. I think it is nontrivial for block driver authors to figure out that a queue has to be run from process context if a scheduler has been configured that does not support to be run from interrupt context. How about adding WARN_ON_ONCE(in_interrupt()) to blk_mq_start_hw_queue() or replacing the above patch by the following: Subject: [PATCH] blk-mq: Make it safe to call blk_mq_start_hw_queues() from interrupt context blk_mq_start_hw_queues() triggers a queue run. Some functions that get called to run a queue, e.g. dd_dispatch_request(), are not IRQ-safe. Hence run the queue asynchronously if blk_mq_start_hw_queues() is called from interrupt context. Signed-off-by: Bart Van Assche --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Thanks, Bart. diff --git a/block/blk-mq.c b/block/blk-mq.c index 041f7b7fa0d6..c5cb3b2aabcf 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1251,7 +1251,7 @@ void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx) { clear_bit(BLK_MQ_S_STOPPED, &hctx->state); - blk_mq_run_hw_queue(hctx, false); + blk_mq_run_hw_queue(hctx, in_interrupt()); } EXPORT_SYMBOL(blk_mq_start_hw_queue);