cpumask move patch - RFC

Nathan Lynch nathanl at austin.ibm.com
Fri Aug 6 09:14:24 EST 2004


On Tue, 2004-08-03 at 08:15, R Sharada wrote:
> Hello,
> 	This is part of an attempt to clean up some of the kernel data
> structure initialisations from prom.c and move to later boot code.

+void cpumask_setup()
+{
+       unsigned long ind;
+       struct device_node *np = NULL;
+       int cpuid = 0;
+       unsigned int *reg = NULL;
+       char *statusp = NULL;
+       int *propsize = NULL;

The reg, statusp, and propsize initializations seem unnecessary.

+                       cpuid++;
+               }
+               of_node_put(np);
+               return;

Most of these of_node_put's are superfluous unless there's a chance you
have explicitly broken out of the loop.

+               propsize = (int *)get_property(np, "ibm,ppc-interrupt-server#s", NULL);
+               if (*propsize < 0) {
+                       /* no property.  old hardware has no SMT */
+                       cpu_threads = 1;
+               } else {
+                       /* We have a threaded processor */
+                       cpu_threads = *propsize / sizeof(u32);
+                       if (cpu_threads > 2)
+                       cpu_threads = 1; /* ToDo: panic? */

This is incorrect -- get_property does not return the size of the
property; it stores the size in the third argument.  The return value of
get_property is a pointer to the kernel's copy of the property itself.

While I agree in theory with removing all the cpumask initializations
from prom_hold_cpus, I don't think simply transplanting the mess is the
way to do it.  Wouldn't it be nice to have one loop which works on pmac
and pSeries, SMP and UP, without all those #ifdef's?

Nathan


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/




More information about the Linuxppc64-dev mailing list