public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 03/15] powernow-k7: Work when kernel is compiled for SMP
@ 2006-01-04 21:59 Ben Collins
  2006-01-04 22:26 ` Dominik Brodowski
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Collins @ 2006-01-04 21:59 UTC (permalink / raw)
  To: linux-kernel

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.

Signed-off-by: Ben Collins <bcollins@ubuntu.com>

---

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

a1418b50daac86ff02e0d7a4cba6185a452ca393
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
index edcd626..a9c4970 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
@@ -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);
 }
 
-- 
1.0.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 03/15] powernow-k7: Work when kernel is compiled for SMP
  2006-01-04 21:59 [PATCH 03/15] powernow-k7: Work when kernel is compiled for SMP Ben Collins
@ 2006-01-04 22:26 ` Dominik Brodowski
  2006-01-04 22:32   ` Ben Collins
  0 siblings, 1 reply; 4+ messages in thread
From: Dominik Brodowski @ 2006-01-04 22:26 UTC (permalink / raw)
  To: Ben Collins, davej; +Cc: linux-kernel

On Wed, Jan 04, 2006 at 04:59:31PM -0500, Ben Collins wrote:
> 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
>
> Signed-off-by: Ben Collins <bcollins@ubuntu.com>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 03/15] powernow-k7: Work when kernel is compiled for SMP
  2006-01-04 22:26 ` Dominik Brodowski
@ 2006-01-04 22:32   ` Ben Collins
  2006-01-05 22:32     ` Dominik Brodowski
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Collins @ 2006-01-04 22:32 UTC (permalink / raw)
  To: Dominik Brodowski; +Cc: Ben Collins, davej, linux-kernel

On Wed, 2006-01-04 at 23:26 +0100, Dominik Brodowski wrote:
> On Wed, Jan 04, 2006 at 04:59:31PM -0500, Ben Collins wrote:
> > 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
> >
> > Signed-off-by: Ben Collins <bcollins@ubuntu.com>
> 
> 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?

-- 
   Ben Collins <ben.collins@ubuntu.com>
   Developer
   Ubuntu Linux


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 03/15] powernow-k7: Work when kernel is compiled for SMP
  2006-01-04 22:32   ` Ben Collins
@ 2006-01-05 22:32     ` Dominik Brodowski
  0 siblings, 0 replies; 4+ messages in thread
From: Dominik Brodowski @ 2006-01-05 22:32 UTC (permalink / raw)
  To: Ben Collins; +Cc: davej, linux-kernel

On Wed, Jan 04, 2006 at 05:32:06PM -0500, Ben Collins wrote:
> On Wed, 2006-01-04 at 23:26 +0100, Dominik Brodowski wrote:
> > On Wed, Jan 04, 2006 at 04:59:31PM -0500, Ben Collins wrote:
> > > 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
> > >
> > > Signed-off-by: Ben Collins <bcollins@ubuntu.com>
> > 
> > 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-01-05 22:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-04 21:59 [PATCH 03/15] powernow-k7: Work when kernel is compiled for SMP Ben Collins
2006-01-04 22:26 ` Dominik Brodowski
2006-01-04 22:32   ` Ben Collins
2006-01-05 22:32     ` Dominik Brodowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox