Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Sep 2002 18:35:35 -0500 (CDT)
From:      Jonathan R Feldkamp <jrf4772@ksu.edu>
To:        <smp@freebsd.org>
Cc:        <jhb@freebsd.org>
Subject:   RE: For those with P4 SMP problems..
Message-ID:  <Pine.GSO.4.33L.0209201822240.1440-100000@unix1.cc.ksu.edu>

next in thread | raw e-mail | index | archive | help
Ok, my start_ap(...) as it is right now is at the bottom of this file.

I have added to what beemern's work. I set both the physical_cpu and the
logical_cpu from 1 to 8, if you think it is necessary i'll go clear up to
15.  I added a little debugging around the RESETs and STARTUPs just to
see it, and increased the timeout from 5 seconds to 10 seconds.  All of
this had basically no effect.  start_ap(...) is always returning 0 because
mp_ncpus is never being incremented.

So, the CPU is never being started right?  I take it an interrupt of some
kind is supposed increment mp_ncpus?  I greped through all of the code in
/sys/ but couldn't find where it was supposed to happen at.

What do you think is going on?

Thanks for you help,
jon

-- snip from dmesg --

Copyright (c) 1992-2002 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD 4.6.2-RELEASE-p2 #14: Fri Sep 20 18:20:11 CDT 2002
    root@osage.telecom.ksu.edu:/usr/src/sys/compile/OSAGE
Timecounter "i8254"  frequency 1193182 Hz
CPU: Pentium 4 (2192.89-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0xf24  Stepping = 4

Features=0x3febfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,<
b28>,ACC>
real memory  = 536346624 (523776K bytes)
avail memory = 518197248 (506052K bytes)
Programming 24 pins in IOAPIC #0
IOAPIC #0 intpin 2 -> irq 0
Programming 24 pins in IOAPIC #1
Programming 24 pins in IOAPIC #2
CPU_TO_ID of logical_cpu: 1 gives physical_cpu 6
overiding, physical_cpu = 8, logical_cpu = 8
waiting for pending status end (INIT IPI: assert RESET)
done
waiting for pending status end (INIT IPI: deassert RESET)
done
waiting for pending status end (STARTUP IPI)
done
waiting for pending status end (STARTUP IPI {second time})
done
error while waiting for cpu...
AP #1 (PHY# 6) failed!
panic y/n? [y] FreeBSD/SMP: Multiprocessor motherboard
 cpu0 (BSP): apic id:  0, version: 0x00050014, at 0xfee00000
 cpu1 (AP):  apic id:  6, version: 0x00000000, at 0xfee00000
 io0 (APIC): apic id:  2, version: 0x00178020, at 0xfec00000
 io1 (APIC): apic id:  3, version: 0x00178020, at 0xfec80000
 io2 (APIC): apic id:  4, version: 0x00178020, at 0xfec80400
Preloaded elf kernel "kernel" at 0xc0380000.
md0: Malloc disk
Using $PIR table, 17 entries at 0xc00fdeb0

-- end of dmesg snip --




-- snip of mp_machdep.c --
static int
start_ap(int logical_cpu, u_int boot_addr)
{
    int     physical_cpu;
    int     vector;
    int     cpus;
    u_long  icr_lo, icr_hi;

    POSTCODE(START_AP_POST);

    /* get the PHYSICAL APIC ID# */
    physical_cpu = CPU_TO_ID(logical_cpu);

    printf("CPU_TO_ID of logical_cpu: %d gives physical_cpu %d\n",
logical_cpu,physical_cpu);

    /* XXX: override hack divemojo */
    physical_cpu = 8;
    logical_cpu = 8;
    printf("overiding, physical_cpu = %d, logical_cpu = %d\n",
        physical_cpu, logical_cpu);

    /* calculate the vector */
    vector = (boot_addr >> 12) & 0xff;

    /* used as a watchpoint to signal AP startup */
    cpus = mp_ncpus;

    /*
     * first we do an INIT/RESET IPI this INIT IPI might be run, reseting
     * and running the target CPU. OR this INIT IPI might be latched (P5
     * bug), CPU waiting for STARTUP IPI. OR this INIT IPI might be
     * ignored.
     */

    /* setup the address for the target AP */
    icr_hi = lapic.icr_hi & ~APIC_ID_MASK;
    icr_hi |= (physical_cpu << 24);
    lapic.icr_hi = icr_hi;

    /* do an INIT IPI: assert RESET */
    icr_lo = lapic.icr_lo & 0xfff00000;
    lapic.icr_lo = icr_lo | 0x0000c500;

    /* wait for pending status end */
        printf("waiting for pending status end (INIT IPI: assert
RESET)\n");
    while (lapic.icr_lo & APIC_DELSTAT_MASK); /* spin */
        printf("done\n");

    /* do an INIT IPI: deassert RESET */
    lapic.icr_lo = icr_lo | 0x00008500;

    /* wait for pending status end */
    u_sleep(10000);     /* wait ~10mS */
        printf("waiting for pending status end (INIT IPI: deassert
RESET)\n");
    while (lapic.icr_lo & APIC_DELSTAT_MASK); /* spin */
        printf("done\n");

    /*
     * next we do a STARTUP IPI: the previous INIT IPI might still be
     * latched, (P5 bug) this 1st STARTUP would then terminate
     * immediately, and the previously started INIT IPI would continue. OR
     * the previous INIT IPI has already run. and this STARTUP IPI will
     * run. OR the previous INIT IPI was ignored. and this STARTUP IPI
     * will run.
     */

    /* do a STARTUP IPI */
    lapic.icr_lo = icr_lo | 0x00000600 | vector;
        printf("waiting for pending status end (STARTUP IPI)\n");
    while (lapic.icr_lo & APIC_DELSTAT_MASK); /* spin */
        printf("done\n");
    u_sleep(200);       /* wait ~200uS */

    /*
     * finally we do a 2nd STARTUP IPI: this 2nd STARTUP IPI should run IF
     * the previous STARTUP IPI was cancelled by a latched INIT IPI. OR
     * this STARTUP IPI will be ignored, as only ONE STARTUP IPI is
     * recognized after hardware RESET or INIT IPI.
     */

    lapic.icr_lo = icr_lo | 0x00000600 | vector;
        printf("waiting for pending status end (STARTUP IPI {second
time})\n");
    while (lapic.icr_lo & APIC_DELSTAT_MASK);
        printf("done\n");
    u_sleep(200);

    /* wait for it to start */
    set_apic_timer(10000000);/* == 10 seconds */
    while (read_apic_timer())
        if (mp_ncpus > cpus)
            return 1;   /* return SUCCESS */

        printf("error while waiting for cpu...\n");
    return 0;
}

--  end of mp_machdep.c snip --


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.33L.0209201822240.1440-100000>