Subject: hardclock(), softclock(), and CLKF_BASEPRI()
To: None <tech-kern@netbsd.org>
From: Charles M. Hannum <root@ihack.net>
List: tech-kern
Date: 05/09/2002 19:28:07
So, I observed that there is/was a bug related to the use of
CLKF_BASEPRI() and the short-circuit calling of softclock() inside
hardclock().

Specifically, on the i386 platform, spllowersoftclock() does NOT
reenable hardclock() interrupts -- they are still blocked by the PIC
interrupt mask.  In this situation, the short-circuiting must NOT
occur, because it will keep hardclock() blocked for the entire time
that softclock() -- and more importantly, any other interrupts that
occur during that call to softclock() -- are running.  This screws up
the interrupt priorities and can, among other things, cause wall time
to be lost.

On i386, therefore, I have wired CLKF_BASEPRI() to 0.  The expense
here is a few instructions every second, and so is not really
significant enough to expend any further energy on.

Port-masters should check whether their ports can correctly implement
spllowersoftclock(), and if not, make the same change to their
respective ports.