From patchwork Wed Jul 11 16:29:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10520183 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 58043600CA for ; Wed, 11 Jul 2018 16:29:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49036295A1 for ; Wed, 11 Jul 2018 16:29:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D0F3295AD; Wed, 11 Jul 2018 16:29:50 +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, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 E2AC6295A1 for ; Wed, 11 Jul 2018 16:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389536AbeGKQey (ORCPT ); Wed, 11 Jul 2018 12:34:54 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58772 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726609AbeGKQey (ORCPT ); Wed, 11 Jul 2018 12:34:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7299B4B75C; Wed, 11 Jul 2018 16:29:47 +0000 (UTC) Received: from localhost (ovpn-12-22.pek2.redhat.com [10.72.12.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95AB01C4C3; Wed, 11 Jul 2018 16:29:37 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, Ming Lei , "Rafael J. Wysocki" , Alan Stern , linux-pm@vger.kernel.org, Greg Kroah-Hartman , Christoph Hellwig , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org Subject: [PATCH RFC 1/4] blk-mq: introduce blk_mq_support_runtime_pm() Date: Thu, 12 Jul 2018 00:29:03 +0800 Message-Id: <20180711162906.14271-2-ming.lei@redhat.com> In-Reply-To: <20180711162906.14271-1-ming.lei@redhat.com> References: <20180711162906.14271-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 11 Jul 2018 16:29:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 11 Jul 2018 16:29:47 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A bit cost has to be added in fast IO path for supporting runtime PM, and introduce this helper so that drivers incapable of runtime PM may not be affected by this feature. Cc: "Rafael J. Wysocki" Cc: Alan Stern Cc: linux-pm@vger.kernel.org Cc: Greg Kroah-Hartman Cc: Christoph Hellwig Cc: Bart Van Assche Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org Signed-off-by: Ming Lei --- include/linux/blk-mq.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index d710e92874cc..998ad6602448 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -180,6 +180,7 @@ enum { BLK_MQ_F_SHOULD_MERGE = 1 << 0, BLK_MQ_F_TAG_SHARED = 1 << 1, BLK_MQ_F_SG_MERGE = 1 << 2, + BLK_MQ_F_SUPPORT_RPM = 1 << 3, BLK_MQ_F_BLOCKING = 1 << 5, BLK_MQ_F_NO_SCHED = 1 << 6, BLK_MQ_F_ALLOC_POLICY_START_BIT = 8, @@ -249,6 +250,15 @@ static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag) return unique_tag & BLK_MQ_UNIQUE_TAG_MASK; } +static inline bool blk_mq_support_runtime_pm(struct request_queue *q) +{ + struct blk_mq_tag_set *set = q->tag_set; + + if (!q->dev || !set || !(set->flags & BLK_MQ_F_SUPPORT_RPM)) + return false; + + return true; +} int blk_mq_request_started(struct request *rq); void blk_mq_start_request(struct request *rq);