2006-01-04 22:07:48

by Ben Collins

[permalink] [raw]
Subject: [PATCH 03/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.

Signed-off-by: Ben Collins <[email protected]>

---

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


2006-01-04 22:26:42

by Dominik Brodowski

[permalink] [raw]
Subject: Re: [PATCH 03/15] powernow-k7: Work when kernel is compiled for SMP

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 <[email protected]>

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

2006-01-04 22:32:33

by Ben Collins

[permalink] [raw]
Subject: Re: [PATCH 03/15] powernow-k7: Work when kernel is compiled for SMP

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 <[email protected]>
>
> 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 <[email protected]>
Developer
Ubuntu Linux

2006-01-05 22:32:57

by Dominik Brodowski

[permalink] [raw]
Subject: Re: [PATCH 03/15] powernow-k7: Work when kernel is compiled for SMP

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 <[email protected]>
> >
> > 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