From owner-p4-projects@FreeBSD.ORG Thu Dec 21 23:55:30 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6764A16A542; Thu, 21 Dec 2006 23:55:30 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 262B016A52F for ; Thu, 21 Dec 2006 23:55:30 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 15A1713C434 for ; Thu, 21 Dec 2006 23:55:30 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kBLNtTf4058868 for ; Thu, 21 Dec 2006 23:55:29 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kBLNtTA5058865 for perforce@freebsd.org; Thu, 21 Dec 2006 23:55:29 GMT (envelope-from marcel@freebsd.org) Date: Thu, 21 Dec 2006 23:55:29 GMT Message-Id: <200612212355.kBLNtTA5058865@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Cc: Subject: PERFORCE change 112045 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Dec 2006 23:55:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=112045 Change 112045 by marcel@marcel_nfs on 2006/12/21 23:55:24 o Flesh out cpu_mp_announce() o Add cpu_mp_unleash() Affected files ... .. //depot/projects/powerpc/sys/powerpc/include/pcpu.h#4 edit .. //depot/projects/powerpc/sys/powerpc/powerpc/mp_machdep.c#7 edit Differences ... ==== //depot/projects/powerpc/sys/powerpc/include/pcpu.h#4 (text+ko) ==== @@ -39,7 +39,8 @@ #define PCPU_MD_FIELDS \ int pc_inside_intr; \ struct pmap *pc_curpmap; /* current pmap */ \ - struct thread *pc_fputhread; /* current fpu user */ \ + struct thread *pc_fputhread; /* current fpu user */ \ + int pc_awake:1; \ register_t pc_tempsave[CPUSAVE_LEN]; \ register_t pc_disisave[CPUSAVE_LEN]; \ register_t pc_dbsave[CPUSAVE_LEN]; ==== //depot/projects/powerpc/sys/powerpc/powerpc/mp_machdep.c#7 (text+ko) ==== @@ -37,6 +37,11 @@ #include +volatile static int ap_awake; +volatile static int ap_spin; + +int mp_ipi_test = 0; + void cpu_mp_setmaxid(void) { @@ -93,9 +98,58 @@ void cpu_mp_announce(void) { + struct pcpu *pc; + int i; + + for (i = 0; i <= mp_maxid; i++) { + pc = pcpu_find(i); + if (pc == NULL) + continue; + printf("cpu%d", i); + if (i == 0) + printf(" (BSP)"); + printf("\n"); + } } static void +cpu_mp_unleash(void *dummy) +{ + struct pcpu *pc; + int cpus; + + if (mp_ncpus <= 1) + return; + + if (mp_ipi_test != 1) + printf("SMP: WARNING: sending of a test IPI failed\n"); + + cpus = 0; + smp_cpus = 0; + SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { + cpus++; + if (pc->pc_awake) + smp_cpus++; + } + + ap_awake = 1; + ap_spin = 0; + + while (ap_awake != smp_cpus) + DELAY(0); + + if (smp_cpus != cpus || cpus != mp_ncpus) { + printf("SMP: %d CPUs found; %d CPUs usable; %d CPUs woken\n", + mp_ncpus, cpus, smp_cpus); + } + + smp_active = 1; + smp_started = 1; +} + +SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); + +static void ipi_send(struct pcpu *pc, int ipi) { } @@ -142,4 +196,3 @@ ipi_send(pcpup, ipi); } -