Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: problem on dell r610



After some analysis, it I think the only problem is the
array overflow caused by the large cpuid.
The fact that lapic_cpu_number() is hardwired to 0 is not an issue,
because the hypervisor redefines the target CPU when the
dom0 setups the ioapics.
So I think the correct way to fix this issue on netbsd-5 is the
attached patch (which is the equivalent of cpu.c rev 1.51 for netbsd-5).

Mark, can you give it a try on your system ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: xen/x86/cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/cpu.c,v
retrieving revision 1.28.4.2
diff -u -p -u -r1.28.4.2 cpu.c
--- xen/x86/cpu.c       22 Apr 2010 20:02:49 -0000      1.28.4.2
+++ xen/x86/cpu.c       14 Nov 2010 13:58:26 -0000
@@ -231,26 +231,22 @@ cpu_attach(device_t parent, device_t sel
        struct cpu_softc *sc = device_private(self);
        struct cpu_attach_args *caa = aux;
        struct cpu_info *ci;
-       int cpunum = caa->cpu_number;
+       static int nphycpu = 0;
 
        sc->sc_dev = self;
 
        /*
-        * If we're an Application Processor, allocate a cpu_info
-        * structure, otherwise use the primary's.
+        * If we're the first attached CPU use the primary cpu_info,
+        * otherwise allocate a new one.
         */
-       if (caa->cpu_role == CPU_ROLE_AP) {
+       if (nphycpu > 0) {
                ci = malloc(sizeof(*ci), M_DEVBUF, M_WAITOK | M_ZERO);
                ci->ci_curldt = -1;
-               if (phycpu_info[cpunum] != NULL)
-                       panic("cpu at apic id %d already attached?", cpunum);
-               phycpu_info[cpunum] = ci;
+               if (phycpu_info[nphycpu] != NULL)
+                       panic("cpu%d already attached?", nphycpu);
+               phycpu_info[nphycpu] = ci;
        } else {
                ci = &phycpu_info_primary;
-               if (cpunum != 0) {
-                       phycpu_info[0] = NULL;
-                       phycpu_info[cpunum] = ci;
-               }
        }
 
        ci->ci_self = ci;
@@ -259,29 +255,9 @@ cpu_attach(device_t parent, device_t sel
        ci->ci_dev = self;
        ci->ci_cpuid = caa->cpu_number;
        ci->ci_vcpu = NULL;
+       ci->ci_index = nphycpu++;
 
-       printf(": ");
-       switch (caa->cpu_role) {
-       case CPU_ROLE_SP:
-               printf("(uniprocessor)\n");
-               ci->ci_flags |= CPUF_PRESENT | CPUF_SP | CPUF_PRIMARY;
-               break;
-
-       case CPU_ROLE_BP:
-               printf("(boot processor)\n");
-               ci->ci_flags |= CPUF_PRESENT | CPUF_BSP | CPUF_PRIMARY;
-               break;
-
-       case CPU_ROLE_AP:
-               /*
-                * report on an AP
-                */
-               printf("(application processor)\n");
-               break;
-
-       default:
-               panic("unknown processor type??\n");
-       }
+       printf("\n");
        return;
 #else
        cpu_attach_common(parent, self, aux);


Home | Main Index | Thread Index | Old Index