Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Aug 2002 16:32:05 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 16612 for review
Message-ID:  <200208262332.g7QNW50o048147@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=16612

Change 16612 by peter@peter_mckinley on 2002/08/26 16:31:15

	Activate the clock on all AP's.  Otherwise the only cpu to
	get ticks and statclk is the BSP.  This is kinda gross, but
	is rougly copied from alpha, except they have a self-rearming
	timer.  The two divides here should definately go.  Secondly,
	it should compensate for delays by calculating the time to the
	next tick from when the last tick was supposed to happen.
	Otherwise we will run slow over time.

Affected files ...

.. //depot/projects/ia64/sys/ia64/ia64/clock.c#7 edit
.. //depot/projects/ia64/sys/ia64/ia64/interrupt.c#12 edit
.. //depot/projects/ia64/sys/ia64/ia64/mp_machdep.c#19 edit

Differences ...

==== //depot/projects/ia64/sys/ia64/ia64/clock.c#7 (text+ko) ====


==== //depot/projects/ia64/sys/ia64/ia64/interrupt.c#12 (text+ko) ====

@@ -87,6 +87,7 @@
 
 
 static u_int schedclk2;
+extern u_int64_t itc_frequency;
 
 void
 interrupt(u_int64_t vector, struct trapframe *framep)
@@ -117,11 +118,25 @@
 		intrcnt[INTRCNT_CLOCK]++;
 #endif
 		critical_enter();
-		handleclock(framep);
-
-		/* divide hz (1024) by 8 to get stathz (128) */
-		if((++schedclk2 & 0x7) == 0)
-			statclock((struct clockframe *)framep);
+#ifdef SMP
+		/* Only the BSP runs the real clock */
+		if (PCPU_GET(cpuid) == 0) {
+#endif
+			handleclock(framep);
+			/* divide hz (1024) by 8 to get stathz (128) */
+			if((++schedclk2 & 0x7) == 0)
+				statclock((struct clockframe *)framep);
+#ifdef SMP
+		} else {
+			ia64_set_itm(ia64_get_itc() + (itc_frequency + hz/2) / hz);
+			mtx_lock_spin(&sched_lock);
+			hardclock_process(curthread, TRAPF_USERMODE(framep));
+			if ((schedclk2 & 0x7) == 0)
+				statclock_process(curkse, TRAPF_PC(framep),
+				    TRAPF_USERMODE(framep));
+			mtx_unlock_spin(&sched_lock);
+		}
+#endif
 		critical_exit();
 #ifdef SMP
 	} else if (vector == ipi_vector[IPI_AST]) {

==== //depot/projects/ia64/sys/ia64/ia64/mp_machdep.c#19 (text+ko) ====

@@ -58,6 +58,7 @@
 
 void ia64_ap_startup(void);
 
+extern u_int64_t itc_frequency;
 extern vm_offset_t vhpt_base, vhpt_size;
 
 #define	LID_SAPIC_ID(x)		((int)((x) >> 24) & 0xff)
@@ -116,6 +117,10 @@
 	PCPU_SET(switchticks, ticks);
 
 	mtx_lock_spin(&sched_lock);
+
+	/* kick off the clock on this AP */
+	ia64_set_itm(ia64_get_itc() + (itc_frequency + hz/2) / hz);
+	ia64_set_itv(255);
 	cpu_throw();
 	panic("ia64_ap_startup: cpu_throw() returned");
 }

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208262332.g7QNW50o048147>