Date: Sat, 4 Mar 2006 04:26:53 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 92711 for review Message-ID: <200603040426.k244Qrxh002631@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603040426.k244Qrxh002631>