From owner-p4-projects@FreeBSD.ORG Sat Mar 4 04:26:55 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 9B59616A423; Sat, 4 Mar 2006 04:26:54 +0000 (GMT) X-Original-To: perforce@freebsd.org 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 3527516A420 for ; Sat, 4 Mar 2006 04:26:54 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id EC58443D48 for ; Sat, 4 Mar 2006 04:26:53 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k244QrKD002634 for ; Sat, 4 Mar 2006 04:26:53 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k244Qrxh002631 for perforce@freebsd.org; Sat, 4 Mar 2006 04:26:53 GMT (envelope-from jhb@freebsd.org) Date: Sat, 4 Mar 2006 04:26:53 GMT Message-Id: <200603040426.k244Qrxh002631@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 92711 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: Sat, 04 Mar 2006 04:26:55 -0000 http://perforce.freebsd.org/chv.cgi?CH=92711 Change 92711 by jhb@jhb_twclab on 2006/03/04 04:26:09 Make my alpha happy with still using the timecounter (either i8254 or rpcc) for cpu_ticks. - Call tc_cpu_ticks() every tc_ticktock() to handle rollover in the timecounter if calcru() isn't called often enough. - Cast tc_counter_mask to uint64_t when updating base to handle the case where tc_counter_mask == ~0u (in which case the unsigned value of ~0u + 1 == 0, and thus base was not being changed on timecounter roll overs). With help from: phk Affected files ... .. //depot/projects/smpng/sys/kern/kern_tc.c#35 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_tc.c#35 (text+ko) ==== @@ -115,6 +115,7 @@ #undef TC_STATS +static uint64_t tc_cpu_ticks(void); static void tc_windup(void); static void cpu_tick_calibrate(int); @@ -759,6 +760,7 @@ return; count = 0; tc_windup(); + (void)tc_cpu_ticks(); if (time_uptime != last_calib && !(time_uptime & 0xf)) { cpu_tick_calibrate(0); last_calib = time_uptime; @@ -797,8 +799,7 @@ static int cpu_tick_variable; static uint64_t cpu_tick_frequency; -static -uint64_t +static uint64_t tc_cpu_ticks(void) { static uint64_t base; @@ -809,7 +810,7 @@ tc = timehands->th_counter; u = tc->tc_get_timecount(tc) & tc->tc_counter_mask; if (u < last) - base += tc->tc_counter_mask + 1; + base += (uint64_t)tc->tc_counter_mask + 1; last = u; return (u + base); }