From owner-p4-projects Mon Aug 26 16:32:15 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EB64137B405; Mon, 26 Aug 2002 16:32:06 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9ECCF37B400 for ; Mon, 26 Aug 2002 16:32:06 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4071D43E6E for ; Mon, 26 Aug 2002 16:32:06 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7QNW6JU048150 for ; Mon, 26 Aug 2002 16:32:06 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7QNW50o048147 for perforce@freebsd.org; Mon, 26 Aug 2002 16:32:05 -0700 (PDT) Date: Mon, 26 Aug 2002 16:32:05 -0700 (PDT) Message-Id: <200208262332.g7QNW50o048147@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm Subject: PERFORCE change 16612 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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