Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Dec 2001 09:03:31 -0800
From:      Luigi Rizzo <rizzo@aciri.org>
To:        hackers@freebsd.org
Subject:   is anyone seeing stray clock interrupts ?
Message-ID:  <20011210090331.A11197@iguana.aciri.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011210090331.A11197>