Engineering Notes Octane
The Octane Clock That Lost 24 Seconds at a Time
IRIX on the Octane lost its scheduler tick one 23.9 second Count lap at a time under the host clock. A Count-sample window approximation fixed it, with stated limits.
Without instruction counting, an emulated Octane2 running IRIX 6.5.30 never reached the desktop. The console kept reporting:
hasn't seen a scheduler clock interrupt in 23 seconds
The scheduler tick was going missing, and for a while we couldn’t say why.
This is a run of IRIX on our machine under QEMU’s host clock. It shows what the guest did here. It is not a measurement of an Octane.
A number that is a wrap
This is the wrap from Three Origin 200 Timer Bugs, One Number: a Compare value that Count has already passed waits a full lap. On this Octane2 Count counts at 180 MHz, so a lap is 2^32 / 180 000 000 = 23.86 seconds (arithmetic, not a measurement).
So the question was never “why is the clock slow”. It was “why does a write to Compare land behind Count”.
What was already there
Our model already carried one answer. Under the host clock, a virtual CPU can be held up for milliseconds between two guest instructions that would take cycles on silicon. IRIX resets its tick by writing Count zero and, in the very next instruction, writing Compare a thousand or more ticks ahead. A stall longer than a thousand ticks between those two instructions, about 5.6 microseconds at 180 MHz, leaves Compare behind Count. The existing recovery spots that pair and raises the interrupt anyway.
The launch tooling for the Octane machines had worked around the rest by forcing instruction counting, where the guest clock follows instructions executed and not the host. That worked, but it cost 11 to 14 percent in command-heavy graphics work and ran the guest clock at twice wall speed.
Two rearm shapes, one recovery
With a trace on a wall-clock Octane2 VPro V12 boot, the picture was clearer and less comfortable. The kernel rearmed the tick 16,114 times in 549 seconds of virtual time. Twelve of those rearms crossed their target, two after host stalls of 45 and 61 milliseconds and ten with the 1000-tick minimum after an earlier miss. Each of those armed a full lap. The greeter never appeared in 20 minutes.
The adjacent-write recovery handled none of them, because the guest does not rearm in only one way. We found two forms. One writes Count zero and, eight register instructions later, writes Compare. The other reads Count and, a few instructions later, writes Compare at least a thousand ticks ahead of the value read. Eight instructions is not the next instruction, so the adjacent rule ignores it. The read form is not even a write pair.
The first recovery we tried for the Octane covered only the Count-write form. A run with it reached the greeter, which the unfixed model never did. It still lost six ticks in three minutes, all of them on the read form. A fix that gets further is not a fix that gets all the way.
The window
We made the fix a CPU property, count-sample-window, which only the Octane machines set. With it on, every
guest read or write of Count records the value it saw and the virtual clock at that moment. The next write to
Compare raises the timer interrupt when its target is less than half the counter range ahead of that recorded value
and Count has already reached it. In plain terms: the guest meant to arm a tick a few thousand cycles ahead of a
Count value it had just seen, the host held it up for longer than that, and Count is now past the target. That is
the late arm, and the model turns it into the tick the guest wanted.
Three things keep the window from papering over real behavior. A target behind the latest sample keeps the ordinary strict rule, so the disarms guests really do use still disarm: OpenBSD’s read Count and write Count minus one, and IRIX’s write Count one then Compare zero. An exception, an interrupt entry or a reset closes the window, so a sample taken before the exception is not carried across it. And the SN machines (Origin 2000 and Origin 300) do not set the property at all. Their adjacent rule already removes IRIX’s tick losses there, and nothing shows that IRIX on those machines rearms any other way.
The register-contract test forces the situation without relying on a host stall. It runs under instruction counting at a low rate so that 32 instructions put several thousand Count ticks between the sample and the Compare write, deterministically. Both crossed cases, after a Count write and after a Count read, fail without the window.
The test had a gap. Removing the check that the target is strictly ahead of the sample left every test passing, though a target equal to the sample is a full lap ahead, not a crossed deadline. We added a control case, and it fails on that mutation and passes on the real rule.
What it bought
Run on the wall clock with the window in place, the same disk made 269,114 Compare writes over 1,287 virtual
seconds. The window recovered 5,878 of them. None armed a full lap except the deliberate disarm, and the guest’s
system log held no scheduler warning. The greeter, a root desktop, the Toolchest menu and the atlantis demo
all came up. Guest date stayed within the probe’s precision of about two seconds of host time over ten
minutes. An IRIX install on an Octane with Solid Impact graphics, attempted before the fix on a loaded host, printed 199 of the
warnings and left a kernel image the firmware refused to load. That image was not examined further, so the clock
is not proven to be the cause of it. With the fix the install printed no warnings and booted.
The managed Octane and Octane2 launches no longer force instruction counting, so they run on the host clock.
Limits
This is an approximation and it is labeled as one. It compensates for a host stall. It is not processor behavior.
On silicon the late arm presumably does not happen, because the instructions between the sample and the write take
cycles. [inference] The datasheet infers this from instruction timing and did not measure it.
The model raises the interrupt at the Compare write, where an unstalled processor would not have been late. A guest
that read Count, deliberately waited until Count passed a target and then wrote that target expecting a full lap
would be served early. No supported guest is known to do that, and that is a statement about the guests checked,
not a proof.
We did not retain the traces, so nobody can recount the 16,114 rearms, the twelve crossed ones or the 5,878 recoveries. They are our observations. The clock-drift and frame-rate arithmetic was recomputed from the raw run files and agreed. The drift figures bound the clock to a couple of seconds over ten and nineteen minutes; they do not show it was exact. And only the Octane machines get this treatment.