Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 do a better job synchronizing %tick...



details:   https://anonhg.NetBSD.org/src/rev/580026be810b
branches:  trunk
changeset: 756849:580026be810b
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Aug 06 00:07:05 2010 +0000

description:
do a better job synchronizing %tick across CPUs
ok'ed by mrg

diffstat:

 sys/arch/sparc64/sparc64/cpu.c |  20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diffs (64 lines):

diff -r 46cc3d9f0284 -r 580026be810b sys/arch/sparc64/sparc64/cpu.c
--- a/sys/arch/sparc64/sparc64/cpu.c    Thu Aug 05 20:44:53 2010 +0000
+++ b/sys/arch/sparc64/sparc64/cpu.c    Fri Aug 06 00:07:05 2010 +0000
@@ -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();
 }



Home | Main Index | Thread Index | Old Index