From patchwork Wed Oct 26 22:53:08 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: 9398581 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 41F5060231 for ; Wed, 26 Oct 2016 22:53:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A4A429E21 for ; Wed, 26 Oct 2016 22:53:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F15C929E28; Wed, 26 Oct 2016 22:53:21 +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=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 3370929E21 for ; Wed, 26 Oct 2016 22:53:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933841AbcJZWxT (ORCPT ); Wed, 26 Oct 2016 18:53:19 -0400 Received: from mail-dm3nam03on0073.outbound.protection.outlook.com ([104.47.41.73]:61383 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932584AbcJZWxR (ORCPT ); Wed, 26 Oct 2016 18:53:17 -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=1CbSVajOqm0HHilDHj+2JZr0Q3cmAh0wKh6U/hAA2Ok=; b=jrcyJ7bKrOxgNI52x91ng2y1Ce8wWH1Jr4ErdpwGU8UUNwwslVL8NL4rNGyAO8qCE514JCPkinojJMbK5WX6tVzfhgbd5OKMWDpZEWhAsiJpPEOUrOo4mtR4cA0FD82LYAKZFsVYJaKOX6Dp5sKKcZPDV047orqDCyYJuWf6p/4= Received: from CY1PR0201CA0019.namprd02.prod.outlook.com (10.163.30.157) by DM2PR02MB269.namprd02.prod.outlook.com (10.141.55.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Wed, 26 Oct 2016 22:53:14 +0000 Received: from BY2FFO11FD012.protection.gbl (2a01:111:f400:7c0c::117) by CY1PR0201CA0019.outlook.office365.com (2a01:111:e400:58b9::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12 via Frontend Transport; Wed, 26 Oct 2016 22:53:12 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 BY2FFO11FD012.mail.protection.outlook.com (10.1.14.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.5 via Frontend Transport; Wed, 26 Oct 2016 22:53:12 +0000 Received: from MILHUBIP03.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 E1.D2.26959.54131185; Wed, 26 Oct 2016 15:42:13 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.9.6) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Wed, 26 Oct 2016 15:53:11 -0700 X-AuditID: 0ac94369-babff7000001694f-65-58113145b093 Received: from exp-402881.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id E2.FD.02564.5D331185; Wed, 26 Oct 2016 15:53:11 -0700 (PDT) Subject: [PATCH 05/12] 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 Lei , 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: <5143c240-39af-9fe2-d3e6-ed69f9c20531@sandisk.com> Date: Wed, 26 Oct 2016 15:53:08 -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+NgFlrPIsWRmVeSWpSXmKPExsXCddJ5ka6roWCEwcotIhb/9xxjs3h5/gOr xcrVR5ksVk3Ms7h39AuTxd5b2hbzlz1lt3h2qJfFovv6DjaL8x9eMVksP/6PyaJt41dGi/c/ rrM78HpMbH7H7rFz1l12j8V7XjJ5PDi0mcVj85J6j903G9g8Pj69xeLxft9VNo/Pm+QCOKO4 bFJSczLLUov07RK4MpovbWcquG9R8fz5ObYGxi16XYwcHBICJhIP2+u6GDk5hASWMkk8P8TT xcgFZG9jlJj3fxkbSAKkZmbXOlaIxGJGifOz9jOCJIQF7CXu393FDGKLCMhKfN/9mg1ikp3E zzPr2UEamAX2sEj8e7CUBSTBJmAk8e39TDCbF6jo4KftYA0sAqoSX55dBBsqKhAhsenrHKga QYmTM5+A2ZxAy9Z8nc4Kcj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pWKmo6mM0 Z9HNu6uUqh+/SKye89M95RlTKZ/M9vUrOR6XPTghsvnlNPNdKmqc3UosxRmJhlrMRcWJAHa1 thI7AgAA 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)(189002)(199003)(23676002)(2950100002)(6666003)(6916009)(110136003)(2906002)(4001350100001)(189998001)(69596002)(626004)(65826007)(5660300001)(81166006)(81156014)(8676002)(586003)(19580405001)(19580395003)(4326007)(230700001)(36756003)(97736004)(8936002)(83506001)(87936001)(33646002)(106466001)(2270400002)(7846002)(53416004)(305945005)(356003)(68736007)(229853001)(31686004)(50466002)(92566002)(47776003)(64126003)(65806001)(65956001)(86362001)(50986999)(7416002)(11100500001)(54356999)(77096005)(76176999)(31696002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR02MB269; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD012; 1:WKlayaqW8au+aJ1ZUP2SxLcRhu13JguSEiwW03zE9tZHuVCFkxD0cWHsMLsnwqd95e/0ZB+XA3MxRsgbZ2KmbRYCTCofltFIVp7XFmVYDkE/KXAiPT9RbCMH9I92sFKwQgPM44yRg5x6dQniPtWseMpz+FTDx4j/jk6FfhEBlITxUg/tjQQDf/WzkyR2RO1InK+I/L8lqkW+vfgBF3fSO/CBwpq/YlN0pBuBPErHpmIsMJF5vWiWhf0zZakiS/yp+HMP61uobrZTzFE4LsY4HZLxBai58dSFK1nEneO5dIEBvqxZNWqkagXCdqAN/7b3eEFqcoiA1AB7vkil1fhDld2xMx99zJ0FfQqCB9jIVdgpB7k5k0CFaMF9o7eS0eEcybKDgBo8VmW4QbWkbQl1EPsS70fOGUmeDpVK9y5DZfZJUFdsnieaV/y8GGc6pfDSttzk/GamUK8UEiC5++FMnuaXJ+0Dh0wznQkej5XMO6ebXbATaly/dJlL/fCW/SCR9pU/Y18f54F58s9qCozar9YCeVIIm97uSu4oa7m6/G5C2qSI8MvBp+D0PI15BcGU X-MS-Office365-Filtering-Correlation-Id: 411bd55d-8c79-4360-6876-08d3fdf2dd19 X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB269; 2:1ibKk3elJOl67guLvHRc3qgW34XUqkCfo9LHQcJxSxHN36B24Suz63m+0WlWKAzdTGGqxVsFjuDb46TXij3IMlrYKTEsXZCmDKaxVC/B5OnJibhdkWVVqiimT67gaNQ/Vzkmq0k9knKwmvdokx/c6eyjXIPLhnIi2S2OiccTOghfp9nvrCHqb+467ctrtya/vnkhe0mLyJCwD/tgV7D2Hg==; 3:BT7DEZEK+8OnFlzsEaWx3ErlAP7BmOpqw1NmrgMCQrtoysnTrmTr344ZVzNwZAy+4jBgd5dhjKHhKPLzzjA7bGSZ2b8hW1hV/4x1+culr8pgK9npl+83EJBKI85wJ5TT2WGPY7CQXdlliKWo0iklZf8OKSUfq+fiFGZRJih/uYQ2eZi8tUZWoB4t/tSf+0uzokZVyVb1X2wLmDOMwVa23vb04/HXfR+YiA2pclekN6PbPsfh3iG1533xtHiEtXcEK9tLk4306lhbR442BPLjsO5PKj9xYeeNDjb+ozbKj/0=; 25:pTD88loc6NYuAi4zGL6nKYLw+Omh7BsiyBPwCRFDIkkVQN5paq5xpswvvgEzAwy5F18SXnfNzuBUE7EZFE8SNdvfENaL42BEDXKEDv/sohTQ/F8ZhvIiLhrlWnCmPlhn51KTTlxThifQy7h+t9qQkhII7EO5lDMeuO2VmKEZATQUZ4btE+LGWUPZz5I7aZ/YLNW0uS1fiVXAHJewzpx22vWNzCATUhdPlfiGLE2GRmlZZpaO8EDkIHbAZrG2YWawSVv65RIdBXfFZuDj+KM5rWCyTUqWH6byfGqtlis0v4pYq+IZC0vk94sl/wvOTJQLRtTDPOYAGKgEEldyIbhlRVfRqARXHx/rbNjRmQjoxI+owIaqFia3KKPcL7DMrvPQfTN86gk5hYIbZf622Y1YtEwR/ymNMCaj chhyGtERge8mccmTYKA7IfsFCX4bJY/u X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:DM2PR02MB269; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB269; 31:pipMqJdJl2K8bHU2onppqDSWPGyFtyxPPFy1g4vdaZ3ISzHYMiBv0PWBKRfC4QFRDd7qaUGlhwVflwN/nF+qvEliYeuA3W3LuTN34HfTJYtl5RqiKFtNVmUTCObS32Fv3FrwcLalHLHOFDPa1TGl3Bxs99zuMeSqQmPWmgB03DuhAmk2HWzT3hTwHSLkYyv3SlIxvCniGcKVMILrsjtaJxyQ1Vq9K+vdz75jRNYn9m5H+btrcOWjzaIpzxhK0X2TFEQIicYKNxfZhvBeT5l0dg==; 20:5aAjC84LQgg32FODKrkoAV2SkeP6gFk3Dio8dwXLiODBwO9SKNrQNlUgDKdObImK0ibkgEwgJsgirJfDQ0EXRlFQCdvkg/HHN3/OjPbhDfwCKYM7WMsMvYBoFtCwIhqftll1MRgwhyA/dM2pi1PC4WXtCsLCQuzXy2jtWGvo8/LnvihMvEYwfnxkbm6Sk96OVWj5UfGeHQOr9Fbp6HRddJOU2ptFYhVRfnPBERloW8n2PSTmU6ThOwcrOIxn8/J1QjC4Go6Cp+fwOB1GPC2y/TC8COwq9nAYQT3d6iShro+AR/uDmhxmTkw+TKYpAVqsvW0Ht4oXOxNMq4n9pJybgoW5spqSoRtXDrx/rZDP+cEkanttldcgKeAYRVqjC4pPWEgQJl7qtc8Jqrc39Yimyo/GvVKT+pEEQNja7kyl1qAbRSdclXkYTZthWB8ELahusCrBseebV/Y0gOtU16/inxHMOFjXQILdjP2a1Iq/7Qf+Fd5FZ2diIQd+2WGKTAzv 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:DM2PR02MB269; BCL:0; PCL:0; RULEID:; SRVR:DM2PR02MB269; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB269; 4:ngvci75T2+273DeNFQFAvbVJTi6eGqVIJLyQoTMEVJojB2sXW33ClsWb8prsTy2urYoeIH4OXqTDzF7sPAq0O7ntgZI8Yzwey4aGb+sWwJVlp1d/SptR5ygaXXQ7zGvsSOhtpCSGLard+g9RrZnRd0eKaQ/owi7nD4WuOsqoGY4V569/N4FnUEKlwUDrhIY2+0rZxgJo4Q8Fmntmh83uvude0iZB875so7dQojQZLGyVSy1x7yhMKZ1JbCmEbZkqwyPhSwePEMvcgMWrQ6EvR81NJvMTT2NhMzWCVd1TBDYg3SMdsuTIbkrU6Fc5s4vgqHeeuR04TU9mn6ZS+bRI/KM0fhlHU0Zl2bjZRifoWcoT34Ls/SwZPAm/VsB8SeDdahbMKM+af9Aowq0CKt9Kri/IbWM1gQIJTDF/UbCmIlPs6lTca0ZjUU0KqM64MBfmeV0aCsbK+5Ht7YxRiT9nrcYbh1qsUSHTRFYi/sj8yRGUaUwqVuKd1eyIpjE3idON X-Forefront-PRVS: 0107098B6C X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTJQUjAyTUIyNjk7MjM6OHZaaHdUQ2psYXJBSUh1QnI2WDVUbXY0S0hY?= =?utf-8?B?ODRqME10YmhJQzM0WmgxMFAydzRxWHlaQWtJMVg5V2hDZmJUakhsOGFrUHJ3?= =?utf-8?B?QzBiS0xWZjlVa3BPV3VKeHFNaWgvU3ZsU3JRQnc2Z0FZWC82RVRVaHkxNG9Y?= =?utf-8?B?SjNER0VyR21qOFpxclA0aEFDSjBoVGZBcSt2YlJqUDE1Q2xrRmZxYkhKcWw0?= =?utf-8?B?YURoQSt4NkxCN21XZHBmMkQxR0hiSS92L2tWODIreEVmZi9MTXA3NDNWMzJH?= =?utf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nwntx5sAhIdT7U90pyL/48Ee1p5AqX7HjiozQ/Uua0=; 5:JX7dLGRDGffklN9XBvrBDEVKR7sS7U8j4//sEJXCQW7D17afUsnEEeUkYBB4RkI16q0YQ/t23IAII81vJVyj2y5teU+7n/KJgCnmMeLb1xEA9l5FXIygmzSqO3hx7w9kjWyK1C1N2Zo/DmpA1yfgtQ==; 24:N5B6SHZVD/IESi2aEAhbceVhIxG6CMzx3U070YzV5zC0VYgsqhmadkVIPYB4hbE5aKgZdtBYWqCzV2TAOc/hSnNnlI6/QqxQ2ZUC6D2J2SY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB269; 7:SA5yaC3c11ipSL9cme8QcW+y2qRxrIBSE9SmdlbUvdrmA6f6BIU/crUTJwySsjyTdmgZvPGS6KENQ/M8XZNaN4B2c3c5cM1+fhVm8xwn0Cwzc5Mpi9YO1PwNHcRznHPl+cChpUB3tdS8+mN4neDCJPRT9V5WXinY5UdUJlFxW5/8cXIpRz0M2ZBfQCOUJI8+bu7o4XrkzHSZSEO5v5WpD8UqaxG10oTWf5nFHdrViH73J9toY6BFVSgyuLZKXRe13jsKwpqfIMu8LhuDoHGMo/u0qfmamHesXh0Pkxrvj+NxOCKEJ5iCPu14nmMUMipEszg+Q927nLDANg7A9f3Ji/rJbLWLOwTDpvOYAcHE0ks=; 20:JAvNqwx2uJNZxXTGvf9ip3ZFNNHcoai4OBpiC22In5ZD2uSd4q2TVoYKAVW0XlhsLinQwsqGInUi5HtNRQp/M/hgdwtiPL/mca/5GlvyEp660vvRIniy40CC5kURUIyFuZVQde2w67S9daqpAebTdcKIlXhNZ5HkxHCmLi7jCAETnL81RE1qc3HIF91l3AyLWRFoClR9gT2NN4lsSI8TfkJTLAqBDkH7udDxFcM8vh2HJIHFLxLRiAblGi70dGxT X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2016 22:53:12.1466 (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: DM2PR02MB269 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 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()). The algorithm used by blk_mq_quiesce_queue() is as follows: * Hold either an RCU read lock or an SRCU read lock around .queue_rq() calls. The former is used if .queue_rq() does not block and the latter if .queue_rq() may block. * blk_mq_quiesce_queue() calls synchronize_srcu() or synchronize_rcu() to wait for .queue_rq() invocations that started before blk_mq_quiesce_queue() was called. * The blk_mq_hctx_stopped() calls that control whether or not .queue_rq() will be called are called with the (S)RCU read lock held. This is necessary to avoid race conditions against the "blk_mq_stop_hw_queues(q); blk_mq_quiesce_queue(q);" sequence from another thread. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: Johannes Thumshirn Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Reviewed-by: Ming Lei --- block/Kconfig | 1 + block/blk-mq.c | 69 +++++++++++++++++++++++++++++++++++++++++++++----- include/linux/blk-mq.h | 3 +++ include/linux/blkdev.h | 1 + 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/block/Kconfig b/block/Kconfig index 1d4d624..0562ef9 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -5,6 +5,7 @@ menuconfig BLOCK bool "Enable the block layer" if EXPERT default y select SBITMAP + select SRCU help Provide block layer support for the kernel. diff --git a/block/blk-mq.c b/block/blk-mq.c index 0cf21c2..4945437 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -115,6 +115,31 @@ 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 + * @q: request queue. + * + * 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 +803,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 +815,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 +905,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. @@ -1293,7 +1333,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; @@ -1336,7 +1376,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 */ @@ -1356,7 +1396,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; - blk_mq_try_issue_directly(data.hctx, old_rq, &cookie); + + 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; } @@ -1635,6 +1684,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); @@ -1715,6 +1767,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 aa93000..61be48b 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);