On 07/06/2018 06:52, Ben Armstrong wrote:
In Hyper-V we have virtual machines with no PCI and a synthetic interrupt controller - which also has no problems taking advantage of posted interrupts. I do not know what Xen implemented here - however emulation of all these devices is not necessary.
The synthetic interrupt controller is basically "APIC plus fancy stuff for events and timers". It's more emulation, not less, and it's in kernel space. I'm not sure how it's an advantage, even though it's certainly better than Xen. It can perform better than doing the fancy stuff in the guest kernel, but it adds to the attack surface. Devices such as PIC and PIT have complicated logic because of the legacy from 1980s electronics, but they are changed very little and they hardly even have arrays in their code. We can remove them, but they don't pose an appreciable security risk. The big exception would be wrong locking, but QEMU doesn't have that issue because non-performance-critical devices (which most devices are) are placed under a "big QEMU lock". Perhaps it's exactly the simple stuff like the PIC that is a candidate for playing with Rust, showing where we want to go in terms of writing test cases, etc, since they have well-known and unchanging data sheets. Paolo