From patchwork Thu Aug 9 19:41:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10561871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3CEBC13BB for ; Thu, 9 Aug 2018 19:42:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CE7A2B97D for ; Thu, 9 Aug 2018 19:42:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20E732B982; Thu, 9 Aug 2018 19:42:19 +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 A4F7B2B97D for ; Thu, 9 Aug 2018 19:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727139AbeHIWIf (ORCPT ); Thu, 9 Aug 2018 18:08:35 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:1352 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727123AbeHIWIf (ORCPT ); Thu, 9 Aug 2018 18:08:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1533843737; x=1565379737; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=jAomS7kEcoVvjk0cGPw7MTND4ebQT+wlPNiLqXeVgrw=; b=qWhh6PL3bOF7Bg5juHSnbWAQcfw4iUZE0I1JJA900pVrxH5GZZ+sm+3l XYKEBtJfHnUN7b/YEEvYs965PoJoziX/R0x2L8A+/1FnwJx4/w0vhJbpO pRLIUb/BHOsFm/uU2d0Ghp1F0FRpGBdm5RU3GtiwejqaJKpjpliGE5vaO ahyxk28KOIBzv4WDLJNbqEui//BaDL3Ipk6FHdDMisVGoGN3H+S4aRJLb El/5k+5pdwQYwKmk9HXdUu2d27s1bPGm4i1F/OhaALzZvie8vF4dlR0ZB nMXRyHs/gt18KHBFFhL8f+LBKwKRgFYn60APPeoBgmje1wSO+ig+AFCZP A==; X-IronPort-AV: E=Sophos;i="5.53,215,1531756800"; d="scan'208";a="191119604" Received: from mail-sn1nam01lp0115.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.115]) by ob1.hgst.iphmx.com with ESMTP; 10 Aug 2018 03:42:16 +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:X-MS-Exchange-SenderADCheck; bh=J8QNuA9B9rv+zLCBaC+gSIUGEUR91p435QmFrkk186Y=; b=bf2Hr1tc5eZmkFnHGVhuvqPcKar2ev/4hjGGRtjR6CcatVVRrjJZWunZzEeE7NVA1bQScP+tSbZqy3nbR0VfVifb3YywlbnD4/R9sdG1zPyOnPzoirwHM/2pfP0e29LxQtBqZycz76oag3IAd4DwLAXZ38vpQDxDwwBl8PdKgQY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; Received: from asus.hsd1.ca.comcast.net (174.62.111.89) by MWHPR04MB1198.namprd04.prod.outlook.com (2603:10b6:300:71::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 19:42:11 +0000 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei , Jianchao Wang , Hannes Reinecke , Johannes Thumshirn , Alan Stern Subject: [PATCH v6 10/12] block: Change the runtime power management approach (1/2) Date: Thu, 9 Aug 2018 12:41:47 -0700 Message-Id: <20180809194149.15285-11-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180809194149.15285-1-bart.vanassche@wdc.com> References: <20180809194149.15285-1-bart.vanassche@wdc.com> MIME-Version: 1.0 X-Originating-IP: [174.62.111.89] X-ClientProxiedBy: MWHPR2201CA0066.namprd22.prod.outlook.com (2603:10b6:301:5e::19) To MWHPR04MB1198.namprd04.prod.outlook.com (2603:10b6:300:71::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 857e5981-5f3b-4f83-0817-08d5fe30336b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:MWHPR04MB1198; X-Microsoft-Exchange-Diagnostics: 1;MWHPR04MB1198;3:NUUQeMsk1O5N9BhseENMLhnWzTgxU/VLnQ8ZqJ8HgQHI8Qcmb9dB3PzkelZ7cYPQxO5fxOOugLnFvQKmAWtAerw9HTzYhm5rze8Q+j+lr79XoT+2qupW+n3pix1qKWMp2QhI/YVsl2oN9kFU2LI4A7flkDC4h9snChjCChp8lRquSLkXaWVu44GNyY8DGGU/1u3qgwn8xe55omhHWS7Yzc+Cf9/D58hQpeKEGi48oE7yHl/h7ZPTVCqlAW8D/0hd;25:JAZTU1lhqddlb1kGcMeWdFP60EzBmXiuzWiOp/e2Irxw0lH1tS7rPSCBlc6OmF9T+AzEDpfFFH2qGyFhKJJTIiWVSVT5Eb9IqAYh/KgB+huXMdWDXNWFsRbR7+Jc2P8qI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U3v0DU3n5VtQbQXTDDaqSG1EoJk6gqQWldiHx+59MzGWiqy70Vz5HBm4onoVbWd4p6d5E+z+2U13tKRd1kFYyA1mRT15feMeedkH9I/Bmb6H4atuS9E3QYGCdw9e6/sEF0f4yJyp4OMLM9IsaQnw7EFQdvOvWkM0WqEYVq9C37tNAHdNXwFuEF21eYM4eZvpxclnh0Jp+m6C/QRsqWb5tIy+8R2N7W/IAAjRRALrU67b8lFqHVeqVteR7PvHqaNNR4sR/2FPdkwVOaGRnNIi+OnclljZB+y4vFCa9noEXkBEmBRHwo+kcwCRrPHXUAnpRNXqTFW68ms1cmRQTwIf6eg8UVHR0Y= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(35762410373642)(146099531331640); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:MWHPR04MB1198;BCL:0;PCL:0;RULEID:;SRVR:MWHPR04MB1198; X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(136003)(366004)(346002)(376002)(199004)(189003)(76176011)(50466002)(476003)(51416003)(4326008)(478600001)(52116002)(6486002)(105586002)(72206003)(48376002)(5660300001)(47776003)(305945005)(2616005)(956004)(7736002)(6916009)(6666003)(486006)(8936002)(2906002)(68736007)(36756003)(66066001)(575784001)(186003)(446003)(81166006)(50226002)(8676002)(81156014)(316002)(6506007)(386003)(106356001)(97736004)(25786009)(11346002)(16586007)(54906003)(14444005)(6116002)(1076002)(3846002)(86362001)(26005)(16526019)(53936002)(6512007);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR04MB1198;H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6DoCTUZy/N7SCFLF2+QTQJJXj+AyiMD/wPWFHFDxzmHzeQZg3RXVT4Gl+LcbGnHgp3ocnWurgiy5J8eJd2+6ilSUHpix/omeug==;5:YBgh91L3n2qSP0gHmP+CcLkg/WZJ52VeJDR7Pd8TtILtfQUyj/aJLvsaHYm+kB6eXaamzgbWg4lX3QVbmi6g0Eoy35OUuLxT+gbtzBB7JkC/dohBR7MAR1VvxfTyxG9TrhyURBELfjRQED1MUqqEumRIrXqp5HCgpQCEVs88D5U=;7:aVzU7MXLZOq44gCdVTOR0O7MkVhVaep2WKN1mBtPJEc44iqYkfYvn1FlfiVxb4I/Y6VDK5IEoPZTxbwkzEZcSwqkLlRQ1K8fDsBF6mFcr8ohuneOKVD1eTzpVPAcK2Pz+AkwTGmLlNyUgELdV/iF22qDznhwOcNVkDAufzieZTdRGZKA7eMb4VAuqu61GnVMIna2RKPFes6HjaiqzX3WQ4u74AIoBl+YZ4LdVjYf2WfJtg7EufqlQ8Cjz6irZ/8l SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR04MB1198;20:J0lycX1n/ZnH+JfQogmYWhI45Ayw2X2BDe/qWSti8cvvVtdwP7mn+O03L+23a/zuMO3raAKpj/CQBYpM6ISUZrZT3UVOKEXKxTmBVhKEOz99qaU8HgwEMtu5eJaoA9TVYbfBtdCa45S+WLFCRBQakmTx8hGvtJOwrUMk0zXmjvc= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 19:42:11.3697 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 857e5981-5f3b-4f83-0817-08d5fe30336b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB1198 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 Instead of scheduling runtime resume of a request queue after a request has been queued, schedule asynchronous resume during request allocation. The new pm_request_resume() calls occur after blk_queue_enter() has increased the q_usage_counter request queue member. This change is needed for a later patch that will make request allocation block while the queue status is not RPM_ACTIVE. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Ming Lei Cc: Jianchao Wang Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: Alan Stern --- block/blk-core.c | 2 ++ block/blk-mq.c | 2 ++ block/elevator.c | 1 - 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 59dd98585eb0..f30545fb2de2 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -972,6 +972,8 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags) if (success) return 0; + blk_pm_request_resume(q); + if (flags & BLK_MQ_REQ_NOWAIT) return -EBUSY; diff --git a/block/blk-mq.c b/block/blk-mq.c index 2a0eb058ba5a..24439735f20b 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -33,6 +33,7 @@ #include "blk-mq.h" #include "blk-mq-debugfs.h" #include "blk-mq-tag.h" +#include "blk-pm.h" #include "blk-stat.h" #include "blk-mq-sched.h" #include "blk-rq-qos.h" @@ -473,6 +474,7 @@ static void __blk_mq_free_request(struct request *rq) struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(q, ctx->cpu); const int sched_tag = rq->internal_tag; + blk_pm_mark_last_busy(rq); if (rq->tag != -1) blk_mq_put_tag(hctx, hctx->tags, ctx, rq->tag); if (sched_tag != -1) diff --git a/block/elevator.c b/block/elevator.c index 00c5d8dbce16..4c15f0240c99 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -601,7 +601,6 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) trace_block_rq_insert(q, rq); blk_pm_add_request(q, rq); - blk_pm_request_resume(q); rq->q = q;