On Wed, Dec 09, 2020 at 11:15:02AM +0530, Viresh Kumar wrote: > On 08-12-20, 11:20, Sudeep Holla wrote: > > It is because of per-CPU vs per domain drama here. Imagine a system with > > 4 CPUs which the firmware puts in individual domains while they all are > > in the same perf domain and hence OPP is marked shared in DT. > > > > Since this probe gets called for all the cpus, we need to skip adding > > OPPs for the last 3(add only for 1st one and mark others as shared). > > Okay and this wasn't happening before this series because the firmware > was only returning the current CPU from scmi_get_sharing_cpus() ? > > Is this driver also used for the cases where we have multiple CPUs in > a policy ? Otherwise we won't be required to call > dev_pm_opp_set_sharing_cpus(). > > So I assume that we want to support both the cases here ? >
Yes indeed, completely depends on what granularity firmware provides the performance control. It could be individual CPUs, could be pair of CPUs (or all the threads in the core) or subset of CPUs in the performance domain. The subset could be full set. > > If we attempt to add OPPs on second cpu probe, it *will* shout as duplicate > > OPP as we would have already marked it as shared table with the first cpu. > > Am I missing anything ? I suggested this as Nicola saw OPP duplicate > > warnings when he was hacking up this patch. > > The common stuff (for all the CPUs) is better moved to probe() in this > case, instead of the ->init() callback. Otherwise it will always be > messy. You can initialize the OPP and cpufreq tables in probe() > itself, save the pointer somewhere and then just use it here in > ->init(). > > Also do EM registration from there. > Makes sense. -- Regards, Sudeep