From patchwork Mon Jun 18 18:22:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 10472493 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 A8D996032A for ; Mon, 18 Jun 2018 18:22:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C64328BC8 for ; Mon, 18 Jun 2018 18:22:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90BB828BCE; Mon, 18 Jun 2018 18:22:51 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 0E9F028BC8 for ; Mon, 18 Jun 2018 18:22:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935819AbeFRSWu (ORCPT ); Mon, 18 Jun 2018 14:22:50 -0400 Received: from mail-eopbgr720040.outbound.protection.outlook.com ([40.107.72.40]:46452 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935726AbeFRSWt (ORCPT ); Mon, 18 Jun 2018 14:22:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mscc365.onmicrosoft.com; s=selector1-microsemi-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZQ0bsLAlDTXlKj0+ZfM6SC5Axa33P7avUrZfmiTF6CI=; b=Zpi+8dw6o1IBlXi4aGeXL/v6FC/yp4GPmbNpH1fUGubdI8k6z7Un37SPumEql58pHvXv3FVNaX9g15zjUbkilZNhRTei85f8t/0B2dfIvJUnPSGf7Ez2H/9Le+Mdoh4kl+v3ClCbRydmY60bvVfSe+LMUSHEZAL/LezyP+8pubs= Received: from BN6PR02CA0040.namprd02.prod.outlook.com (2603:10b6:404:5f::26) by SN1PR02MB2142.namprd02.prod.outlook.com (2a01:111:e400:7a48::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Mon, 18 Jun 2018 18:22:47 +0000 Received: from BL2FFO11FD009.protection.gbl (2a01:111:f400:7c09::179) by BN6PR02CA0040.outlook.office365.com (2603:10b6:404:5f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.863.17 via Frontend Transport; Mon, 18 Jun 2018 18:22:47 +0000 Authentication-Results: spf=pass (sender IP is 208.19.99.222) smtp.mailfrom=microsemi.com; hpe.com; dkim=none (message not signed) header.d=none;hpe.com; dmarc=bestguesspass action=none header.from=microsemi.com; Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.99.222 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.99.222; helo=AUSMBX2.microsemi.net; Received: from AUSMBX2.microsemi.net (208.19.99.222) by BL2FFO11FD009.mail.protection.outlook.com (10.173.161.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.820.5 via Frontend Transport; Mon, 18 Jun 2018 18:22:46 +0000 Received: from AUSMBX1.microsemi.net (10.201.34.31) by AUSMBX2.microsemi.net (10.201.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 18 Jun 2018 13:22:42 -0500 Received: from [127.0.1.1] (10.238.32.34) by ausmbx1.microsemi.net (10.201.34.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 18 Jun 2018 13:22:42 -0500 Subject: [PATCH 1/5] smartpqi: improve handling for sync requests From: Don Brace To: , , , , , , , , , , CC: Date: Mon, 18 Jun 2018 13:22:42 -0500 Message-ID: <152934616220.16668.7195546617517272681.stgit@brunhilda> In-Reply-To: <152934612702.16668.1224961030482066219.stgit@brunhilda> References: <152934612702.16668.1224961030482066219.stgit@brunhilda> User-Agent: StGit/0.18-56-g3329 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.99.222; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(7916004)(39860400002)(396003)(346002)(376002)(39380400002)(2980300002)(438002)(189003)(199004)(446003)(2201001)(50466002)(296002)(316002)(476003)(86362001)(69596002)(336012)(305945005)(58126008)(5660300001)(9686003)(186003)(44832011)(11346002)(486006)(53936002)(126002)(16576012)(68736007)(478600001)(97736004)(33716001)(81166006)(81156014)(33896004)(106002)(2906002)(8676002)(103116003)(59450400001)(356003)(77096007)(26005)(230700001)(47776003)(110136005)(23676004)(2486003)(76176011)(106466001)(8936002)(4326008)(921003)(2101003)(1121003)(83996005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR02MB2142; H:AUSMBX2.microsemi.net; FPR:; SPF:Pass; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD009; 1:HHsl+R+XH+4TMzTGDUxfz9BC76y4dBbxPDgL+zOpbxPBAereexrUGuQYSaM2iNkOp1uiUW3A0T5HrNg/TLCxQJQLTZOQWByX0lNFSROL4C8phZjMDYx3alVhw09xAvfC X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 938012f7-6555-474e-1b21-08d5d5487dee X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(4608076)(2017052603328)(7153060); SRVR:SN1PR02MB2142; X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB2142; 3:cVlAHC2Vzx4z9krmonjX/016v2KA7Exexqeqxjwolo0DtHjSZl8JIDhN5zx8OdYUcyckGpYeRDA9P+x5M/Owmjw8uPnyIZFaHb+0gfkGRpoBJT44qzJ/Nmn9vbbOcFs9UKrwBwtfxuPJieJjGT3AytEWzLv65u3DTdsxZxUBPUb5tJbVIz2aIVHqWBEYAC67iWgVALFaOrDPDlcPyU0LBbMO4Cqcr32dURp7cKWUSF0KkOcJsxcblrruzSdH8fAYgQHkv4JozhZtfjDu8EDcUj2rewE7S2WwB3o27YvBH/EFq1CSfvU2ZmdRQsoWu+QySbUfDEOM/C/wztGnsQu3KuFboLicWRtZVnRQk5SJHF8=; 25:0Dr3N7JiwnGvmGwPEe5RRzBoYyxLmapKqNA2WT68sIE3i7BpunnjTXKOfKtd/z9Ucsxjov6I8kiMbJVBsrOCUeJgdZeyD0Di89AL1LXw52bVSiADLJyCPja/7FoTRKpyfH4SUdbXX3VBmfYu+dOJwDk7nfGye6qDkZ85+eO9qMhiXY0ULSQboYIREMieMwP9IfaUmpOH/Bee0TJKYMB96dQbQ/NS8e4+fHxePi8SYto+ZZ0nZAmuvyUA6dwYMO4reViVZZIwHSS34mjpllFOLdnQvOTK8zmsISigVpwz51xVtuh4Jkgn/KmiSfIzGlhNAICfAmIitzBgw0fmG11d2w== X-MS-TrafficTypeDiagnostic: SN1PR02MB2142: X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB2142; 31:f8vi4Hx+acIwLK0uhNzJZMsIIuybMyjR3HklDh4NpA3XBkCo1qyPuA4BuX9+ttFCK/e7QMPo74fCnQQ1OKB628tmomLDoAFIcBIlLfOzfjS/oTePiFPS8t0OKAKEXB3AvEsfbq+KNvjcZd8qKOKABRdKJsRFoe6GVToSrcGC6VwlVlXjAnYNars3U4Ivf43ivc6IzB0dhReczJB4egBRevr534gWX8O0U4g8h7xqqBM=; 20:qM+M4cv57/GXlDVNuBdZ7UMccEtU49eFHnsjPnP5OShOlas70SZ7jJLDkia/kmbAyGFg1K2aFyaDeQbXXzsuYYxMnBDgBQXLw86X1LPnMGu+m69eW9LXpKunvh4seJ6ELnkdPz9RR+8OkHZtuiLeD0vupCDB74t3tvfMpWkt51ZzlIP4dkB+b9MXFRYRWp1u3J+JelJf407cpLWiY85VILxyOn2cAJpvSb5ctW6pn/55lw7UCilSBB6ml8G5yQBp5pFZemw+orwy03Cf0ByD2Asi/7I+m2OAtSEUIIogcMwoFyH8JaTgHUULbFDl6GKeAxqH9Nc/vLKsaFMmhgPq0OVMf7WsYjJAfBfRgVpYGbwsdbk0Q7LLW0Sy9E3R0MUnNrRYdWosdoqPVMLdaR1TD9R6ftd1JVnt6mtF0Z8UtdQoQYs2aoENY1GuV6gYsDl/J+GWPNmSaahfvwGYUx9X7X9MPIuboQVjtvUlQVsOQywrXlBRTfZIwx47i07+xUSS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93004095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201703031522075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:SN1PR02MB2142; BCL:0; PCL:0; RULEID:; SRVR:SN1PR02MB2142; X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB2142; 4:NLJHmC7h9K0GQ7PNLx+5X8JT/Z0wBhOY16WQNjftoh+rlItkT6kXe0MHBZstyQjU9M6D3vLOogTQQIQPXV8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mvy8rRd1xcIdut40VYQ/XdbtQgpgWa23bMlYi735kkXbQ+P4tbSoLrP5FwVmdPrcjcun9PLoawLhXNhlS+9kFMw==; 5:qqW6G0tvxJiNOmyLkv+/OTQTnorY7iQbIxNI/pavEWw42XfIp9qNxxzRFQgGcGnMv5Wp8FoxIfHZz5KpLh98E3NcXV1PaSZsYtQhxOZbsBSpO0soanQYLxSzfS9cWAThJauFyv7elH0pOKpQtZR3sKte/tumTJYcQAJU/ZhNHmg=; 24:08V4Ca9ptwPaj6iQg/cFjl12UWBumdn8swpH5gt8f88Lc89ucIhuK8dm2T3ghyEr+7/yTjeMfMxNwMAJvngRoc0F1AMltpPfgeyWl0Yn7wM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB2142; 7:rrBp6Nv4jjXPWHqt6j6jURL0/uDZAJNmXnigo6JNyHdzPacLBcwYyADK3pojCbXUyxLKpRNsO9wvUUj6gU6mOxjEKk2M9S4z1AY1vvV37fzia5BGRTmMgUhTR+OcZKIEqUKBii7EY7vIS64vgWmGT+KS3jSJc8kKtyXc6vJSDi5dSB9lOfpITAHFDm7N05U4xo3EsxkoHaf3Z27yR6UcS3qkiEG3TWCMj1hkqcVzg9y7XRfVNoTKrCz31CCzGnv9 X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2018 18:22:46.7883 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 938012f7-6555-474e-1b21-08d5d5487dee X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad; Ip=[208.19.99.222]; Helo=[AUSMBX2.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR02MB2142 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kevin Barnett - decrement the active thread count after the synchronous request was submitted to the controller but before the driver blocks to wait for the request to complete. Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 55 ++++++++++++++------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index b78d20b74ed8..4036f65cbb72 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -3621,43 +3621,16 @@ static void pqi_raid_synchronous_complete(struct pqi_io_request *io_request, complete(waiting); } -static int pqi_submit_raid_request_synchronous_with_io_request( - struct pqi_ctrl_info *ctrl_info, struct pqi_io_request *io_request, - unsigned long timeout_msecs) -{ - int rc = 0; - DECLARE_COMPLETION_ONSTACK(wait); - - io_request->io_complete_callback = pqi_raid_synchronous_complete; - io_request->context = &wait; - - pqi_start_io(ctrl_info, - &ctrl_info->queue_groups[PQI_DEFAULT_QUEUE_GROUP], RAID_PATH, - io_request); - - if (timeout_msecs == NO_TIMEOUT) { - pqi_wait_for_completion_io(ctrl_info, &wait); - } else { - if (!wait_for_completion_io_timeout(&wait, - msecs_to_jiffies(timeout_msecs))) { - dev_warn(&ctrl_info->pci_dev->dev, - "command timed out\n"); - rc = -ETIMEDOUT; - } - } - - return rc; -} - static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info, struct pqi_iu_header *request, unsigned int flags, struct pqi_raid_error_info *error_info, unsigned long timeout_msecs) { - int rc; + int rc = 0; struct pqi_io_request *io_request; unsigned long start_jiffies; unsigned long msecs_blocked; size_t iu_length; + DECLARE_COMPLETION_ONSTACK(wait); /* * Note that specifying PQI_SYNC_FLAGS_INTERRUPTABLE and a timeout value @@ -3686,11 +3659,13 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info, pqi_ctrl_busy(ctrl_info); timeout_msecs = pqi_wait_if_ctrl_blocked(ctrl_info, timeout_msecs); if (timeout_msecs == 0) { + pqi_ctrl_unbusy(ctrl_info); rc = -ETIMEDOUT; goto out; } if (pqi_ctrl_offline(ctrl_info)) { + pqi_ctrl_unbusy(ctrl_info); rc = -ENXIO; goto out; } @@ -3708,8 +3683,25 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info, PQI_REQUEST_HEADER_LENGTH; memcpy(io_request->iu, request, iu_length); - rc = pqi_submit_raid_request_synchronous_with_io_request(ctrl_info, - io_request, timeout_msecs); + io_request->io_complete_callback = pqi_raid_synchronous_complete; + io_request->context = &wait; + + pqi_start_io(ctrl_info, + &ctrl_info->queue_groups[PQI_DEFAULT_QUEUE_GROUP], RAID_PATH, + io_request); + + pqi_ctrl_unbusy(ctrl_info); + + if (timeout_msecs == NO_TIMEOUT) { + pqi_wait_for_completion_io(ctrl_info, &wait); + } else { + if (!wait_for_completion_io_timeout(&wait, + msecs_to_jiffies(timeout_msecs))) { + dev_warn(&ctrl_info->pci_dev->dev, + "command timed out\n"); + rc = -ETIMEDOUT; + } + } if (error_info) { if (io_request->error_info) @@ -3736,7 +3728,6 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info, pqi_free_io_request(io_request); out: - pqi_ctrl_unbusy(ctrl_info); up(&ctrl_info->sync_request_sem); return rc;