Engineering Notes Octane
The Octane's Boot Tune and the SCSI Probe That Answered Too Fast
The Octane PROM checked its boot tune before the tune had finished, because the emulated SCSI adapter reported empty target IDs at once instead of after the 250 millisecond selection timeout the PROM programs.
The Octane PROM plays a short tune when it starts, and later checks that the tune has finished. On our emulator the check came 0.75 seconds after the tune began, while it still had well over a second to play, and the PROM reported a failed audio processor. We first blamed the emulator’s clock and patched the audio model to say “finished” early. The real fault was in the SCSI adapter: it reported an empty target ID the instant it was asked, where real hardware waits a quarter of a second for an answer that never comes.
Every run here is the stock Octane PROM on our model, or on iris, another Octane emulator. The timings show what those models did, not what a real Octane does.
A tune, then a check
The PROM starts the tune 0.011 seconds into the run, by handing the RAD audio chip one buffer of 576,512 bytes and telling it to play the buffer once. That takes 2.252 seconds. The PROM does not wait. It carries on with its start-up work, and only afterwards reads the chip’s busy bit, once. If the transfer still looks busy, the PROM reports the audio processor as failed.
Before any of this mattered, our RAD model had to play the tune at all. It accepted only the ring of two small buffers that IRIX uses, and it rejected one of the PROM’s control words and its single play-once buffer, so the tune never started. Once the model took both, the tune played in full and the check printed its failure anyway.
The diagnosis that was wrong
The check depends on how long the PROM’s other start-up work takes, so we looked at time. Without instruction counting, QEMU’s virtual clock follows the host clock, and an emulated machine finishes some work far faster than the real one. That seemed to explain an early check, and we changed the RAD model so that a play-once transfer read as finished from its first read, while the rest of the buffer kept playing.
The check passed, and the change was wrong. The chip’s busy bit stays set while a transfer runs; answering “done” early was a reply shaped to satisfy one guest, and it hid the question of what the PROM had been doing in those 0.75 seconds. We took the change out.
What the PROM was doing
A trace of the SCSI adapters answered it. The Octane has two QLogic ISP1040 controllers, and in each of two initialization passes the PROM programs both of them the same way:
- a selection timeout of 250, which we read as milliseconds
[inference]; - a SCSI bus reset with a delay of 1, which we read as seconds
[inference]; - a retry count of zero.
Then it probes for devices. With a disk at ID 1 on controller 0, the PROM selects the absent IDs 2 and 3 there, and IDs 1 to 15 on controller 1, every one absent, in each pass. The single read of the audio busy bit comes about 0.42 seconds after controller 1’s first-pass probe ends.
An absent target never answers selection. By SCSI-2’s definition of the timeout, a real adapter should wait out the selection timeout the driver programmed, and only then report the target missing. Our ISP1040 model reported it the moment it read the request. Controller 1’s fifteen empty IDs took 0.014 seconds; with a 250 millisecond wait each, they take 3.771 seconds, fifteen times 0.251. The probe was the work that ran too fast, and the check came early because of it.
The unit of the 250 is inferred, not documented. The ISP1040 datasheet we wrote records why: Linux, NetBSD and OpenBSD all default the value to 250, Sun’s manual page for the ISP1040B gives the same property in milliseconds, and SCSI-2 recommends a 250 millisecond selection timeout. No QLogic interface document we hold says so directly.
Two waits, not one
The bus-reset delay was the second thing our model ignored. QLogic’s installation guides say that after resetting the bus, the firmware starts no SCSI activity for the configured number of seconds. The model completed the reset and answered the next command at once.
Iris let us separate the two causes, because the same PROM failed the same check there. These are times from the start of the tune to the check, with a disk on controller 0 and no graphics fitted:
| Change in the iris model | Start of tune to check | Printed failure |
|---|---|---|
| none | 1.418 s | yes |
| selection timeout honoured | 7.605 s | no |
| bus-reset delay honoured | 3.459 s | no |
| both | 7.705 s | no |
Either wait alone moved the check past the 2.252 second tune. Those delays were host-thread sleeps, so the table shows which cause matters, not final timing. With default graphics fitted, the unchanged iris model checked at 2.917 seconds and passed: setting up the graphics board had added enough work to hide the fault.
After the fix
Our ISP1040 model now holds an absent target’s completion for the programmed selection timeout, on the virtual clock, and holds a bus quiet for the programmed delay after a bus reset. Times from the start of the tune to the check:
| Run | Before | After |
|---|---|---|
| QEMU, disk | 0.75 s | 5.04 s |
| QEMU, no disk | 5.6 s | 19.1 s |
| iris, no graphics, disk | 1.42 s | 5.66 s |
Without a disk the check had come after the tune even before the fix, because ten half-second retries on controller 0 filled the gap.
Measured on QEMU after the change, consecutive selections of absent IDs start 251 to 253 milliseconds apart: the 250 millisecond wait, then about 2 milliseconds for the guest to take the completion and issue the next ID. Each walk over the IDs selects 29 of them, and two walks run per boot, the PROM’s and then the kernel’s, so 58 waits.
What a quarter-second costs under instruction counting
With instruction counting, the virtual clock advances 8 nanoseconds per executed instruction, and the PROM polls through each wait without going idle. A 250 millisecond wait then needs about 31 million instructions, which on our host took a median of 0.64 seconds of wall time. Twenty-nine waits cost 18.5 seconds of wall time for 7.23 seconds of guest time. The guest sees the programmed 250 milliseconds either way.
What this does not establish
How long a real Octane takes from the start of its tune to the check has not been measured. What the adapter does with a command that arrives during the bus-reset delay, and whether it posts an event when the delay ends, are not documented; our model parks the command until the delay ends and posts nothing, and the ISP1040 datasheet lists both as model choices.