[syslinux] Domain-specific HLT when idle

H. Peter Anvin hpa at zytor.com
Sun May 3 00:05:00 PDT 2009


Peter Iannucci wrote:
> One improvement might be enabling interrupts for the serial port.

No.  Therein lie madness.

The problem is that there is no reliable way to know *which* interrupt
the serial port is coming in on -- the original PC BIOS didn't use
interrupts for serial ports (which made the BIOS useless for serial
ports); as a result it doesn't track the serial port interrupts at all.
 This is quite unfortunate.  One could even go so far as to say that it
doesn't matter, all we care about is lifting it out of HLT, but even
there there are dragons -- first of all, BIOS is *supposed* to point
each IRQ vector to an IRET, but trusting the BIOS to do the right thing
is always dangerous (consider what might happen if the interrupt happens
to be shared with the disk controller, for example), and second of all,
it might still entail mucking with the PIC to unmask the interrupt --
but since you don't know which interrupt it is, you'd have to enable all
of them, which involves additional risks.

Keep in mind that a bootloader lives in a fundamentally rather hostile
enviroment: it *has* to trust the firmware and the legacy hardware, but
bugs lurk absolutely everywhere.

> On scanning through syslinux/core/parseconfig.inc, it looks like the infrastructure for enabling serial IRQ's is already present, but is not being used.  Once these interrupts are enabled, the HLT should take care of both cases fine. 

What gives you that idea?  The FIFO is enabled (to make it less latency
sensitive), but not interrupts.  Not that enabling the interrupt in the
UART is a very hard thing to do -- quite on the contrary -- but the rest
of it (see above) is the part that really worries me.

I have considered simply using HLT except when something is actively
happening (say after a timeout) and let the timer tick act as a poll,
but that really doesn't work as a serial console driven by a script can
easily spew in hundreds of characters in a single timer tick
(reprogramming the timer tick is yet another way to seriously affect
reliability, especially in the presence of "exotic" BIOS extensions like
El Torito or PXE), which would way overflow the hardware FIFO.

Part of the reason I'm asking for your usage model is that for a lot of
the virtualization users, this pretty much has to get into the distro
setups.  Unfortunately, those are the ones that absolutely *have* to
work right, and thus a configuration option isn't really very nice
there.  Also, for those who have followed my work, I really hate having
to rely on "chicken flags" for proper operation.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.




More information about the Syslinux mailing list