[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jPkP4Nu2zbWuCGCtiBMQcnfaAOdm-GW1KX81GsyV_Cdg@mail.gmail.com>
Date: Thu, 14 Nov 2019 09:40:30 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Rafael Wysocki <rjw@...ysocki.net>,
Linux PM <linux-pm@...r.kernel.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Amit Kucheria <amit.kucheria@...aro.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] cpufreq: Register cpufreq drivers only after CPU devices
are registered
On Thu, Nov 14, 2019 at 4:36 AM Viresh Kumar <viresh.kumar@...aro.org> wrote:
>
> The cpufreq core heavily depends on the availability of the struct
> device for CPUs and if they aren't available at the time cpufreq driver
> is registered, we will never succeed in making cpufreq work.
>
> This happens due to following sequence of events:
>
> - cpufreq_register_driver()
> - subsys_interface_register()
> - return 0; //successful registration of driver
>
> ... at a later point of time
>
> - register_cpu();
> - device_register();
> - bus_probe_device();
> - sif->add_dev();
> - cpufreq_add_dev();
> - get_cpu_device(); //FAILS
> - per_cpu(cpu_sys_devices, num) = &cpu->dev; //used by get_cpu_device()
> - return 0; //CPU registered successfully
>
> Because the per-cpu variable cpu_sys_devices is set only after the CPU
> device is regsitered, cpufreq will never be able to get it when
> cpufreq_add_dev() is called.
>
> This patch avoids this failure by making sure device structure of at
> least CPU0 is available when the cpufreq driver is registered, else
> return -EPROBE_DEFER.
>
> Reported-by: Bjorn Andersson <bjorn.andersson@...aro.org>
> Signed-off-by: Amit Kucheria <amit.kucheria@...aro.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> ---
> @Amit: I have added your sob without asking as you were involved in
> getting us to this patch, you did a lot of testing yesterday to find the
> root cause.
Co-developed-by is for that, so I used it in the commit.
> @Rafael: This fixes the issues reported by Bjorn on Amit's series and so
> should land before Amit's series, if at all this is acceptable to you.
Well, yes it is.
Applied for 5.5 with a reworded subject, thanks!
Powered by blists - more mailing lists