Module Name: src Committed By: macallan Date: Fri Aug 6 00:07:06 UTC 2010
Modified Files: src/sys/arch/sparc64/sparc64: cpu.c Log Message: do a better job synchronizing %tick across CPUs ok'ed by mrg To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/arch/sparc64/sparc64/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc64/sparc64/cpu.c diff -u src/sys/arch/sparc64/sparc64/cpu.c:1.96 src/sys/arch/sparc64/sparc64/cpu.c:1.97 --- src/sys/arch/sparc64/sparc64/cpu.c:1.96 Wed Jul 28 21:34:57 2010 +++ src/sys/arch/sparc64/sparc64/cpu.c Fri Aug 6 00:07:05 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.96 2010/07/28 21:34:57 macallan Exp $ */ +/* $NetBSD: cpu.c,v 1.97 2010/08/06 00:07:05 macallan Exp $ */ /* * Copyright (c) 1996 @@ -52,7 +52,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.96 2010/07/28 21:34:57 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.97 2010/08/06 00:07:05 macallan Exp $"); #include "opt_multiprocessor.h" @@ -106,6 +106,8 @@ static void cpu_reset_fpustate(void); +volatile int sync_tick = 0; + /* The CPU configuration driver. */ void cpu_attach(struct device *, struct device *, void *); int cpu_match(struct device *, struct cfdata *, void *); @@ -412,6 +414,8 @@ int i, pstate; struct cpu_info *ci; + sync_tick = 0; + sparc64_ipi_init(); if (boothowto & RB_MD1) { @@ -441,7 +445,13 @@ break; delay(10000); } + + /* synchronize %tick ( to some degree at least ) */ + delay(1000); + sync_tick = 1; + membar_sync(); settick(0); + setpstate(pstate); if (!CPUSET_HAS(cpus_active, ci->ci_index)) @@ -463,7 +473,13 @@ cpu_reset_fpustate(); curlwp = curcpu()->ci_data.cpu_idlelwp; membar_sync(); + + /* wait for the boot CPU to flip the switch */ + while (sync_tick == 0) { + /* we do nothing here */ + } settick(0); + tickintr_establish(PIL_CLOCK, tickintr); spl0(); }