From owner-svn-src-all@FreeBSD.ORG Sun Jul 11 16:47:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E5EA1065677; Sun, 11 Jul 2010 16:47:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43E4D8FC0A; Sun, 11 Jul 2010 16:47:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6BGlkW9033553; Sun, 11 Jul 2010 16:47:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6BGlk0O033551; Sun, 11 Jul 2010 16:47:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201007111647.o6BGlk0O033551@svn.freebsd.org> From: Alexander Motin Date: Sun, 11 Jul 2010 16:47:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209900 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2010 16:47:46 -0000 Author: mav Date: Sun Jul 11 16:47:45 2010 New Revision: 209900 URL: http://svn.freebsd.org/changeset/base/209900 Log: Remove interval validation from cpu_tick_calibrate(). As I found, check was needed at preliminary version of the patch, where number of CPU ticks was divided strictly on 16 seconds. Final code instead uses real interval duration, so precise interval should not be important. Same time aliasing issues around second boundary causes false positives, periodically logging useless "t_delta ... too long/short" messages when HZ set below 256. Modified: head/sys/kern/kern_tc.c Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Sun Jul 11 15:32:20 2010 (r209899) +++ head/sys/kern/kern_tc.c Sun Jul 11 16:47:45 2010 (r209900) @@ -864,43 +864,21 @@ cpu_tick_calibrate(int reset) t_delta = t_this; bintime_sub(&t_delta, &t_last); /* - * Validate that 16 +/- 1/256 seconds passed. - * After division by 16 this gives us a precision of - * roughly 250PPM which is sufficient + * Headroom: + * 2^(64-20) / 16[s] = + * 2^(44) / 16[s] = + * 17.592.186.044.416 / 16 = + * 1.099.511.627.776 [Hz] */ - if (t_delta.sec > 16 || ( - t_delta.sec == 16 && t_delta.frac >= (0x01LL << 56))) { - /* too long */ - if (bootverbose) - printf("t_delta %ju.%016jx too long\n", - (uintmax_t)t_delta.sec, - (uintmax_t)t_delta.frac); - } else if (t_delta.sec < 15 || - (t_delta.sec == 15 && t_delta.frac <= (0xffLL << 56))) { - /* too short */ - if (bootverbose) - printf("t_delta %ju.%016jx too short\n", - (uintmax_t)t_delta.sec, - (uintmax_t)t_delta.frac); - } else { - /* just right */ - /* - * Headroom: - * 2^(64-20) / 16[s] = - * 2^(44) / 16[s] = - * 17.592.186.044.416 / 16 = - * 1.099.511.627.776 [Hz] - */ - divi = t_delta.sec << 20; - divi |= t_delta.frac >> (64 - 20); - c_delta <<= 20; - c_delta /= divi; - if (c_delta > cpu_tick_frequency) { - if (0 && bootverbose) - printf("cpu_tick increased to %ju Hz\n", - c_delta); - cpu_tick_frequency = c_delta; - } + divi = t_delta.sec << 20; + divi |= t_delta.frac >> (64 - 20); + c_delta <<= 20; + c_delta /= divi; + if (c_delta > cpu_tick_frequency) { + if (0 && bootverbose) + printf("cpu_tick increased to %ju Hz\n", + c_delta); + cpu_tick_frequency = c_delta; } } c_last = c_this;