Skip to contentSkip to conversation

cpumask: fix powernow-k8: partial revert of 2fdf66b491ac706657946442789ec644cc317e1a

PATCH In review Rusty Russell 3 participants 6 messages Feb 7, 2009 – Feb 9, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 cpumask: fix powernow-k8: partial revert of 2fdf66b491ac706657946442789ec644cc317e1a

Impact: fix powernow-k8 when acpi=off (or other error).

There was a spurious change introduced into powernow-k8 in this patch:
the cause if that we try to "restore" the cpus_allowed we never saved.

See lkml "[PATCH] x86/powernow: fix cpus_allowed brokage when acpi=off" from Yinghai for the bug report.

Cc Mike Travis <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 arch/x86/kernel/cpu/cpufreq/powernow-k8.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +7 -5
@@ -1142,8 +1142,7 @@ static int __cpuinit powernowk8_cpu_init
 	data->cpu = pol->cpu;
 	data->currpstate = HW_PSTATE_INVALID;
 
-	rc = powernow_k8_cpu_init_acpi(data);
-	if (rc) {
+	if (powernow_k8_cpu_init_acpi(data)) {
 		/*
 		 * Use the PSB BIOS structure. This is only availabe on
 		 * an UP version, and is deprecated by AMD.
@@ -1161,17 +1160,20 @@ static int __cpuinit powernowk8_cpu_init
 			       "ACPI maintainers and complain to your BIOS "
 			       "vendor.\n");
 #endif
-			goto err_out;
+			kfree(data);
+			return -ENODEV;
 		}
 		if (pol->cpu != 0) {
 			printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "
 			       "CPU other than CPU0. Complain to your BIOS "
 			       "vendor.\n");
-			goto err_out;
+			kfree(data);
+			return -ENODEV;
 		}
 		rc = find_psb_table(data);
 		if (rc) {
-			goto err_out;
+			kfree(data);
+			return -ENODEV;
 		}
 	}
 
#1 lore raw
Quoted 8 lines · Rusty Russell

Impact: fix powernow-k8 when acpi=off (or other error).

There was a spurious change introduced into powernow-k8 in this patch:
the cause if that we try to "restore" the cpus_allowed we never saved.

See lkml "[PATCH] x86/powernow: fix cpus_allowed brokage when acpi=off" from Yinghai for the bug report.

and

[PATCH] x86/powernow: dont emit warning when acpi=off

Impact: cleanup

remove some wrong warning when acpi is disabled.
and don't call exit_acpi if _PSS is not found.

---
 arch/x86/kernel/cpu/cpufreq/powernow-k8.c |   53 ++++++++++++++++--------------
 1 file changed, 29 insertions(+), 24 deletions(-)
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +29 -24
Index: linux-2.6/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
===================================================================
@@ -1124,6 +1124,7 @@ static int powernowk8_verify(struct cpuf
 static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
 {
 	struct powernow_k8_data *data;
+	int k8_cpu_acpi_inited = 0;
 	cpumask_t oldmask;
 	int rc;
 
@@ -1142,39 +1143,41 @@ static int __cpuinit powernowk8_cpu_init
 	data->cpu = pol->cpu;
 	data->currpstate = HW_PSTATE_INVALID;
 
-	if (powernow_k8_cpu_init_acpi(data)) {
+	if (!powernow_k8_cpu_init_acpi(data)) {
+		 k8_cpu_acpi_inited = 1;
+	} else {
 		/*
 		 * Use the PSB BIOS structure. This is only availabe on
 		 * an UP version, and is deprecated by AMD.
 		 */
 		if (num_online_cpus() != 1) {
+			if (!acpi_disabled) {
 #ifndef CONFIG_ACPI_PROCESSOR
-			printk(KERN_ERR PFX "ACPI Processor support is required "
-			       "for SMP systems but is absent. Please load the "
-			       "ACPI Processor module before starting this "
-			       "driver.\n");
+				printk(KERN_ERR PFX "ACPI Processor support is required "
+				       "for SMP systems but is absent. Please load the "
+				       "ACPI Processor module before starting this "
+				       "driver.\n");
 #else
-			printk(KERN_ERR FW_BUG PFX "Your BIOS does not provide"
-			       " ACPI _PSS objects in a way that Linux "
-			       "understands. Please report this to the Linux "
-			       "ACPI maintainers and complain to your BIOS "
-			       "vendor.\n");
+				printk(KERN_ERR FW_BUG PFX "Your BIOS does not provide"
+				       " ACPI _PSS objects in a way that Linux "
+				       "understands. Please report this to the Linux "
+				       "ACPI maintainers and complain to your BIOS "
+				       "vendor.\n");
 #endif
-			kfree(data);
-			return -ENODEV;
+			}
+			goto early_out;
 		}
 		if (pol->cpu != 0) {
-			printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "
-			       "CPU other than CPU0. Complain to your BIOS "
-			       "vendor.\n");
-			kfree(data);
-			return -ENODEV;
+			if (!acpi_disabled) {
+				printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "
+				       "CPU other than CPU0. Complain to your BIOS "
+				       "vendor.\n");
+			}
+			goto early_out;
 		}
 		rc = find_psb_table(data);
-		if (rc) {
-			kfree(data);
-			return -ENODEV;
-		}
+		if (rc)
+			goto early_out;
 	}
 
 	/* only run on specific CPU from here on */
