linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Doug Smythies <dsmythies@telus.net>
Subject: [PATCH 04/16] cpufreq: intel_pstate: Fold intel_pstate_reset_all_pid() into the caller
Date: Tue, 28 Mar 2017 00:07:15 +0200	[thread overview]
Message-ID: <2138140.7OVzaumNXP@aspire.rjw.lan> (raw)
In-Reply-To: <6409323.DYHvh3CYlO@aspire.rjw.lan>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

There is only one caller of intel_pstate_reset_all_pid(), which is
pid_param_set() used in the debugfs interface only, and having that
code split does not make it particularly convenient to follow.

For this reason, move the body of intel_pstate_reset_all_pid() into
its caller and drop that function.

Also change the loop from for_each_online_cpu() (which is obviously
racy with respect to CPU offline/online) to for_each_possible_cpu(),
so that all PID parameters are reset for all CPUs regardless of their
online/offline status (to prevent, for example, a previously offline
CPU from going online with a stale set of PID parameters).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/intel_pstate.c |   17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -576,16 +576,6 @@ static inline void intel_pstate_busy_pid
 	pid_reset(&cpu->pid, pid_params.setpoint, 100, pid_params.deadband, 0);
 }
 
-static inline void intel_pstate_reset_all_pid(void)
-{
-	unsigned int cpu;
-
-	for_each_online_cpu(cpu) {
-		if (all_cpu_data[cpu])
-			intel_pstate_busy_pid_reset(all_cpu_data[cpu]);
-	}
-}
-
 static inline void update_turbo_state(void)
 {
 	u64 misc_en;
@@ -941,9 +931,14 @@ static void intel_pstate_update_policies
 /************************** debugfs begin ************************/
 static int pid_param_set(void *data, u64 val)
 {
+	unsigned int cpu;
+
 	*(u32 *)data = val;
 	pid_params.sample_rate_ns = pid_params.sample_rate_ms * NSEC_PER_MSEC;
-	intel_pstate_reset_all_pid();
+	for_each_possible_cpu(cpu)
+		if (all_cpu_data[cpu])
+			intel_pstate_busy_pid_reset(all_cpu_data[cpu]);
+
 	return 0;
 }
 

  parent reply	other threads:[~2017-03-27 22:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 22:01 [PATCH 00/16] cpufreq: intel_pstate: Cleanups and optimizations Rafael J. Wysocki
2017-03-27 22:03 ` [PATCH 01/16] cpufreq: intel_pstate: Eliminate struct perf_limits Rafael J. Wysocki
2017-03-27 22:04 ` [PATCH 02/16] cpufreq: intel_pstate: Drop pointless initialization of PID parameters Rafael J. Wysocki
2017-03-27 22:05 ` [PATCH 03/16] cpufreq: intel_pstate: Initialize pid_params statically Rafael J. Wysocki
2017-03-27 22:07 ` Rafael J. Wysocki [this message]
2017-03-27 22:09 ` [PATCH 05/16] cpufreq: intel_pstate: Clean up intel_pstate_busy_pid_reset() Rafael J. Wysocki
2017-03-27 22:10 ` [PATCH 06/16] cpufreq: intel_pstate: Set HWP sampling interval once Rafael J. Wysocki
2017-03-27 22:11 ` [PATCH 07/16] cpufreq: intel_pstate: Skip unnecessary PID resets on init Rafael J. Wysocki
2017-03-27 22:13 ` [PATCH 08/16] cpufreq: intel_pstate: Drop driver_registered variable Rafael J. Wysocki
2017-03-27 22:14 ` [PATCH 09/16] cpufreq: intel_pstate: Modify check in intel_pstate_update_status() Rafael J. Wysocki
2017-03-27 22:15 ` [PATCH 10/16] cpufreq: intel_pstate: Use different utilization update callbacks Rafael J. Wysocki
2017-03-27 22:17 ` [PATCH 11/16] cpufreq: intel_pstate: Add update_util callback to pstate_funcs Rafael J. Wysocki
2017-03-27 22:18 ` [PATCH 12/16] cpufreq: intel_pstate: Move cpu_defaults definitions Rafael J. Wysocki
2017-03-27 22:19 ` [PATCH 13/16] cpufreq: intel_pstate: Drop struct cpu_defaults Rafael J. Wysocki
2017-03-27 22:20 ` [PATCH 14/16] cpufreq: intel_pstate: Introduce pid_in_use() Rafael J. Wysocki
2017-03-27 22:22 ` [PATCH 15/16] cpufreq: intel_pstate: Do not walk policy->cpus Rafael J. Wysocki
2017-03-27 22:24 ` [PATCH 16/16] cpufreq: intel_pstate: Eliminate intel_pstate_get_min_max() Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2138140.7OVzaumNXP@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=dsmythies@telus.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).