Using Python to investigate EFI and ACPI
Using Python to investigate EFI and ACPI
Posted Sep 3, 2015 5:38 UTC (Thu) by josh (subscriber, #17465)In reply to: Using Python to investigate EFI and ACPI by marcH
Parent article: Using Python to investigate EFI and ACPI
Absolutely. EFI has *significantly* more functionality than DOS ever did.
> "Hard real-time" applications could be another interesting use case for EFI?
The line between "EFI application" and "bare-metal operating system" is quite thin. The main distinction between the two seems to lie in if you call EFI services or implement your own drivers. So sure, you could implement a minimal OS that relied on EFI for some of its core drivers.
However, EFI does have some background processing that can interrupt you, above and beyond the possibility of SMI. You'd want to ExitBootServices() at a minimum, at which point you have to take over a few things.
Posted Sep 3, 2015 8:18 UTC (Thu)
by aleXXX (subscriber, #2742)
[Link] (2 responses)
Posted Sep 3, 2015 17:13 UTC (Thu)
by marcH (subscriber, #57642)
[Link] (1 responses)
"Very simple cases" is all I had in mind. Hardware has become so cheap that dealing with the complexity and unpredictability of a scheduler and preemption is not always worth it. See Arduino as a good and successful example.
For reacting to different events something like select()/poll() / or any kind of non-blocking event loop does the job. Even Java can do stuff like this (not for real-time but for scalability)
This reminds me of this (also successful) product I used to work on. It permanently hogs/hogged (some) CPU cores thanks to Linux' SCHED_FIFO and implements its own event loop with incredibly good real-time properties. This worked surprisingly well considering the kernel was not designed for this and caused almost no problem. I found only this one at the time: https://bugzilla.kernel.org/show_bug.cgi?id=16011
More worrying from a "bare-metal" perspective is Josh's comment about background tasks in EFI, I did not expect that.
Posted Sep 3, 2015 18:36 UTC (Thu)
by josh (subscriber, #17465)
[Link]
EFI has some interrupt processing, including timers. It uses that for things like USB keyboards and drives, or networking support. Also take a look at the calls related to Task Priority Level (TPL).
In theory, all of those should stop when you ExitBootServices(); theoretically EFI drivers could keep doing things as part of runtime services, but they shouldn't, and I haven't seen that in practice.
Using Python to investigate EFI and ACPI
It removes sources of latency coming from the OS, but since there is no RTOS supporting the application, you still have no real-time guarantees.... I mean, except for very simple cases you want something multithreaded or at least reacting to several different events.
E.g. a main loop checking flags triggered from interrupts is not hard-real time.
Using Python to investigate EFI and ACPI
Using Python to investigate EFI and ACPI