From patchwork Mon Aug 5 17:02:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 170608 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4538962ile; Mon, 5 Aug 2019 10:02:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhW2Y7TO1bpcXx+l5L1rSnHcnV3tlWt2DE3J94fwDvUIS6FohkuOEjH+NBgp+50mFV9U6s X-Received: by 2002:a63:c70d:: with SMTP id n13mr135937352pgg.171.1565024562103; Mon, 05 Aug 2019 10:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565024562; cv=none; d=google.com; s=arc-20160816; b=F5/agRAA5zFag8vFWJN7nq/eAzk4cetV54o5CKakCo/sC6k7lNOTmbNx2kXGXhcfjA pHqd/R1ELxaZkmWQr8bJfekHY4W8z3+pKumDhC5UbkP/155bSbT3+2Hhl8Tv6qPrNnr6 T1HIyLXvb2YAe52ihMPBTBpUt7rE+zmo8Yjo98m+6AATH5L2aezmmrKpuzXRNZ5QufCA ejWVnAval0vRuAlK5SRBbX4jU3b5fgiKwqLaZCLavVRi7K66RoZPZPnWfcbmOt31r7qh pWqr4rvOFQ8OJsPFQjhsLPnN93I7c1NIGmgCUygjVrEhX31EBrVu+pJsuDsWWFH1DmCZ F/+Q== 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=wTiqcN9ans0X8+b6FfQH+5cUMosgyj2ws3IXTgtGmS8=; b=qQ4NxdnRcEigxdgQUXJiVrqw+gcPphs34WiQkd0QF3EP6dIv3TFG/t8jVSc3+FX+2/ s4tftI8OeRximsND1rLc4IlGeln9NXKCTuSli4NvF/XQj2FZYRuEcKchqz6/F3//kPQE KNSHOsOWAcIDMfjod3uDJZVgMUDxenn1wEuqY/uG/EtQrxhDEzO5n0nfq+2HnSk9WcED y7V/et+29tGgX2H1SiKvhqFrripdjE2xmZTHyzkiRbgEJ7JbMsgBgQC8imWp0F8soDyr gyimEB+FAplA5emoR/oezNq8hSYY119SgRY6ct+GEcLMILGwbNEGrr1iCXbalFAl7d8s 2cXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KQ0cEdMQ; 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 l63si46181371pfl.41.2019.08.05.10.02.41; Mon, 05 Aug 2019 10:02:42 -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=KQ0cEdMQ; 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 S1729973AbfHERCl (ORCPT + 11 others); Mon, 5 Aug 2019 13:02:41 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39403 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729914AbfHERCl (ORCPT ); Mon, 5 Aug 2019 13:02:41 -0400 Received: by mail-wm1-f66.google.com with SMTP id u25so63360893wmc.4 for ; Mon, 05 Aug 2019 10:02:39 -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=wTiqcN9ans0X8+b6FfQH+5cUMosgyj2ws3IXTgtGmS8=; b=KQ0cEdMQ7CsmbkTG8v83WQ8idHQcpy1o6EqRpdVIr6T/mKjdwyQyFobXC7ej0BsWmz +4hk4IBZlp0q6fwXr+b2VG5jG7xI0/JO6MYkxepVK2S2dq2oNl7TDkGiCmjj9MgvEC8X gwhZn8+PbYoEeNTEMBT1XyqAx2ikdgyZLf+Vwbu7v8duiat9g1olSU/E5sSpTY+7hbZP wIEd6ysvglzS9f7w5BG4LGuvZRZyIJD8lowKn0tEuhP7xX3s2S885dyADWLPbUCfTGSs 3u66m7CFthV0uuXWVDUCRjvx/9eixE0/bFzMvfTJMJK4iHjFL6zSUEDqeglbj86zW8r7 RhqA== 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=wTiqcN9ans0X8+b6FfQH+5cUMosgyj2ws3IXTgtGmS8=; b=SUjUDm33N+3LNBPP6F3w0iUgyIH/5AZYUI86se8ZLp4kPqVXn8qrktQPQdk1TTyeQS GkAo1i4eogTTCRpHOwk5jpjZeQSoaDUorbHJ3M/o3savP2IgfQBS42vWuRH9DxIZqpve 87Q4gjujYfwOfangQRrbKpTfYqDxdga8q+YRby/VNK7LkXqyJA01NmtB3D/XNYivZyJu ls5gZkCSxY6uxZPZbnFNtDhpFhN/uhqfjj5hlen4elUPn12d9iG1j4Ar0XkSUlNr8K3b xdtITVwcZp5rRbh+YIlYs6pRn7lPfEzrjDW5O390vvkSv2uiGUOx2U+qtivunc6tnO5h yLQw== X-Gm-Message-State: APjAAAX1fPvrsj7QNvjfuq8uVZR999XzKalNgbxiklxB4KiCaiIS9FI6 51Cc6Bmo4f7CunfSDgGbffDAiA== X-Received: by 2002:a05:600c:c4:: with SMTP id u4mr19728181wmm.96.1565024558987; Mon, 05 Aug 2019 10:02:38 -0700 (PDT) Received: from localhost.localdomain ([2a01:e34:ed2f:f020:e5cb:2287:9bbb:b7eb]) by smtp.gmail.com with ESMTPSA id v29sm28893685wrv.74.2019.08.05.10.02.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 10:02:38 -0700 (PDT) From: Daniel Lezcano To: rjw@rjwysocki.net Cc: linux-pm@vger.kernel.org, Zhang Rui , Eduardo Valentin , Ingo Molnar , Peter Zijlstra , Greg Kroah-Hartman , Thomas Gleixner , Luc Van Oostenryck , Finn Thain , Amit Kucheria , Josh Poimboeuf , Nicholas Piggin , Jiri Kosina , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/3] cpuidle: play_idle: Specify play_idle with an idle state Date: Mon, 5 Aug 2019 19:02:07 +0200 Message-Id: <20190805170208.26873-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190805170208.26873-1-daniel.lezcano@linaro.org> References: <20190805170208.26873-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. Signed-off-by: Daniel Lezcano --- 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 c102e03dee6e..f9773dd55ab9 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -310,7 +310,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; @@ -327,7 +327,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);