Re: [PATCH 3/3] cpufreq: Always update current frequency before startig governor

From: Viresh Kumar
Date: Tue Mar 22 2016 - 10:42:23 EST


On 22-03-16, 15:33, Rafael J. Wysocki wrote:
> On Tuesday, March 22, 2016 09:00:32 AM Viresh Kumar wrote:

> > Why we did the same in process context earlier? And why it wouldn't be
> > a problem now, when we do it in interrupt context? Will IRQs be
> > disabled here? If so, then will you hit following ?
>
> I'm not sure I'm following.

Sorry about that.

> This is process context too.
>
> Look at the call sites of cpufreq_start_governor() (patch [1/3]):
> - cpufreq_offline() - process context
> - cpufreq_resume() - process context

I somehow thought that this is going to happen in interrupt context. :(

> - cpufreq_set_policy() - process context
> - cpufreq_add_policy_cpu() - process context
>
> Besides, calling cpufreq_governor() from interrupt context wouldn't reall work,
> because that acquires mutexes etc, like in cpufreq_governor_init().
>
> > static void __cpufreq_notify_transition(struct cpufreq_policy *policy,
> > struct cpufreq_freqs *freqs, unsigned int state)
> > {
> > BUG_ON(irqs_disabled());
> >
> > ...
> > }
> >
> > And will calling notifiers from interrupt-context just fine ?
>
> If your question is why the original code doesn't call cpufreq_update_policy()
> directly, I think the reason is because cpufreq_resume() used to be one of the
> syscore ops and *that* would have been run in interrupt context.

Yeah.

Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>

--
viresh