From patchwork Tue Nov 26 23:20:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Pan X-Patchwork-Id: 3241731 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4D5FD9F495 for ; Tue, 26 Nov 2013 23:20:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 889042014A for ; Tue, 26 Nov 2013 23:20:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C77C20555 for ; Tue, 26 Nov 2013 23:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758394Ab3KZXUr (ORCPT ); Tue, 26 Nov 2013 18:20:47 -0500 Received: from mga14.intel.com ([143.182.124.37]:19201 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757592Ab3KZXUV (ORCPT ); Tue, 26 Nov 2013 18:20:21 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by azsmga102.ch.intel.com with ESMTP; 26 Nov 2013 15:20:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,778,1378882800"; d="scan'208";a="434758882" Received: from ultegra.jf.intel.com ([10.24.1.237]) by fmsmga001.fm.intel.com with ESMTP; 26 Nov 2013 15:20:18 -0800 From: Jacob Pan To: Linux PM , LKML , Peter Zijlstra , Rafael Wysocki , Len Brown , Arjan van de Ven , Zhang Rui Cc: Jacob Pan Subject: [PATCH 2/3] cpuidle: check for pm qos constraint override Date: Tue, 26 Nov 2013 15:20:10 -0800 Message-Id: <1385508011-26914-3-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1385508011-26914-1-git-send-email-jacob.jun.pan@linux.intel.com> References: <1385508011-26914-1-git-send-email-jacob.jun.pan@linux.intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a QOS class is disabled due to platform thermal or power capping needs, idle governor shall pick the deepest idle state to conserve power. Power saving should be prioritized over QOS in this case in that hardware based catastrophic measure is more intrusive than managed idle. Signed-off-by: Jacob Pan --- drivers/cpuidle/governors/ladder.c | 4 ++++ drivers/cpuidle/governors/menu.c | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 9f08e8c..40161d3 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -71,6 +71,10 @@ static int ladder_select_state(struct cpuidle_driver *drv, int last_residency, last_idx = ldev->last_state_idx; int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); + /* qos ignored, pick the deepest idle state */ + if (unlikely(latency_req == PM_QOS_DEFAULT_VALUE)) + return drv->state_count - 1; + /* Special case when user has set very strict latency requirement */ if (unlikely(latency_req == 0)) { ladder_do_selection(ldev, last_idx, 0); diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index cf7f2f0..afa0088 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -297,12 +297,21 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) data->needs_update = 0; } + /* qos ignored, pick the deepest idle state */ + if (unlikely(latency_req == PM_QOS_DEFAULT_VALUE)) { + struct cpuidle_state *s = &drv->states[drv->state_count - 1]; + + data->last_state_idx = drv->state_count - 1; + data->exit_us = s->exit_latency; + goto exit_done; + } + data->last_state_idx = 0; data->exit_us = 0; /* Special case when user has set very strict latency requirement */ if (unlikely(latency_req == 0)) - return 0; + goto exit_done; /* determine the expected residency time, round up */ t = ktime_to_timespec(tick_nohz_get_sleep_length()); @@ -361,7 +370,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) data->last_state_idx = i; data->exit_us = s->exit_latency; } - +exit_done: return data->last_state_idx; }