linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Quentin Perret <qperret@google.com>
Cc: rjw@rjwysocki.net, rafael@kernel.org, arnd@arndb.de,
	mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
	mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	kernel-team@android.com, tkjos@google.com,
	adharmap@codeaurora.org
Subject: Re: [PATCH v2 2/2] cpufreq: Specify default governor on command line
Date: Thu, 25 Jun 2020 17:06:02 +0530	[thread overview]
Message-ID: <20200625113602.z2xrwebd2gngbww3@vireshk-i7> (raw)
In-Reply-To: <20200623142138.209513-3-qperret@google.com>

After your last email (reply to my patch), I noticed a change which
isn't required. :)

On 23-06-20, 15:21, Quentin Perret wrote:
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 0128de3603df..4b1a5c0173cf 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -50,6 +50,9 @@ static LIST_HEAD(cpufreq_governor_list);
>  #define for_each_governor(__governor)				\
>  	list_for_each_entry(__governor, &cpufreq_governor_list, governor_list)
>  
> +static char cpufreq_param_governor[CPUFREQ_NAME_LEN];
> +static struct cpufreq_governor *default_governor;
> +
>  /**
>   * The "cpufreq driver" - the arch- or hardware-dependent low
>   * level driver of CPUFreq support, and its spinlock. This lock
> @@ -1055,7 +1058,6 @@ __weak struct cpufreq_governor *cpufreq_default_governor(void)
>  
>  static int cpufreq_init_policy(struct cpufreq_policy *policy)
>  {
> -	struct cpufreq_governor *def_gov = cpufreq_default_governor();
>  	struct cpufreq_governor *gov = NULL;
>  	unsigned int pol = CPUFREQ_POLICY_UNKNOWN;
>  
> @@ -1065,8 +1067,8 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy)
>  		if (gov) {
>  			pr_debug("Restoring governor %s for cpu %d\n",
>  				 policy->governor->name, policy->cpu);
> -		} else if (def_gov) {
> -			gov = def_gov;
> +		} else if (default_governor) {
> +			gov = default_governor;
>  		} else {
>  			return -ENODATA;
>  		}


> @@ -1074,8 +1076,8 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy)
>  		/* Use the default policy if there is no last_policy. */
>  		if (policy->last_policy) {
>  			pol = policy->last_policy;
> -		} else if (def_gov) {
> -			pol = cpufreq_parse_policy(def_gov->name);
> +		} else if (default_governor) {
> +			pol = cpufreq_parse_policy(default_governor->name);

This change is not right IMO. This part handles the set-policy case,
where there are no governors. Right now this code, for some reasons
unknown to me, forcefully uses the default governor set to indicate
the policy, which is not a great idea in my opinion TBH. This doesn't
and shouldn't care about governor modules and should only be looking
at strings instead of governor pointer.

Rafael, I even think we should remove this code completely and just
rely on what the driver has sent to us. Using the selected governor
for set policy drivers is very confusing and also we shouldn't be
forced to compiling any governor for the set-policy case.

-- 
viresh

  parent reply	other threads:[~2020-06-25 11:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 14:21 [PATCH v2 0/2] cpufreq: Specify the default governor on command line Quentin Perret
2020-06-23 14:21 ` [PATCH v2 1/2] cpufreq: Register governors at core_initcall Quentin Perret
2020-06-23 14:21 ` [PATCH v2 2/2] cpufreq: Specify default governor on command line Quentin Perret
2020-06-24  5:50   ` Viresh Kumar
2020-06-24 12:51     ` Rafael J. Wysocki
2020-06-24 15:32       ` Quentin Perret
2020-06-25  8:50         ` Viresh Kumar
2020-06-25 10:52           ` Rafael J. Wysocki
2020-06-25 11:36   ` Viresh Kumar [this message]
2020-06-25 11:44     ` Rafael J. Wysocki
2020-06-25 11:53       ` Quentin Perret
2020-06-25 13:28         ` Rafael J. Wysocki
2020-06-25 13:49           ` Quentin Perret
2020-06-25 14:08             ` Rafael J. Wysocki
2020-06-26  2:53   ` Viresh Kumar
2020-06-26  8:09     ` Quentin Perret
2020-06-23 17:54 ` [PATCH v2 0/2] cpufreq: Specify the " Doug Smythies
2020-06-23 18:04   ` Quentin Perret
2020-06-24  0:07     ` Doug Smythies

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=20200625113602.z2xrwebd2gngbww3@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=adharmap@codeaurora.org \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=juri.lelli@redhat.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=tkjos@google.com \
    --cc=vincent.guittot@linaro.org \
    /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).