From patchwork Tue Oct 18 21:50:25 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: 9383117 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 D1AE26086B for ; Tue, 18 Oct 2016 21:50:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C571C296C2 for ; Tue, 18 Oct 2016 21:50:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA36A29769; Tue, 18 Oct 2016 21:50:37 +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 3E8F8297E5 for ; Tue, 18 Oct 2016 21:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756014AbcJRVuf (ORCPT ); Tue, 18 Oct 2016 17:50:35 -0400 Received: from mail-cys01nam02on0062.outbound.protection.outlook.com ([104.47.37.62]:5767 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754138AbcJRVuc (ORCPT ); Tue, 18 Oct 2016 17:50:32 -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=KUgKM4d8e4fNw1hAiPb7nzHBFpDjTCyJ+VrZAJGYKQU=; b=rpYBNetKuZbLdNYdKxm/PRdAHbOXQAl5uVcSiL5OpteLZzykUsNQVEcK6jUVQbbhQyK7b8pFaAvy2YwAxZx659bkYDnTxGIUgwkCJ/yzo5HUXV6tQRfseM/pYFnv87Yq/hBZ+mLUkaupUOBJYP+97OAMHYXpXQ8AE+5U5pf53u8= Received: from DM5PR02CA0062.namprd02.prod.outlook.com (10.168.192.24) by BY2PR0201MB1910.namprd02.prod.outlook.com (10.163.75.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16; Tue, 18 Oct 2016 21:50:30 +0000 Received: from BN1BFFO11FD025.protection.gbl (2a01:111:f400:7c10::1:181) by DM5PR02CA0062.outlook.office365.com (2603:10b6:3:39::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16 via Frontend Transport; Tue, 18 Oct 2016 21:50:29 +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 BN1BFFO11FD025.mail.protection.outlook.com (10.58.144.88) 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:50:28 +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 EC.CD.26959.2A696085; Tue, 18 Oct 2016 14:39:46 -0700 (PDT) Received: from milsmgip12.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:50:25 -0700 X-AuditID: 0ac94369-ef8199800001694f-3f-580696a24880 Received: from exp-402881.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 4D.A3.03615.12996085; Tue, 18 Oct 2016 14:50:25 -0700 (PDT) Subject: [PATCH v3 04/11] blk-mq: Introduce blk_mq_quiesce_queue() 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: Date: Tue, 18 Oct 2016 14:50:25 -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+NgFlrPIsWRmVeSWpSXmKPExsXCddJ5ke6iaWwRBt8OaFn833OMzeLl+Q+s FitXH2WyWDUxz+Le0S9MFntvaVvMX/aU3eLZoV4Wi+7rO9gszn94xWSx/Pg/Jov23g5mi7aN XxkdeD0mNr9j91i85yWTx4NDm1k8Ni+p99h9s4HN4+PTWywe7/ddZfN4+3Inq8fnTXIBnFFc NimpOZllqUX6dglcGQtnvmQr6DatuHFwF0sD4yXtLkYODgkBE4kHt2W6GLk4hASWMknsWNrM AuHsYJTo3jGXqYuRE6xo9ft2JojEYkaJ9Uf6WEASwgJOEo9/fgUrEhGQlfi++zUbiC0kYCfx dv1OsEnMAntZJB5evsUKkmATMJL49n4mWDMvUFHD0y/sIDaLgKrEis9nwQaJCkRIbPo6B6pG UOLkzCcsIKdyCthLXD0QDmIyC2hKrN+lD1LBLCAvsf3tHGaQV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uR7fElfzs/VGrZik6oX3lhd2z0PsfuHfyf/eI9i1QLhRUYzLf4Hn6kosRSnJFoqMVcVJwI AF7t8XE6AgAA 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)(53416004)(4326007)(23676002)(83506001)(230700001)(19580405001)(19580395003)(2906002)(87936001)(50466002)(2270400002)(189998001)(65956001)(81156014)(65806001)(47776003)(81166006)(2950100002)(6916009)(8676002)(36756003)(31686004)(54356999)(64126003)(106466001)(33646002)(229853001)(97736004)(4001350100001)(77096005)(8936002)(305945005)(50986999)(76176999)(7416002)(31696002)(626004)(92566002)(69596002)(68736007)(86362001)(7846002)(110136003)(356003)(11100500001)(586003)(65826007)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB1910; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD025; 1:Z0qrqeBh54RX9is4hHI938anL4aWd4GomiLEptVJFYNIIcJAOk+ETmDb0nHoTt9x9YTxAqdt89W1TWk7v1bU5rImv+oFleXAy1MUcFve/nkGtNHjneNZFJPqc9Fokh/vrzpbrpgh7CMg259bEbh9gZ5bEhXj/xHBr6Gspf/ECJdoXiG1zzB2dsAfTN1B6OTrFVtBBHFSdA2TWl7G7ewQsWHdk2Utz1B0yB8JoltJ5r+RdNcWtsYN/r85B0SLe4j2afglcjTLVAiSf6ok0FK/UFAZ21Ch3HUbyxyTMZi3/wg/2gtVXGqs15dghHT3gb300gI0RjTXN8q1VGrbRseXtATaYRPDyTBH1yqYG4wqi0pERDgGVTl7s5Am6RtBJDokM92l4rS1YIoUovkP90S3ivSEV7Zbb60UI3321gXWlDug3VpVektP8gIBdKpvDJHYb8MB50uV2e9L0wkHkKxIpMTsJYNCDvJrwcZXgQmzXacci9TCaaTsSuj5QfVcajnk51vjPXfZUDBRMBcaZsgkZdecvJ6wTBqtSzWseszJFTpzcYEEZbD2/M3RpVtEn3Ac X-MS-Office365-Filtering-Correlation-Id: 3387f8e6-66fb-416c-879f-08d3f7a0c6e4 X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1910; 2:QnvIRpLM8tmKXuSXXspAPICg4FTPSwyxnvm5NHWBoy4+OC03Isdom6Cl1n61THnMBG/OKDVBuTyXgOWPAm2YNAzjk/iTo7zbcwXrft+52PFsN7r0d3P7CghW4aaX71oQzz7ktBtNw7NuXZ/cFE3pMy7a9eNHT3bWkeuplaB5imQFkmkazJxp/g01uIK37nfQOd2H5e+Fu5kJxRYTENwm/w==; 3:QYGVdyiB0iSoDUKUuKPy4963lSUbRnSm+Oqik603+nT+BMA+F9KDJg3rxttfsMctn1gGxAz0ePDi+mDZIyXeMTKRC+EcT9gvsPktr1hpgVD6MH24DZxt5Vy4lG8JuCyLjY+Za1q2FipIVVR5ucpGMeAylKHoE/mdelAps8fX7ghFzLfoOXTxqGaR0gsk+S1hMJbKeelmmmt7JQX0NWjxZiGNUFOq9n6r6p5eycJNgcXY/eI2igsiTsHBCkQmOiv3g6nVUlz6x6+fI5TBhlRxs9LFpCMrVqcF3D9SH4xHy3A= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BY2PR0201MB1910; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1910; 25:BTHQEbbf+qreKRBnPaaMDO0aL8cFXf0A7FphVP279cWRds9zdQcUDfTT1VwINjXYX2sh7Jy3rh7jv0/J+5Xi8QezSZilKY3Qr/5Y8mUxw7psgY90CBx/VrVhrQfoY9Pn7T34l7VbgFxUNyyDTm2JRXK2i1faNq0/GIC5x7TpXakVxeUgpgZz/fLhkUEndLlXXzvmCrYxzjZACi3/XuGO0N4zq8b7lduKj1mij2hXGboA0rls25Io/BkbXY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K4xJs+Qk55i0IgRz0IGe1ArS1156L7C3R/aNQ1o1r67V28WMt8dcVVZmjCVjYJACGUfbXzbru07niMcU4cimK1bgu2TDqCbr4zWdzIDQ55xHT57SLpyJN3JdxkeLTgUrBp2YnRt/xxHEZyRL/2Y1Pd7jSM2crbv54nW9sRa2Q67nCbw7TdfvTosCfIFx8zTsT5ABgpchIRa7XBlaylMMqZnTJaZiTCxJss6eZZg5ag1qYyBNFqdFXI6vn9S0xkhwqi/yV5pqYHmoMHyVkr2CD2nb X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13016025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY2PR0201MB1910; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0201MB1910; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1910; 4:5MwU3dp+jxO9Uk1ueUz+iX6J7TMbwUJwtHF65uJLL870riUtjlXI5cJ5pVkUkDbQcjFtIxmZ/Q6tz+PBq+rhqHdr1fv0vPEo8tWXpZwxwsHFmqIE26GOu4BxZXbe88h2h59aYRIipHtnut18rSEnesT5rws5KitJM7N7N3+qnAigpT6FOJiyS8XBzkQnq6sopLIeSDXRj0LBbVAS1hbpnN7CTp3lnHl3VdjozQDyzYYSDXDgzdYV7ezP5n58xhEM2eIkEa7o9dhu1hiNuhu7JyxHj1tU8Jny201ASEOgVRkEWshJAdUkU0g8CTAijy8aAYXjlyBmvh6x6lAWMKBMfmtxj4XtSwyFaWPe7rA1sfghiAIgrrYqbMOq3TRtV7nEJaMMuhm3BikNg9KdI3q763moaNd14fpZfra5plZ74O9/T6Wp0gqa6ahnm9M/uVsU7i8uK+DTJ9wELU5/SDFnEjMzBQQYkQcsavCAWYL/x8pOtXLQ5usfr/EPpWdYAuBH X-Forefront-PRVS: 00997889E7 X-Microsoft-Exchange-Diagnostics: =?ut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=?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1910; 6:/fEnaFUh3piJkcwjGf4EQELX3J/aqQSPySHJllq9gshxJkHmJa1/UAqmjnJdPurrHRLKBvsUc7eY5H0pfbGZQsCpTX7VgZkhI0Gs0wkcpV1z6Jr44QDuuwTU7pHS08EcO9qEsLvii3TVHJA1iwnB2Lslvw+ZSVgwl9t1ID/ZmGi8c4VtgVvrf92vQFdh1LdyVrVeLJZVfrhGYcfBou6DYFEXCs2Y74MX7KD9t1rkycN1plJrKdLrWItXZ7UJhv/jzpcUDliIo6EvPM5X6X7Un/PqU7IGdS0D8CLjYBQUVUAvuvU3ptLH8DfNPAiyB2EOwYqIRBn2Ir9KQGv4PCoveZM8K4CWY+vviSaSkBukrqE=; 5:/MEy01cGAwoTn4Lu9lyBgyetw0QdBu1mKYUILR1NIhTImCYC1PA47/Mvz7tBeuiJMZdlO0j1AjygsB3PAWI7sYIjTgfu91k/9oiCyvEY3djpTw1dc9hAnJnPXTEgtbPqG6mN+mEcGVtPkV9Gc3OSHQ==; 24:5seAViIwfDfG2ua28EOl4wxQJN7WZlZRZoY4ccdVNoKHOXAbvtD/vs4OPiwlEZ/s0OFgRZYVwHopCqPrNPk9un60G9IuPtSrWDSnj0YEZyQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1910; 7:0vECf3LuQIaakg05eD9sR+o6wL5guODGMIyuuvoGTAvgC7kst7zY/PiKl1LPgt4K4a7ng1rnm+VOaOVIva/AvWzydg7vk1mUrC3EH9ZGox2yNqKKiBG9TuJ8Ex5jli0KvnI4S6qKvApzlfc7SBnFad4VtVWW/IWodLbjIsphts5DXkgQQH7rOux9M2Rjx7yfX5wah5AP+PmRrdyanQc1J3+BkXLn3L0qs4LlYNp6qWCXSM/C86+PScSzbZStZ9OFt96qco6hx47Q4ox5GvO9lz6dPAQm76FgMgUFgYz/fsSUoByORCWUGFFBAANaWrecxLuoV1gWPholSpNgu/epNo6viZ54oLkJNCMCxeK5lwM=; 20:FpsxlMJQgjt8xK6hic67209jcRvI/l3vD1ejkXN7v5s/uGwd/iml8gsp9WagdPQwWRTP2reorwlrZp3WT5WoWM2YWJPSj3yzvTB2QyWFz4fEpGjW9To8oZSE/LNqOLMBvrovIl4noBaKw70aP6PpDeApx0OZlOgwocLFUxk6Y1I6LgjwyRlprLK6CPennbl9IFdb1mnq2AVLrD2VTRd/UkVrHTT5fmPY5wIy62N+85kvZXKgCy9AoeMm78VobitV X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2016 21:50:28.1209 (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: BY2PR0201MB1910 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP blk_mq_quiesce_queue() waits until ongoing .queue_rq() invocations have finished. This function does *not* wait until all outstanding requests have finished (this means invocation of request.end_io()). Signed-off-by: Bart Van Assche Cc: Ming Lei Cc: Hannes Reinecke Cc: Johannes Thumshirn --- block/blk-mq.c | 78 ++++++++++++++++++++++++++++++++++++++++++++------ include/linux/blk-mq.h | 3 ++ include/linux/blkdev.h | 1 + 3 files changed, 73 insertions(+), 9 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 4643fa8..d41ed92 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -115,6 +115,30 @@ void blk_mq_unfreeze_queue(struct request_queue *q) } EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue); +/** + * blk_mq_quiesce_queue() - wait until all ongoing queue_rq calls have finished + * + * Note: this function does not prevent that the struct request end_io() + * callback function is invoked. Additionally, it is not prevented that + * new queue_rq() calls occur unless the queue has been stopped first. + */ +void blk_mq_quiesce_queue(struct request_queue *q) +{ + struct blk_mq_hw_ctx *hctx; + unsigned int i; + bool rcu = false; + + queue_for_each_hw_ctx(q, hctx, i) { + if (hctx->flags & BLK_MQ_F_BLOCKING) + synchronize_srcu(&hctx->queue_rq_srcu); + else + rcu = true; + } + if (rcu) + synchronize_rcu(); +} +EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue); + void blk_mq_wake_waiters(struct request_queue *q) { struct blk_mq_hw_ctx *hctx; @@ -778,7 +802,7 @@ static inline unsigned int queued_to_index(unsigned int queued) * of IO. In particular, we'd like FIFO behaviour on handling existing * items on the hctx->dispatch list. Ignore that for now. */ -static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) +static void blk_mq_process_rq_list(struct blk_mq_hw_ctx *hctx) { struct request_queue *q = hctx->queue; struct request *rq; @@ -790,9 +814,6 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) if (unlikely(blk_mq_hctx_stopped(hctx))) return; - WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) && - cpu_online(hctx->next_cpu)); - hctx->run++; /* @@ -883,6 +904,24 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) } } +static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) +{ + int srcu_idx; + + WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) && + cpu_online(hctx->next_cpu)); + + if (!(hctx->flags & BLK_MQ_F_BLOCKING)) { + rcu_read_lock(); + blk_mq_process_rq_list(hctx); + rcu_read_unlock(); + } else { + srcu_idx = srcu_read_lock(&hctx->queue_rq_srcu); + blk_mq_process_rq_list(hctx); + srcu_read_unlock(&hctx->queue_rq_srcu, srcu_idx); + } +} + /* * It'd be great if the workqueue API had a way to pass * in a mask and had some smarts for more clever placement. @@ -1278,6 +1317,14 @@ static int blk_mq_direct_issue_request(struct request *rq, blk_qc_t *cookie) return -1; } +static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, + struct request *rq, blk_qc_t *cookie) +{ + if (blk_mq_hctx_stopped(hctx) || + blk_mq_direct_issue_request(rq, cookie) != 0) + blk_mq_insert_request(rq, false, true, true); +} + /* * Multiple hardware queue variant. This will not use per-process plugs, * but will attempt to bypass the hctx queueing if we can go straight to @@ -1289,7 +1336,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) const int is_flush_fua = bio->bi_opf & (REQ_PREFLUSH | REQ_FUA); struct blk_map_ctx data; struct request *rq; - unsigned int request_count = 0; + unsigned int request_count = 0, srcu_idx; struct blk_plug *plug; struct request *same_queue_rq = NULL; blk_qc_t cookie; @@ -1332,7 +1379,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) blk_mq_bio_to_request(rq, bio); /* - * We do limited pluging. If the bio can be merged, do that. + * We do limited plugging. If the bio can be merged, do that. * Otherwise the existing request in the plug list will be * issued. So the plug list will have one request at most */ @@ -1352,9 +1399,16 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) blk_mq_put_ctx(data.ctx); if (!old_rq) goto done; - if (blk_mq_hctx_stopped(data.hctx) || - blk_mq_direct_issue_request(old_rq, &cookie) != 0) - blk_mq_insert_request(old_rq, false, true, true); + + if (!(data.hctx->flags & BLK_MQ_F_BLOCKING)) { + rcu_read_lock(); + blk_mq_try_issue_directly(data.hctx, old_rq, &cookie); + rcu_read_unlock(); + } else { + srcu_idx = srcu_read_lock(&data.hctx->queue_rq_srcu); + blk_mq_try_issue_directly(data.hctx, old_rq, &cookie); + srcu_read_unlock(&data.hctx->queue_rq_srcu, srcu_idx); + } goto done; } @@ -1633,6 +1687,9 @@ static void blk_mq_exit_hctx(struct request_queue *q, if (set->ops->exit_hctx) set->ops->exit_hctx(hctx, hctx_idx); + if (hctx->flags & BLK_MQ_F_BLOCKING) + cleanup_srcu_struct(&hctx->queue_rq_srcu); + blk_mq_remove_cpuhp(hctx); blk_free_flush_queue(hctx->fq); sbitmap_free(&hctx->ctx_map); @@ -1713,6 +1770,9 @@ static int blk_mq_init_hctx(struct request_queue *q, flush_start_tag + hctx_idx, node)) goto free_fq; + if (hctx->flags & BLK_MQ_F_BLOCKING) + init_srcu_struct(&hctx->queue_rq_srcu); + return 0; free_fq: diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 523376a..02c3918 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -3,6 +3,7 @@ #include #include +#include struct blk_mq_tags; struct blk_flush_queue; @@ -35,6 +36,8 @@ struct blk_mq_hw_ctx { struct blk_mq_tags *tags; + struct srcu_struct queue_rq_srcu; + unsigned long queued; unsigned long run; #define BLK_MQ_MAX_DISPATCH_ORDER 7 diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c47c358..8259d87 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -824,6 +824,7 @@ extern void __blk_run_queue(struct request_queue *q); extern void __blk_run_queue_uncond(struct request_queue *q); extern void blk_run_queue(struct request_queue *); extern void blk_run_queue_async(struct request_queue *q); +extern void blk_mq_quiesce_queue(struct request_queue *q); extern int blk_rq_map_user(struct request_queue *, struct request *, struct rq_map_data *, void __user *, unsigned long, gfp_t);