Skip to contentSkip to conversation

x86/intel_pstate: avoid calling cpufreq_add_cpu() twice

PATCH Superseded Wei Wang 2 participants 3 messages Jun 25, 2015 – Jul 27, 2015

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH v4 4/11 x86/intel_pstate: avoid calling cpufreq_add_cpu() twice

cpufreq_add_cpu() is already called in the hypercall code path (the bottom of set_px_pminfo() and inside cpufreq_cpu_init()). So, we remove the redundant calling here.

v4 changes:
None.

---
 xen/drivers/cpufreq/cpufreq.c | 2 --
 1 file changed, 2 deletions(-)
xen/drivers/cpufreq/cpufreq.c +0 -2
index ab66884..91b6c25 100644
@@ -632,8 +632,6 @@ static struct notifier_block cpu_nfb = {
 
 static int __init cpufreq_presmp_init(void)
 {
-    void *cpu = (void *)(long)smp_processor_id();
-    cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
     register_cpu_notifier(&cpu_nfb);
     return 0;
 }
Signature · 1 line
1.9.1
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 25.06.15 at 13:15, <[email protected]> wrote:

cpufreq_add_cpu() is already called in the hypercall code path (the bottom of set_px_pminfo() and inside cpufreq_cpu_init()). So, we remove the redundant calling here.

While I can see that currently the call is kind of pointless (as it can't do anything useful before Dom0 communicated the data obtained from ACPI), it's still logically correct to call the callback on the BP prior to registering a hook for AP bringup. Otherwise you could (and perhaps should) as well defer the CPU notifier registration.

Otoh now that you're trying to introduce a driver independent of ACPI (and hence initialized at boot time) I wonder why you don't make use of what is here instead of deleting it.

Jan

Quoted 11 lines
xen/drivers/cpufreq/cpufreq.c +0 -2
@@ -632,8 +632,6 @@ static struct notifier_block cpu_nfb = {
 
 static int __init cpufreq_presmp_init(void)
 {
-    void *cpu = (void *)(long)smp_processor_id();
-    cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
     register_cpu_notifier(&cpu_nfb);
     return 0;
 }
#2 lore raw
Quoted 11 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 25.06.15 at 13:15, <[email protected]> wrote:

cpufreq_add_cpu() is already called in the hypercall code path (the bottom of set_px_pminfo() and inside cpufreq_cpu_init()). So, we remove the redundant calling here.

While I can see that currently the call is kind of pointless (as it can't do anything useful before Dom0 communicated the data obtained from ACPI), it's still logically correct to call the callback on the BP prior to registering a hook for AP bringup. Otherwise you could (and perhaps should) as well defer the CPU notifier registration.

Quoted 4 lines

Otoh now that you're trying to introduce a driver independent of ACPI (and hence initialized at boot time) I wonder why you don't make use of what is here instead of deleting it.

Ok, I will roll back to leave cpufreq_presmp_init() there.

Best,
Wei

Quoted 12 lines
Quoted 11 lines
xen/drivers/cpufreq/cpufreq.c +0 -2
@@ -632,8 +632,6 @@ static struct notifier_block cpu_nfb = {
 
 static int __init cpufreq_presmp_init(void)  {
-    void *cpu = (void *)(long)smp_processor_id();
-    cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
     register_cpu_notifier(&cpu_nfb);
     return 0;
 }