Skip to contentSkip to conversation

cpufreq: skip loading acpi_cpufreq after intel_pstate

PATCH In review Yinghai Lu 2 participants 5 messages Sep 20, 2013 – Sep 26, 2013

Subsystems (2)
lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH 1/1 cpufreq: skip loading acpi_cpufreq after intel_pstate

If the hw support intel_pstate and acpi_cpufreq, intel_pstate will get loaded first.

acpi_cpufreq_init will call acpi_cpufreq_early_init()
and that will allocate perf data and init those perf data in ACPI core, (that will cover all cpus). But later it will free them as cpufreq_register_driver(acpi_cpufreq) will fail as init_pstate is already registered

Use cpufreq_get_current_driver() to check if we can skip the acpi_cpufreq loading.

-v2: update changelog and separate second part to another patch, according
to Viresh.

---
 drivers/cpufreq/acpi-cpufreq.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/cpufreq/acpi-cpufreq.c +4 -0
Index: linux-2.6/drivers/cpufreq/acpi-cpufreq.c
===================================================================
@@ -986,6 +986,10 @@ static int __init acpi_cpufreq_init(void
 {
 	int ret;
 
+	/* don't keep reloading if cpufreq_driver exists */
+	if (cpufreq_get_current_driver())
+		return 0;
+
 	if (acpi_disabled)
 		return 0;
 
author
#1 lore raw
Quoted 26 lines · Yinghai Lu

If the hw support intel_pstate and acpi_cpufreq, intel_pstate will get loaded first.

acpi_cpufreq_init will call acpi_cpufreq_early_init()
and that will allocate perf data and init those perf data in ACPI core, (that will cover all cpus). But later it will free them as cpufreq_register_driver(acpi_cpufreq) will fail as init_pstate is already registered

Use cpufreq_get_current_driver() to check if we can skip the acpi_cpufreq loading.

-v2: update changelog and separate second part to another patch, according
to Viresh.

---
 drivers/cpufreq/acpi-cpufreq.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux-2.6/drivers/cpufreq/acpi-cpufreq.c
===================================================================

drivers/cpufreq/acpi-cpufreq.c static int __init acpi_cpufreq_init(void · line 995

Quoted 10 lines
drivers/cpufreq/acpi-cpufreq.c +4 -0
@@ -986,6 +986,10 @@ static int __init acpi_cpufreq_init(void
 {
        int ret;
 
+       /* don't keep reloading if cpufreq_driver exists */
+       if (cpufreq_get_current_driver())
+               return 0;
+
        if (acpi_disabled)
                return 0;
 

only this one is needed, other one

cpufreq: fix racing between acpi_cpufreq_loading

is not needed.

Thanks

Yinghai

author
#2 lore raw
In reply to Yinghai Lu
Quoted 26 lines · Yinghai Lu

If the hw support intel_pstate and acpi_cpufreq, intel_pstate will get loaded first.

acpi_cpufreq_init will call acpi_cpufreq_early_init()
and that will allocate perf data and init those perf data in ACPI core, (that will cover all cpus). But later it will free them as cpufreq_register_driver(acpi_cpufreq) will fail as init_pstate is already registered

Use cpufreq_get_current_driver() to check if we can skip the acpi_cpufreq loading.

-v2: update changelog and separate second part to another patch, according
to Viresh.

---
 drivers/cpufreq/acpi-cpufreq.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux-2.6/drivers/cpufreq/acpi-cpufreq.c
===================================================================

drivers/cpufreq/acpi-cpufreq.c static int __init acpi_cpufreq_init(void · line 995

Quoted 10 lines
drivers/cpufreq/acpi-cpufreq.c +4 -0
@@ -986,6 +986,10 @@ static int __init acpi_cpufreq_init(void
 {
        int ret;
 
+       /* don't keep reloading if cpufreq_driver exists */
+       if (cpufreq_get_current_driver())
+               return 0;
+
        if (acpi_disabled)
                return 0;
 

Rafael,

can you put this one in acpi tree?

Thanks

Yinghai

maintainer
#3 lore raw
Quoted 1 line · Yinghai Lu

can you put this one in acpi tree?

Its already applied in Rafael's linux-next branch.. Do you want something else?

author
#4 lore raw
Quoted 5 lines · Viresh Kumar
Quoted 1 line · Yinghai Lu

can you put this one in acpi tree?

Its already applied in Rafael's linux-next branch.. Do you want something else?

sorry, I missed that.

I still had that in local patches directory, but looks like quilt is not smart enough and did not report that patch is already applied.

Thanks

Yinghai