From patchwork Tue Aug 7 22:51:24 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: 10559305 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 A9D0B174A for ; Tue, 7 Aug 2018 22:51:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B9372A6F7 for ; Tue, 7 Aug 2018 22:51:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99F922A71E; Tue, 7 Aug 2018 22:51: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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 3BC882A81D for ; Tue, 7 Aug 2018 22:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726902AbeHHBIQ (ORCPT ); Tue, 7 Aug 2018 21:08:16 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:58488 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726625AbeHHBIQ (ORCPT ); Tue, 7 Aug 2018 21:08:16 -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=1533682300; x=1565218300; h=from:to:cc:subject:date:message-id; bh=JGKYWnCDD+pi6mFegf4+izX47P9Db6TwmCp7HUVd3DA=; b=Ek7PoAgG46PUoJcpxuwfmkv5K+O8pLg2hsSuIGvdk0F7ePYh1HhcG+4r +vcEUg/hqyTH6Qr6YLsKxQs3HYwDDrtID2hvOkU9yrjQmK2agKuBBGNp8 xKULk5bkWUZ3sC/9/5mHptr7j1/IIN/Tr4EYL4aDOj1OaD9qufBQFZazw 6vlXEnJ6Tq9crR0UUrBNP7GALKVR6hrFWaM6yMxZIR+BhN9kkmHCI2+RR J0ca+jiMysiuLBaECCH/HOeFXVgxnT7m3ysOBG0rP4HwQ5T1/jPi46rM1 3sjILgeK/DbmdTlhNzbvaqKAQry81FOS6t7fg6TvyqbRlS27Sy0AUlyiW Q==; X-IronPort-AV: E=Sophos;i="5.51,456,1526313600"; d="scan'208";a="87859741" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Aug 2018 06:51:33 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 07 Aug 2018 15:39:12 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 07 Aug 2018 15:51:34 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH v5 0/9] blk-mq: Implement runtime power management Date: Tue, 7 Aug 2018 15:51:24 -0700 Message-Id: <20180807225133.27221-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 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 Hello Jens, This patch series not only implements runtime power management for blk-mq but also fixes a starvation issue in the power management code for the legacy block layer. Please consider this patch series for kernel v4.19. Thanks, Bart. Changes compared to v4: - Dropped the patches "Give RQF_PREEMPT back its original meaning" and "Serialize queue freezing and blk_pre_runtime_suspend()". - Replaced "percpu_ref_read()" with "percpu_is_in_use()". - Inserted pm_request_resume() calls in the block layer request allocation code such that the context that submits a request no longer has to call pm_runtime_get(). Changes compared to v3: - Avoid adverse interactions between system-wide suspend/resume and runtime power management by changing the PREEMPT_ONLY flag into a counter. - Give RQF_PREEMPT back its original meaning, namely that it is only set for ide_preempt requests. - Remove the flag BLK_MQ_REQ_PREEMPT. - Removed the pm_request_resume() call. Changes compared to v2: - Fixed the build for CONFIG_BLOCK=n. - Added a patch that introduces percpu_ref_read() in the percpu-counter code. - Added a patch that makes it easier to detect missing pm_runtime_get*() calls. - Addressed Jianchao's feedback including the comment about runtime overhead of switching a per-cpu counter to atomic mode. Changes compared to v1: - Moved the runtime power management code into a separate file. - Addressed Ming's feedback. Bart Van Assche (9): block: Change the preempt-only flag into a counter block: Move power management code into a new source file block, scsi: Introduce blk_pm_runtime_exit() percpu-refcount: Introduce percpu_ref_is_in_use() block: Change the runtime power management approach (1/2) block: Change the runtime power management approach (2/2) block: Remove blk_pm_requeue_request() blk-mq: Insert a blk_pm_put_request() call blk-mq: Enable support for runtime power management block/Kconfig | 5 + block/Makefile | 1 + block/blk-core.c | 277 ++++---------------------------- block/blk-mq-debugfs.c | 11 +- block/blk-mq.c | 8 + block/blk-pm.c | 230 ++++++++++++++++++++++++++ block/blk-pm.h | 33 ++++ block/elevator.c | 26 +-- drivers/scsi/scsi_lib.c | 17 +- drivers/scsi/scsi_pm.c | 1 + drivers/scsi/sd.c | 10 +- drivers/scsi/sr.c | 4 +- include/linux/blk-mq.h | 2 + include/linux/blk-pm.h | 26 +++ include/linux/blkdev.h | 38 ++--- include/linux/percpu-refcount.h | 2 + lib/percpu-refcount.c | 40 +++++ 17 files changed, 420 insertions(+), 311 deletions(-) create mode 100644 block/blk-pm.c create mode 100644 block/blk-pm.h create mode 100644 include/linux/blk-pm.h