Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752455AbdLNEmo (ORCPT ); Wed, 13 Dec 2017 23:42:44 -0500 Received: from mail-pg0-f54.google.com ([74.125.83.54]:38553 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277AbdLNEmm (ORCPT ); Wed, 13 Dec 2017 23:42:42 -0500 X-Google-Smtp-Source: ACJfBos0Hn4AgEDpudIUEW7d2piVaP1n7T7+Tvv8F3iX8a9dVQmIbrH/MAGAd4zs+Jep+C+bcVd87A== Date: Thu, 14 Dec 2017 10:12:39 +0530 From: Viresh Kumar To: Abhishek Goel , ego@linux.vnet.ibm.com Cc: rjw@rjwysocki.net, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq: powernv: Add support of frequency domain Message-ID: <20171214044239.GU3322@vireshk-i7> References: <20171213081937.16376-1-huntbag@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171213081937.16376-1-huntbag@linux.vnet.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1288 Lines: 42 + Gautham, @Gautham: Can you please help reviewing this one ? On 13-12-17, 13:49, Abhishek Goel wrote: > @@ -693,6 +746,8 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy, > { > struct powernv_smp_call_data freq_data; > unsigned int cur_msec, gpstate_idx; > + cpumask_t temp; > + u32 cpu; > struct global_pstate_info *gpstates = policy->driver_data; > > if (unlikely(rebooting) && new_index != get_nominal_index()) > @@ -761,24 +816,48 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy, > spin_unlock(&gpstates->gpstate_lock); > > /* > - * Use smp_call_function to send IPI and execute the > - * mtspr on target CPU. We could do that without IPI > - * if current CPU is within policy->cpus (core) > + * Use smp_call_function to send IPI and execute the mtspr on CPU. > + * This needs to be done on every core of the policy Why on each CPU ? > */ > - smp_call_function_any(policy->cpus, set_pstate, &freq_data, 1); > + cpumask_copy(&temp, policy->cpus); > + > + while (!cpumask_empty(&temp)) { > + cpu = cpumask_first(&temp); > + smp_call_function_any(cpu_sibling_mask(cpu), > + set_pstate, &freq_data, 1); > + cpumask_andnot(&temp, &temp, cpu_sibling_mask(cpu)); > + } > + > return 0; > } -- viresh