From patchwork Tue Oct 18 21:52:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9383147 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C00C600CA for ; Tue, 18 Oct 2016 21:52:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFE792881F for ; Tue, 18 Oct 2016 21:52:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E44DC2896D; Tue, 18 Oct 2016 21:52:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50DE829773 for ; Tue, 18 Oct 2016 21:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756056AbcJRVwi (ORCPT ); Tue, 18 Oct 2016 17:52:38 -0400 Received: from mail-dm3nam03on0061.outbound.protection.outlook.com ([104.47.41.61]:44075 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932109AbcJRVwf (ORCPT ); Tue, 18 Oct 2016 17:52:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=JVihPkv1C8YtCqKPz0mC0P7INXEsyHzYeKkIwbkbyM8=; b=SjDTDExWQGFXtS3TlBGSDKjvrj3XoboS4RJTfPuLdeSAZHoZle7Nsiszc5SgDaRZXIoHHEDpvcLn4kkjUqoQjQvY3IKT+ay5z3zDAkRDawnkF/HuLrC45waD59g11HQD1/twBFcuTWWgsCcJ7yY0ybuaq0YwEKsCiwRDcrpcbbA= Received: from BY1PR0201CA0017.namprd02.prod.outlook.com (10.160.191.155) by SN1PR0201MB1918.namprd02.prod.outlook.com (10.163.76.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Tue, 18 Oct 2016 21:52:32 +0000 Received: from BY2FFO11FD040.protection.gbl (2a01:111:f400:7c0c::143) by BY1PR0201CA0017.outlook.office365.com (2a01:111:e400:4814::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.12 via Frontend Transport; Tue, 18 Oct 2016 21:52:32 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BY2FFO11FD040.mail.protection.outlook.com (10.1.14.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.7 via Frontend Transport; Tue, 18 Oct 2016 21:52:31 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id A4.DD.26959.E1796085; Tue, 18 Oct 2016 14:41:51 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Tue, 18 Oct 2016 14:52:31 -0700 X-AuditID: 0ac94369-b97ff7000001694f-6b-5806971e72a9 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 97.D9.02564.F9996085; Tue, 18 Oct 2016 14:52:31 -0700 (PDT) Subject: [PATCH v3 08/11] SRP transport: Move queuecommand() wait code to SCSI core To: Jens Axboe References: CC: Christoph Hellwig , James Bottomley , "Martin K. Petersen" , Mike Snitzer , Doug Ledford , Keith Busch , Ming Lin , Laurence Oberman , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "linux-nvme@lists.infradead.org" From: Bart Van Assche Message-ID: <09a8efcb-d0e0-d5bd-288c-686b553e6326@sandisk.com> Date: Tue, 18 Oct 2016 14:52:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLIsWRmVeSWpSXmKPExsXCddJ5ka78dLYIg4cbOCz+7znGZvHy/AdW i5WrjzJZrJqYZ3Hv6Bcmi723tC3mL3vKbvHsUC+LRff1HWwW5z+8YrJYfvwfk0V7bwezRdvG r4wOvB4Tm9+xeyze85LJ48GhzSwem5fUe+y+2cDm8fHpLRaP9/uusnm8fbmT1ePzJrkAzigu m5TUnMyy1CJ9uwSujO73O5kLjqpXTFnykLWBcZNiFyMnh4SAicTe5X2sXYxcHEICS5kk9rX+ Z4FwdjBKvDvexgJTNfl4MxuIDVTFKNH4RBTEFhYIlXjf/xgsLiIgK/F992uoGjuJt+t3gg1i FtjLIvHw8i1WkASbgJHEt/czgRIcHLxARVNmWoKEWQRUJfYsWALWKyoQIbHp6xywvbwCghIn Zz4BK+cUsJe4eiAc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a7VU6q+ZMzdOS26TWDavryHOT/K1 8sa9ZTWdLKqVd/MuN29cd1p+ZtjnFbu77qQea0pn9v/FuC7NRHHCViWW4oxEQy3mouJEANEB YZ84AgAA X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(76176999)(11100500001)(4326007)(36756003)(65806001)(65956001)(626004)(4001350100001)(97736004)(69596002)(47776003)(86362001)(2270400002)(2906002)(230700001)(19580395003)(31686004)(81156014)(305945005)(53416004)(81166006)(356003)(7846002)(586003)(8676002)(83506001)(110136003)(31696002)(229853001)(33646002)(189998001)(23676002)(106466001)(8936002)(64126003)(92566002)(68736007)(50466002)(2950100002)(6916009)(19580405001)(7416002)(65826007)(5660300001)(77096005)(50986999)(54356999)(87936001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0201MB1918; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD040; 1:ldKJfYXTjPQ2ep0wID1GU8VzCI1bzHVZVODJJYHaQ+DCOcxf+CMBQg1pYJ2G7etdhTHzu0nXt19QbLQJBFw637LLbV2U1qqaPxj+mB4/r19uhaWnNpHY/0CGhF/mV/oPhaBnbPtp/dejkzROhcazqIAbpuSbR3lh8XjKGX2/54pWsptaXkjECyVpAuQaVZcVFK4L0i0+RQVetBElOHxizqPQX1rbe+WlCJSBjihqFLMWScdR2iZRSJzpH7HntA1jnt3bCVtZfo3/RtWfQ61w1QPRUb8U9zol8A3DKr0DI8mVUbYLl8eF5AZIwB9EhZzV2jmoIVb/3FSY9lSSJg5fAzdCW4yvT7tnSXaPb6Ukz1/fNACEnCLTzhVqq+WQ60LgMLtP4L8J81qKd850HTWVhhsUL2sUy5iSb67Zkl4b5MbFSAGQDjvtdW6YhEL1eak1uCV8r5soVXpbN7yepdS3p7xbIAbkjbsKPpgIAvizQ96CMFoD5Gcbx165JFQjn+ukvcxjH3kT7yuHSKhYx75Ah84QHZIMMp0BVqz21LFUj8XrihjEMGRS+Ik34fEMgayZ X-MS-Office365-Filtering-Correlation-Id: c362146a-2095-45e8-8a50-08d3f7a10ffc X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1918; 2:rOc0rhqlFOtcRk5oGanw3Hw/tlvN3yAfw8BoDeYuh/BtIuU4WvQ8kyio+laMfC01lr69k7dQPe59eKtkuwKhCM9jRB0YDjiEuWdHT2CGyCQGgdATB6RsVHQPfYkAG1s0JxPQ6sauecra4CqfBWPArkMArOap+K3+T9IyEQI4MtC6a7kW1DwIwpGRHKepj+73kzEhyhyHH9k4y3rfrFwCmw==; 3:eKj0lG6459j+erRVupgLZfLudH7eLgHexlbHgUOMUXdocwWJa9tMmhyeRaagSqTWLG137MIK23xMO6uO/tGI09nK1rNOeDadqNktyaCpNK3DroezoBHq78qKL6/EZ+9jqg+FTPEl536T+HztXg3SOdDJ9zNjXR8ehULeMsOGUow6pGkPe3NLkkDXXKte3WMnQDk+KWX9JeJ3HiAeNx4iVV6sFwsjpqjuHPSDcKOs7WxhOmDHe/DtJkYGP+PMUWtN9WuOopSpyGUGZ9wSaaSOuyAMMWxrWdAG5+2PZ/cOtIY=; 25:bcvmmNeRVQ3EgvN9JNdo/ka2EiMfx/i1Db6nGK05O87rITcVA+RVuj/jXBYh/48qrjtQHzs1vaNQjiq15EEQsWvgi3OJx76tJCs5CtI20uS8xLKaYU3jfn9oM7+1UFXLR8klu8P+FNlKf6D/2bdqoUNy0vIx5gxxWmC+/ICVgEbu7sz5P41B21pVl7y6bAjQkWqUo2yikl6aPxbqEyvpey8lJ4c5DEs0MP7AZoedtUTsGkqZuV629YLXtiFfIdtHBYkNLu7ZDc+IYuvbD0a9UW4RBAIPaEKYm4w9iUshNpTggNFEguM/xnk9kMAbmBj7nqmAi/uy2anUpIwBvzzIX61UnJZzC1myPsap524efTmk/egTkE7HQApA19XWM2wsVsHFBGCyaP6al+TjFDhRXfvCS2Xay JZd9VonvUm4qIdj2ptf9gv2ARrv2NRSonGa X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:SN1PR0201MB1918; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1918; 31:CyRk72zSH1wI7MFMZmNF1duz+HmhBUWAnRpD+JcjRqQ62PzS+NKnISjE/IzfumGcz4K6GjJI+iaX9UDYEvY37XZiNjgEn/ZlSe/H6/ZPE1wbK1CqGvhBfvyMetDUNcPNz/jvQRVzfdEUAwhNS9CbaZyycBNrPHAxlaXY1+OX+eN2hsFtEZMj+AwTWcgHMjJg0XEgAymma+Yl+zk42IJmG2lji+eWaH1NLtQ6oBgOWZBwFd/ggfovqsVZ1Bw+lpqOBlqoAViiWZuGYzH6AE9v5g==; 20:zeMPid9qDvXwuo172ar+B7mX/EoQpaSbMPNnSiZNHcHx+n50JGkxd6jqSw1YPXt4eBtF9iAn9LxtY5d3lXaOQ/QS1nH30ASYo4E4YqwQrL4b+ihEgbVZJi3VcbWgD3mrPEWc9WjOK0V7Mzk0urX/1LZjjWqEZKAJRjd4GUPR0oY1FRf22Hpl21YN2Xj1MXoe23PD1L7CTwb5KOSMjLXw6C6g5oQlMfkL1pqafQPrizlRG6HjGkqkNOcB3OvpeJzbg42ZRHrU7RsKi/9fnWinpO0giDRwQgxvqolNFCPh0t/3ZjOLj/jeEW8TRtnDeNF3C5j9Phq1a7l8hJiU5FZ7C2zyy+dK3FA8zNjNrS8abkatUioPXOntvKEeuNL43jkxloEHNCIKxC2e29Vg5j+6YELBh1YdW1Gmz0lq50b2yQYZ7vZ3zO2Oe5OzvCE3oHBa6seDjPeFZxQZ0H+h3BwB5f+2nZFnMjxBP9BUjW2dh2+bsQd6OHjOYifouCW/bCUN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(104084551191319)(146099531331640)(42932892334569)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(13016025)(13018025)(10201501046)(3002001)(6055026); SRVR:SN1PR0201MB1918; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0201MB1918; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1918; 4:UfODtOPt4I7LGppx/yUTZWz1qkht5P+lHXJ5bXZ813B8oTtpCiYSl4NlRXIM00C3Xd2u1U3a3Rh1beGVHZjHv2dRABUgPU4eibCkZf+fOrPSeV14gkMMeGUFrIgv8NNUUPQsx5xTUamVo3deNPOF6XGPFoc/bWJDmTTVDtFbEI5MCRqnUsTgLXuGLLA44atWGsA8du4zCwjtnUbnvJn1VetgzhIuXgvFxu5Rln5o+Q0HS1b+j6bxHsA4Z38tt8iWtS+4TWIz8M/Ghi2FwKK0n0sOPyOLt1luMTxc1fWPKBpp225+dAaNrZ1ASz3pS8I0PxpFjant1wkiXazpy2RDKEKqTojldgDIFaRRT7dRdgO41h7d5eqmlEzupjGZfGZqJlMI9Y3nAH5mIyEIKB3XfZb42L5eRX2gv/Hs7XKiQnxCxyb5JloeOBL6to8TcDqwyO9XUmiY/7vCZCESN/szcHrVy4g9JGhuLrXPJGBu7GYwm5MpSMNaZhxl+pWuFFwgplO2gopIWaRUFWlyzArpe+ui2FcDjRGFbVvodT1JYDj7wCLfDbuuqaTQ8cYrX9d6mpJGaDaeD41yfu4mcssQH5NoKdrfB2Nm655Ca3ecSko= X-Forefront-PRVS: 00997889E7 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjAyMDFNQjE5MTg7MjM6a3ZQUVgvRkJja1RTRU9iSFRBY1E2ajZt?= =?utf-8?B?cTlQblVUaG1yOXRWUVNWZExFVTFkcENFLzlzNXVjV09zbnl2UHNuVU5SQjNj?= =?utf-8?B?VitleklDNzVxaXZHNFBEQlIyY1BnV0NXaDNwWGg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qxIQUSMY2TWO49P0xLVb7GdksGlYs/VvNk8NqV94SBTMkpBX417BIUoLLnFaIkN+5KTpE+RMhX19f1FyGnSJ6SeFG8buk X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2016 21:52:31.7971 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0201MB1918 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Additionally, add a comment about the queuecommand() call from scsi_send_eh_cmnd(). Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Martin K. Petersen Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Doug Ledford Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 40 +++++++++++++++++++++++++++++++++++++++ drivers/scsi/scsi_transport_srp.c | 35 ++-------------------------------- include/scsi/scsi_host.h | 1 + 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ab5b06f..a5a1b5d 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2722,6 +2722,46 @@ void sdev_evt_send_simple(struct scsi_device *sdev, EXPORT_SYMBOL_GPL(sdev_evt_send_simple); /** + * scsi_request_fn_active() - number of kernel threads inside scsi_request_fn() + * @shost: SCSI host for which to count the number of scsi_request_fn() callers. + * + * To do: add support for scsi-mq in this function. + */ +static int scsi_request_fn_active(struct Scsi_Host *shost) +{ + struct scsi_device *sdev; + struct request_queue *q; + int request_fn_active = 0; + + shost_for_each_device(sdev, shost) { + q = sdev->request_queue; + + spin_lock_irq(q->queue_lock); + request_fn_active += q->request_fn_active; + spin_unlock_irq(q->queue_lock); + } + + return request_fn_active; +} + +/** + * scsi_wait_for_queuecommand() - wait for ongoing queuecommand() calls + * + * Wait until the ongoing shost->hostt->queuecommand() calls that are + * invoked from scsi_request_fn() have finished. + * + * To do: avoid that scsi_send_eh_cmnd() calls queuecommand() after + * scsi_internal_device_block() has blocked a SCSI device and remove and also + * remove the rport mutex lock and unlock calls from srp_queuecommand(). + */ +void scsi_wait_for_queuecommand(struct Scsi_Host *shost) +{ + while (scsi_request_fn_active(shost)) + msleep(20); +} +EXPORT_SYMBOL(scsi_wait_for_queuecommand); + +/** * scsi_device_quiesce - Block user issued commands. * @sdev: scsi device to quiesce. * diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index e3cd3ec..8b190dc 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -402,36 +401,6 @@ static void srp_reconnect_work(struct work_struct *work) } } -/** - * scsi_request_fn_active() - number of kernel threads inside scsi_request_fn() - * @shost: SCSI host for which to count the number of scsi_request_fn() callers. - * - * To do: add support for scsi-mq in this function. - */ -static int scsi_request_fn_active(struct Scsi_Host *shost) -{ - struct scsi_device *sdev; - struct request_queue *q; - int request_fn_active = 0; - - shost_for_each_device(sdev, shost) { - q = sdev->request_queue; - - spin_lock_irq(q->queue_lock); - request_fn_active += q->request_fn_active; - spin_unlock_irq(q->queue_lock); - } - - return request_fn_active; -} - -/* Wait until ongoing shost->hostt->queuecommand() calls have finished. */ -static void srp_wait_for_queuecommand(struct Scsi_Host *shost) -{ - while (scsi_request_fn_active(shost)) - msleep(20); -} - static void __rport_fail_io_fast(struct srp_rport *rport) { struct Scsi_Host *shost = rport_to_shost(rport); @@ -446,7 +415,7 @@ static void __rport_fail_io_fast(struct srp_rport *rport) /* Involve the LLD if possible to terminate all I/O on the rport. */ i = to_srp_internal(shost->transportt); if (i->f->terminate_rport_io) { - srp_wait_for_queuecommand(shost); + scsi_wait_for_queuecommand(shost); i->f->terminate_rport_io(rport); } } @@ -576,7 +545,7 @@ int srp_reconnect_rport(struct srp_rport *rport) if (res) goto out; scsi_target_block(&shost->shost_gendev); - srp_wait_for_queuecommand(shost); + scsi_wait_for_queuecommand(shost); res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; pr_debug("%s (state %d): transport.reconnect() returned %d\n", dev_name(&shost->shost_gendev), rport->state, res); diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 7e4cd53..0e2c361 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -789,6 +789,7 @@ extern void scsi_remove_host(struct Scsi_Host *); extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); extern void scsi_host_put(struct Scsi_Host *t); extern struct Scsi_Host *scsi_host_lookup(unsigned short); +extern void scsi_wait_for_queuecommand(struct Scsi_Host *shost); extern const char *scsi_host_state_name(enum scsi_host_state); extern void scsi_cmd_get_serial(struct Scsi_Host *, struct scsi_cmnd *);