@@ -1220,7 +1223,8 @@ static int __cpuinit powernowk8_cpu_init
 	/* min/max the cpu is capable of */
 	if (cpufreq_frequency_table_cpuinfo(pol, data->powernow_table)) {
 		printk(KERN_ERR FW_BUG PFX "invalid powernow_table\n");
-		powernow_k8_cpu_exit_acpi(data);
+		if (k8_cpu_acpi_inited)
+			powernow_k8_cpu_exit_acpi(data);
 		kfree(data->powernow_table);
 		kfree(data);
 		return -EINVAL;
@@ -1240,8 +1244,9 @@ static int __cpuinit powernowk8_cpu_init
 
 err_out:
 	set_cpus_allowed_ptr(current, &oldmask);
-	powernow_k8_cpu_exit_acpi(data);
-
+	if (k8_cpu_acpi_inited)
+		powernow_k8_cpu_exit_acpi(data);
+early_out:
 	kfree(data);
 	return -ENODEV;
 }
#2 lore raw
Quoted 6 lines · On Saturday 07 February 2009 18:15:05 Yinghai Lu wrote:
Quoted 5 lines · Rusty Russell

Impact: fix powernow-k8 when acpi=off (or other error).

There was a spurious change introduced into powernow-k8 in this patch:
the cause if that we try to "restore" the cpus_allowed we never saved.

Quoted 7 lines
Quoted 3 lines

See lkml "[PATCH] x86/powernow: fix cpus_allowed brokage when acpi=off" from Yinghai for the bug report.

and

[PATCH] x86/powernow: dont emit warning when acpi=off

To be clear, is this for 2.6.29, or can wait for .30? The three I sent are needed for 2.6.29 I think.

Thanks,
Rusty.

#3 lore raw
Quoted 11 lines · Rusty Russell
Quoted 10 lines · On Saturday 07 February 2009 18:15:05 Yinghai Lu wrote:
Quoted 8 lines · Rusty Russell

Impact: fix powernow-k8 when acpi=off (or other error).

There was a spurious change introduced into powernow-k8 in this patch:
the cause if that we try to "restore" the cpus_allowed we never saved.

See lkml "[PATCH] x86/powernow: fix cpus_allowed brokage when acpi=off" from Yinghai for the bug report.

Quoted 5 lines
Quoted 3 lines

and

[PATCH] x86/powernow: dont emit warning when acpi=off

To be clear, is this for 2.6.29, or can wait for .30?

should be .30. just trival...

Quoted 1 line

The three I sent are needed for 2.6.29 I think.

sure about this one.

YH

#4 lore raw
In reply to Rusty Russell
Quoted 40 lines · Rusty Russell

Impact: fix powernow-k8 when acpi=off (or other error).

There was a spurious change introduced into powernow-k8 in this patch:
the cause if that we try to "restore" the cpus_allowed we never saved.

See lkml "[PATCH] x86/powernow: fix cpus_allowed brokage when acpi=off" from Yinghai for the bug report.

Cc Mike Travis <[email protected]>
Cc Yinghai Lu <[email protected]>
---
 arch/x86/kernel/cpu/cpufreq/powernow-k8.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +3 -3
@@ -1142,8 +1142,7 @@ static int __cpuinit powernowk8_cpu_init
 	data->cpu = pol->cpu;
 	data->currpstate = HW_PSTATE_INVALID;
 
-	rc = powernow_k8_cpu_init_acpi(data);
-	if (rc) {
+	if (powernow_k8_cpu_init_acpi(data)) {
 		/*
 		 * Use the PSB BIOS structure. This is only availabe on
 		 * an UP version, and is deprecated by AMD.
@@ -1161,17 +1160,20 @@ static int __cpuinit powernowk8_cpu_init
 			       "ACPI maintainers and complain to your BIOS "
 			       "vendor.\n");
 #endif
-			goto err_out;
+			kfree(data);
+			return -ENODEV;
 		}
 		if (pol->cpu != 0) {
 			printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "
 			       "CPU other than CPU0. Complain to your BIOS "
 			       "vendor.\n");

arch/x86/kernel/cpu/cpufreq/powernow-k8.c static int __cpuinit powernowk8_cpu_init · line 1177

Quoted 10 lines
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +4 -2
-			goto err_out;
+			kfree(data);
+			return -ENODEV;
 		}
 		rc = find_psb_table(data);
 		if (rc) {
-			goto err_out;
+			kfree(data);
+			return -ENODEV;
 		}

hm, why the 3-way duplication of this pattern:

arch/x86/kernel/cpu/cpufreq/powernow-k8.c static int __cpuinit powernowk8_cpu_init · line 1179

Quoted 2 lines
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +2 -0
+			kfree(data);
+			return -ENODEV;

because it's a straight revert?

Ingo

#5 lore raw
Quoted 11 lines · On Monday 09 February 2009 20:47:23 Ingo Molnar wrote:

arch/x86/kernel/cpu/cpufreq/powernow-k8.c static int __cpuinit powernowk8_cpu_init · line 1165

Quoted 4 lines
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +2 -1
-			goto err_out;
+			kfree(data);
+			return -ENODEV;
 		}

hm, why the 3-way duplication of this pattern:

Review

Quoted 2 lines
(quoted diff) +2 -0
+			kfree(data);
+			return -ENODEV;

because it's a straight revert?

Yep, it reverts the changes to that one file.

Cheers,
Rusty.