From patchwork Sat Aug 4 00:03:15 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: 10555555 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 1EFD313AC for ; Sat, 4 Aug 2018 00:03:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EC182C913 for ; Sat, 4 Aug 2018 00:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00B852C971; Sat, 4 Aug 2018 00:03:27 +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 7AA0F2C913 for ; Sat, 4 Aug 2018 00:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732036AbeHDCBz (ORCPT ); Fri, 3 Aug 2018 22:01:55 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:34549 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731959AbeHDCBz (ORCPT ); Fri, 3 Aug 2018 22:01:55 -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=1533341007; x=1564877007; h=from:to:cc:subject:date:message-id; bh=xJbZu501dOmPDdgox5bhQct06hJp5y+bAxSiGfkIO8o=; b=Ez9SLowKq9blF+tVCRMeBTUQg1kH6r8scbT3n0nj68ruN5nUd/m3+str UQckADVdkRClU5gO0FUElnrZu/GkcvANfsNcU8CmtWR7jxDE2Kbq5eF9K 2kcwMaowYYDpBmoolxLdB5Dj+iNH3w9fIjbgE5LQlXoLUGsVCYD4Zgs6O BZ0xZ2PEaBrlnYDM7SiNvmc15cJs55lzmYmlrdIe4W0P81UM8No32U8xE GPt6UZXprBDpYp9sdBzQhYgMgN9B5NzoI/toM+em/Ghj2rV3ygRhe5DCN FngQ/46ReGjv6zAaP3tgT16O5GpavUA95XbOY/jf6n3dsEOhv4B1hBjzr A==; X-IronPort-AV: E=Sophos;i="5.51,440,1526313600"; d="scan'208";a="90059253" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 04 Aug 2018 08:03:26 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 03 Aug 2018 16:51:10 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 03 Aug 2018 17:03:25 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH v4 00/10] blk-mq: Enable runtime power management Date: Fri, 3 Aug 2018 17:03:15 -0700 Message-Id: <20180804000325.3610-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 enables 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 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 (10): block: Change the preempt-only flag into a counter block, scsi: Give RQF_PREEMPT back its original meaning block, ide: Remove flag BLK_MQ_REQ_PREEMPT block: Move power management code into a new source file block: Serialize queue freezing and blk_pre_runtime_suspend() percpu-refcount: Introduce percpu_ref_read() block, scsi: Rework runtime power management block: Remove blk_pm_requeue_request() blk-mq: Insert blk_pm_{add,put}_request() calls blk-mq: Enable support for runtime power management block/Kconfig | 5 + block/Makefile | 1 + block/blk-core.c | 281 ++++---------------------------- block/blk-mq-debugfs.c | 11 +- block/blk-mq-sched.c | 13 +- block/blk-mq.c | 13 +- block/blk-pm.c | 245 ++++++++++++++++++++++++++++ block/blk-pm.h | 37 +++++ block/elevator.c | 24 +-- drivers/ide/ide-pm.c | 3 +- drivers/scsi/scsi_lib.c | 36 ++-- drivers/scsi/scsi_pm.c | 1 + drivers/scsi/sd.c | 1 + drivers/scsi/sr.c | 1 + include/linux/blk-mq.h | 4 +- include/linux/blk-pm.h | 30 ++++ include/linux/blkdev.h | 45 ++--- include/linux/percpu-refcount.h | 2 + lib/percpu-refcount.c | 29 ++++ 19 files changed, 453 insertions(+), 329 deletions(-) create mode 100644 block/blk-pm.c create mode 100644 block/blk-pm.h create mode 100644 include/linux/blk-pm.h