From owner-freebsd-hackers Mon Dec 10 9: 3:36 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from iguana.aciri.org (iguana.aciri.org [192.150.187.36]) by hub.freebsd.org (Postfix) with ESMTP id 9EBC337B405 for ; Mon, 10 Dec 2001 09:03:32 -0800 (PST) Received: (from rizzo@localhost) by iguana.aciri.org (8.11.3/8.11.1) id fBAH3Wk11569; Mon, 10 Dec 2001 09:03:32 -0800 (PST) (envelope-from rizzo) Date: Mon, 10 Dec 2001 09:03:31 -0800 From: Luigi Rizzo To: hackers@freebsd.org Subject: is anyone seeing stray clock interrupts ? Message-ID: <20011210090331.A11197@iguana.aciri.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.23i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, while doing some timing measurements on our test boxes, i noticed that if I compile a kernel with options HZ=1000 I get a number of stray clock interrupts (i.e. occasionally a clock interrupts comes way before its due time -- other measurements showed that the two "regular" clock interrupts around the stray one have the regular spacing, and the stray one tends to be very close to the previous regular one). A quick way to reveal this behaviour is to add the code below to kern_clock.c, and check the value of sysctl hw.short_ticks every now and then. Irrespective of the amount of other events (e.g. network interrupts), for those values of HZ which give problems (e.g. HZ=1000), the count steadily increases over time, maybe by one every few seconds or faster. For lower values of HZ (eg HZ=100, HZ=200, HZ=400) the count remains stationary (that is, i see the 2-3 events, but those might occur at init time when things are not settled yet). I am seeing the problem on STABLE, both on a set of 750MHz Pentium machines, and on a 486-133 (the "net4501"), and with approximately the same frequency (over time). The Pentiums seems to start having problems between HZ=400 and HZ=500, the net4501 seems to start having trouble at HZ=1000. Any ideas on what could be the cause ? cheers luigi Code to test if you are having short ticks, to be put in src/sys/kern/kern_clock.c: --- before hardclock() --- static u_int32_t short_ticks = 0; SYSCTL_ULONG(_hw, OID_AUTO, short_ticks, CTLFLAG_RW, &short_ticks, 0, "How many short ticks"); --- within hardclock(), near the beginning ------------- { static struct timeval prev_t, t; int delta; microuptime(&t); delta = (t.tv_usec - prev_t.tv_usec) + (t.tv_sec - prev_t.tv_sec)*1000000; if (delta * hz < 500000) short_ticks++; else prev_t = t; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message