From patchwork Thu Aug 2 18:29:41 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: 10554051 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 533FFA748 for ; Thu, 2 Aug 2018 18:29:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45C232C468 for ; Thu, 2 Aug 2018 18:29:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A4F52C46A; Thu, 2 Aug 2018 18:29:48 +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 D50BE2C46C for ; Thu, 2 Aug 2018 18:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729034AbeHBUWD (ORCPT ); Thu, 2 Aug 2018 16:22:03 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:49390 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729963AbeHBUWD (ORCPT ); Thu, 2 Aug 2018 16:22:03 -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=1533234629; x=1564770629; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=jr0PNhEJsra1/JK4VFP/eHRvOEIyDffB5BeHvMOfz/A=; b=j9NVprV3LEN9/vO1rapkauufAt4XhoAQ5tCRMbt2hcjPwC8kO0SDbhga 01t1iDAb5bL45eEKoBuKGeJSn9gASLTNpwkYygda5Q2znhyPWGzHva1bQ 11geNYtsZhmV0dY0qe0TuWnPRCPN0Sbnpv7ieBBUKUvrekCWA9fCGjkD9 GITjd2W0upQQQ6SL1tfmwX06zVvVO2xHKE9zFGEA+7vg0Kyexz4PHswPq BFol98DrDHlFNRTTEiZHsOjjAxAZnelmBVl2XfVXD3ujPikE4DdHbxJbO DIGbfJIH8d9LnFcRxNWuFjF6BwL0pmQpbtc0l0PFADnREnYukmHbEgz92 A==; X-IronPort-AV: E=Sophos;i="5.51,436,1526313600"; d="scan'208";a="183378941" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 03 Aug 2018 02:30:27 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 02 Aug 2018 11:18:08 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Aug 2018 11:29:46 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Jianchao Wang , Ming Lei , Alan Stern , Johannes Thumshirn Subject: [PATCH v3 6/9] block: Warn if pm_runtime_get*() has not been called Date: Thu, 2 Aug 2018 11:29:41 -0700 Message-Id: <20180802182944.14442-7-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180802182944.14442-1-bart.vanassche@wdc.com> References: <20180802182944.14442-1-bart.vanassche@wdc.com> 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 Make it easier to determine from which code path a pm_runtime_get*() call is missing by issuing a warning if such a call is missing. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Jianchao Wang Cc: Ming Lei Cc: Alan Stern Cc: Johannes Thumshirn --- block/blk-pm.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/block/blk-pm.h b/block/blk-pm.h index 226fe34c0df9..3978a3021958 100644 --- a/block/blk-pm.h +++ b/block/blk-pm.h @@ -13,8 +13,10 @@ static inline void blk_pm_requeue_request(struct request *rq) static inline void blk_pm_add_request(struct request_queue *q, struct request *rq) { - if (q->dev && !(rq->rq_flags & RQF_PREEMPT) && - (q->rpm_status == RPM_SUSPENDED || q->rpm_status == RPM_SUSPENDING)) + if (!q->dev || (rq->rq_flags & RQF_PREEMPT)) + return; + WARN_ON_ONCE(atomic_read(&q->dev->power.usage_count) == 0); + if (q->rpm_status == RPM_SUSPENDED || q->rpm_status == RPM_SUSPENDING) pm_request_resume(q->dev); }