From patchwork Mon Mar 27 22:05:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 9647643 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1E2EF602C8 for ; Mon, 27 Mar 2017 22:43:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F9832819A for ; Mon, 27 Mar 2017 22:43:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04A8F282E8; Mon, 27 Mar 2017 22:43: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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 A1FAC2819A for ; Mon, 27 Mar 2017 22:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752696AbdC0Wnq (ORCPT ); Mon, 27 Mar 2017 18:43:46 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:58594 "EHLO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752633AbdC0Wno (ORCPT ); Mon, 27 Mar 2017 18:43:44 -0400 Received: from adkt166.ipv4.supernova.orange.pl (79.184.253.166) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.82) id a36c3844585adf5d; Tue, 28 Mar 2017 00:37:06 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Srinivas Pandruvada , Doug Smythies Subject: [PATCH 03/16] cpufreq: intel_pstate: Initialize pid_params statically Date: Tue, 28 Mar 2017 00:05:44 +0200 Message-ID: <3316890.rXW5Ee2Yl6@aspire.rjw.lan> User-Agent: KMail/4.14.10 (Linux/4.10.0+; KDE/4.14.9; x86_64; ; ) In-Reply-To: <6409323.DYHvh3CYlO@aspire.rjw.lan> References: <6409323.DYHvh3CYlO@aspire.rjw.lan> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki Notice that both the existing struct cpu_defaults instances in which PID parameters are actually initialized use the same values of those parameters, so it is not really necessary to copy them over to pid_params dynamically. Instead, initialize pid_params statically with those values and drop the unused pid_policy member from struct cpu_defaults along with copy_pid_params() used for initializing it. Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/intel_pstate.c | 42 +++++++++-------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) Index: linux-pm/drivers/cpufreq/intel_pstate.c =================================================================== --- linux-pm.orig/drivers/cpufreq/intel_pstate.c +++ linux-pm/drivers/cpufreq/intel_pstate.c @@ -321,19 +321,26 @@ struct pstate_funcs { /** * struct cpu_defaults- Per CPU model default config data - * @pid_policy: PID config data * @funcs: Callback function data */ struct cpu_defaults { - struct pstate_adjust_policy pid_policy; struct pstate_funcs funcs; }; static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu); static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu); -static struct pstate_adjust_policy pid_params __read_mostly; static struct pstate_funcs pstate_funcs __read_mostly; +static struct pstate_adjust_policy pid_params __read_mostly = { + .sample_rate_ms = 10, + .sample_rate_ns = 10 * NSEC_PER_MSEC, + .deadband = 0, + .setpoint = 97, + .p_gain_pct = 20, + .d_gain_pct = 0, + .i_gain_pct = 0, +}; + static int hwp_active __read_mostly; static bool per_cpu_limits __read_mostly; @@ -1520,14 +1527,6 @@ static int knl_get_turbo_pstate(void) } static struct cpu_defaults core_params = { - .pid_policy = { - .sample_rate_ms = 10, - .deadband = 0, - .setpoint = 97, - .p_gain_pct = 20, - .d_gain_pct = 0, - .i_gain_pct = 0, - }, .funcs = { .get_max = core_get_max_pstate, .get_max_physical = core_get_max_pstate_physical, @@ -1566,14 +1565,6 @@ static const struct cpu_defaults airmont }; static const struct cpu_defaults knl_params = { - .pid_policy = { - .sample_rate_ms = 10, - .deadband = 0, - .setpoint = 97, - .p_gain_pct = 20, - .d_gain_pct = 0, - .i_gain_pct = 0, - }, .funcs = { .get_max = core_get_max_pstate, .get_max_physical = core_get_max_pstate_physical, @@ -2412,17 +2403,6 @@ static int __init intel_pstate_msrs_not_ return 0; } -static void __init copy_pid_params(struct pstate_adjust_policy *policy) -{ - pid_params.sample_rate_ms = policy->sample_rate_ms; - pid_params.sample_rate_ns = pid_params.sample_rate_ms * NSEC_PER_MSEC; - pid_params.p_gain_pct = policy->p_gain_pct; - pid_params.i_gain_pct = policy->i_gain_pct; - pid_params.d_gain_pct = policy->d_gain_pct; - pid_params.deadband = policy->deadband; - pid_params.setpoint = policy->setpoint; -} - #ifdef CONFIG_ACPI static void intel_pstate_use_acpi_profile(void) { @@ -2614,8 +2594,6 @@ static int __init intel_pstate_init(void cpu_def = (struct cpu_defaults *)id->driver_data; copy_cpu_funcs(&cpu_def->funcs); - if (pstate_funcs.get_target_pstate == get_target_pstate_use_performance) - copy_pid_params(&cpu_def->pid_policy); } if (intel_pstate_msrs_not_valid())