From patchwork Thu Oct 3 08:42:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 175063 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1235ill; Thu, 3 Oct 2019 01:43:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRxhvAtFsDzk89JZk263Gt9jqtWzX8MER3Dv+78HNd+NXM4URJB6QCAmlMdW1DZJnCn5Bt X-Received: by 2002:a05:6402:17eb:: with SMTP id t11mr7989743edy.97.1570092193133; Thu, 03 Oct 2019 01:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570092193; cv=none; d=google.com; s=arc-20160816; b=ofz9OJBk03Ir/u6e3SE/JStryTexGq7kPCOL6YOFDQiQwHQJfqPvbQoS7SP5F4H5se T++aGGFfLY+sEs5MfSKy7uDyjpiwQtG1+RGqEb5Onm98LX9vEdODKOBXXpGm1jcWTikm VdsME/57YCG7RGVZAQsQrlyaQjneq/Vw+RFNreEUZasLbbQ/ZjhPPW8lUJ3h3ICr9rkp n38H+BSyt9rDD7ns7ploF48tcES4HV0ghevZjRZv7hv3fCbkwwYkKEaFnUstmFLfoNSq 9bxlvI1DROrn3TJ5ZmdXb3FNapn/Oo+ZQeyUv1CI15to8YU7mu2I/yrGA5hf6rexixBR yweg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=PkzxXO0kBcxX7RILeE3FuUnuhQQatCZ5b0O6JmLXb1U=; b=M2e+xrPgCKXstH2x9ozwSPCaLry5S1DyqerMvoqeEEbGEsInf+r0T3rkpCise7WKAL HbEaZpKN/Z8j8Ao/L5C9qE+dy/v4GS9tiSwLTuLldYfVGypgujYD9rV881/RFs3LLo/+ 77pEs+9fxhZAB+lbvC0JCx4g1Fwn7kFlnm2OQzCwpua4hDLQGvMS+bu5lqs7GANUsQu9 /IgEW4iWrbIdrTtDyNgOPUchRDIfTrsjXfP3G27Ma5/snS1H5CK7puCvfHBxasCvD+pj Cz8h2qScZApwr+p7pgki17TjnrWtX+Z1leSqU9KCOutaq8m2de44XhHNntJYeksuKtA7 eo7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d2RA8XQD; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j35si1166182eda.144.2019.10.03.01.43.12; Thu, 03 Oct 2019 01:43:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d2RA8XQD; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728766AbfJCInL (ORCPT + 10 others); Thu, 3 Oct 2019 04:43:11 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43825 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728842AbfJCInK (ORCPT ); Thu, 3 Oct 2019 04:43:10 -0400 Received: by mail-wr1-f67.google.com with SMTP id j18so1188965wrq.10 for ; Thu, 03 Oct 2019 01:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PkzxXO0kBcxX7RILeE3FuUnuhQQatCZ5b0O6JmLXb1U=; b=d2RA8XQDgVDJJl9BkilqseaM9dtBxXTtwUEqFt77pIMNYH+ci1xYL3fa/Eq5QCmsfe xwa7z321VDwC4wqua7q2IMNbJ5gu00Vxy7VYEniqDQsQdK78Ldl22XUL/b4+WkKTx+V5 YHgO6cuhZ0Ixpk71nzExsfCtT7R6Mo+Fg61eCo5NIKDpCmWt0hNnm9L/l4i+t/kaOM00 P1bw/Z5pG7eZSAo7DprUaN+OrocugXDDxBUd1Z+x/1lAZipZULeVEGm/xOplnOsFM05S Nr5cy8pyZKntmP8IBmochESdb6Oz9EyDb3gRLEGnbENkBAQ1kxq6HIGXnVfzpsiO74Ml r1gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PkzxXO0kBcxX7RILeE3FuUnuhQQatCZ5b0O6JmLXb1U=; b=VToZZF0Gnmw85z7YbAY/6VVF26QqCre97M9scXr5+THwWFdcMTk+c26RwzkxMK9JRe MVMYj60x3CfUjSLsi9zp9x9erlwXyEjVdGvdLVnYxBqR8QJX/v4Fn5FlNPw3BEsql4LU fDP58oypxNSqU1dvpGCgzXXmLoQ8mRAve9NH0SH8IfoJVJgo3Z2Kmo7uSAjVX60WOJRR 4ma7Z/TFJj+Jb2sFzF6454GrV3T0fg7IoK7nLz916SVpbVXc1mFEKjzVp32nXed/QbMA DhbNggknlLaIK2FaH2epx85PkqqFGPyE4Uwu8+fJUFhDnTt/bQeX1Czj+wbLXSiIksXa sXxw== X-Gm-Message-State: APjAAAUieRm+sv0pycZpGjJzoGOmBbsrlTWzhya4mnb/K/jsvWU5AIuY gcR/uzkJ6F7oUtrCCzrOX6MSancz7oQ= X-Received: by 2002:adf:e386:: with SMTP id e6mr3459292wrm.91.1570092188817; Thu, 03 Oct 2019 01:43:08 -0700 (PDT) Received: from localhost.localdomain ([2a01:e34:ed2f:f020:7990:8bfa:5771:282b]) by smtp.gmail.com with ESMTPSA id z3sm1519702wmi.30.2019.10.03.01.43.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2019 01:43:08 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org Cc: Mathieu Poirier , "Rafael J. Wysocki" , Zhang Rui , Eduardo Valentin , Ingo Molnar , Peter Zijlstra , Greg Kroah-Hartman , Allison Randal , Thomas Gleixner , Amit Kucheria , Luc Van Oostenryck , Josh Poimboeuf , Jiri Kosina , Nicholas Piggin , linux-pm@vger.kernel.org (open list:POWER MANAGEMENT CORE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH V2 2/3] cpuidle: play_idle: Specify play_idle with an idle state Date: Thu, 3 Oct 2019 10:42:40 +0200 Message-Id: <20191003084242.8655-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191003084242.8655-1-daniel.lezcano@linaro.org> References: <20191003084242.8655-1-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Currently, the play_idle function does not allow to tell which idle state we want to go. Improve this by passing the idle state as parameter to the function. There is no functional changes, the cpuidle state is the deepest one. Signed-off-by: Daniel Lezcano Acked-by: Mathieu Poirier --- drivers/powercap/idle_inject.c | 3 ++- drivers/thermal/intel/intel_powerclamp.c | 4 +++- include/linux/cpu.h | 2 +- kernel/sched/idle.c | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/powercap/idle_inject.c b/drivers/powercap/idle_inject.c index cd1270614cc6..9b18667b9f26 100644 --- a/drivers/powercap/idle_inject.c +++ b/drivers/powercap/idle_inject.c @@ -138,7 +138,8 @@ static void idle_inject_fn(unsigned int cpu) */ iit->should_run = 0; - play_idle(READ_ONCE(ii_dev->idle_duration_us)); + play_idle(READ_ONCE(ii_dev->idle_duration_us), + cpuidle_find_deepest_state()); } /** diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c index 53216dcbe173..b55786c169ae 100644 --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -430,7 +431,8 @@ static void clamp_idle_injection_func(struct kthread_work *work) if (should_skip) goto balance; - play_idle(jiffies_to_usecs(w_data->duration_jiffies)); + play_idle(jiffies_to_usecs(w_data->duration_jiffies), + cpuidle_find_deepest_state()); balance: if (clamping && w_data->clamping && cpu_online(w_data->cpu)) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 88dc0c653925..76e3038b63ce 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -179,7 +179,7 @@ void arch_cpu_idle_dead(void); int cpu_report_state(int cpu); int cpu_check_up_prepare(int cpu); void cpu_set_state_online(int cpu); -void play_idle(unsigned long duration_us); +void play_idle(unsigned long duration_us, int state); #ifdef CONFIG_HOTPLUG_CPU bool cpu_wait_death(unsigned int cpu, int seconds); diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 17da9cb309e1..ead439dab2b5 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -311,7 +311,7 @@ static enum hrtimer_restart idle_inject_timer_fn(struct hrtimer *timer) return HRTIMER_NORESTART; } -void play_idle(unsigned long duration_us) +void play_idle(unsigned long duration_us, int state) { struct idle_timer it; @@ -328,7 +328,7 @@ void play_idle(unsigned long duration_us) rcu_sleep_check(); preempt_disable(); current->flags |= PF_IDLE; - cpuidle_use_state(cpuidle_find_deepest_state()); + cpuidle_use_state(state); it.done = 0; hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);