Re: [PATCH v3 1/3] cpufreq: add cpufreq_driver_resolve_freq()

From: Steve Muckle
Date: Thu Jul 21 2016 - 19:41:44 EST


On Thu, Jul 21, 2016 at 04:36:48PM -0700, Steve Muckle wrote:
> On Thu, Jul 21, 2016 at 04:30:03PM -0700, Viresh Kumar wrote:
> > On 21-07-16, 16:21, Steve Muckle wrote:
> > > On Thu, Jul 21, 2016 at 01:30:41PM -0700, Viresh Kumar wrote:
> > > > Okay, but in that case shouldn't we do something like this:
> > > >
> > > > unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
> > > > unsigned int target_freq)
> > > > {
> > > > target_freq = clamp_val(target_freq, policy->min, policy->max);
> > > > policy->cached_target_freq = target_freq;
> > > >
> > > > if (cpufreq_driver->target_index) {
> > > > policy->cached_resolved_idx =
> > > > cpufreq_frequency_table_target(policy, target_freq,
> > > > CPUFREQ_RELATION_L);
> > > > return policy->freq_table[policy->cached_resolved_idx].frequency;
> > > > }
> > > >
> > > > if (cpufreq_driver->resolve_freq)
> > > > return cpufreq_driver->resolve_freq(policy, target_freq);
> > > > }
> > >
> > > Thanks for the review.
> > >
> > > My thinking (noted in the commit text) was that the caller of
> > > cpufreq_driver_resolve_freq() would verify that the driver supported the
> > > proper calls before using this API.
> >
> > Okay, but the caller isn't doing that today. Right?
>
> There is no caller yet.

Sorry, of course this is not true.

I'm still of the opinion that modifying the governor (I could fix up
schedutil now) or adding a check in driver init would be better than any
unnecessary logic in the fast path.