Skip to contentSkip to conversation

powernow-k7: Work when kernel is compiled for SMP

PATCH In review Ben Collins 3 participants 4 messages Jan 4, 2006 – Jan 5, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 3/15 powernow-k7: Work when kernel is compiled for SMP

On a UP system with SMP compiled kernel, the powernow-k7 module would not initialize (returned -ENODEV). Not sure why policy->cpu != 0 for UP systems, but since policy->cpu isn't used anywhere, just check for num_cpus in the system, and fail of it's > 1.

---

 arch/i386/kernel/cpu/cpufreq/powernow-k7.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

a1418b50daac86ff02e0d7a4cba6185a452ca393

arch/i386/kernel/cpu/cpufreq/powernow-k7.c +6 -4
index edcd626..a9c4970 100644
@@ -576,9 +576,6 @@ static int __init powernow_cpu_init (str
 	union msr_fidvidstatus fidvidstatus;
 	int result;
 
-	if (policy->cpu != 0)
-		return -ENODEV;
-
 	rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val);
 
 	/* recalibrate cpu_khz */
@@ -664,8 +661,13 @@ static struct cpufreq_driver powernow_dr
 
 static int __init powernow_init (void)
 {
-	if (check_powernow()==0)
+	/* Does not support multi-cpu systems */
+	if (num_online_cpus() != 1 || num_possible_cpus() != 1)
 		return -ENODEV;
+
+	if (check_powernow() == 0)
+		return -ENODEV;
+
 	return cpufreq_register_driver(&powernow_driver);
 }
 
Signature · 1 line
1.0.5
#1 lore raw
Quoted 4 lines · Ben Collins

On a UP system with SMP compiled kernel, the powernow-k7 module would not initialize (returned -ENODEV). Not sure why policy->cpu != 0 for UP

May the smp_processor_id() be != 0 on _true_ UP on SMP? What happens if (using virtual CPU hotplug) the module is modprobe'd with one CPU online, and then the second CPU becomes online later?

Dominik

#2 lore raw
Quoted 9 lines · Dominik Brodowski
Quoted 4 lines · Ben Collins

On a UP system with SMP compiled kernel, the powernow-k7 module would not initialize (returned -ENODEV). Not sure why policy->cpu != 0 for UP

May the smp_processor_id() be != 0 on _true_ UP on SMP? What happens if (using virtual CPU hotplug) the module is modprobe'd with one CPU online, and then the second CPU becomes online later?

That's why there is num_possible_cpus() checked aswell. That's supposed to report possible hotplug cpu's, even if not plugged, correct?

Signature · 3 lines
   Ben Collins <[email protected]>
   Developer
   Ubuntu Linux
#3 lore raw
Quoted 5 lines · Ben Collins
Quoted 4 lines · Dominik Brodowski
Quoted 3 lines · Ben Collins

On a UP system with SMP compiled kernel, the powernow-k7 module would not initialize (returned -ENODEV). Not sure why policy->cpu != 0 for UP

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

May the smp_processor_id() be != 0 on _true_ UP on SMP? What happens if (using virtual CPU hotplug) the module is modprobe'd with one CPU online, and then the second CPU becomes online later?

That's why there is num_possible_cpus() checked aswell. That's supposed to report possible hotplug cpu's, even if not plugged, correct?

Yes, sure. Sorry...

Dominik