crosvm/hypervisor/tests
Kaiyi Li 909a54913e hypervisor: test interuptibility on special interrupt window
The interrupt window includes:
* sti
* mov ss

On real x86 processors, after certain instructions(mov ss/pop ss/sti), an interrupt is guaranteed not to be delivered for exactly one instruction, not just an indefinite amount of time.

For mov ss/pop ss, this is architecturally defined so that loading a new stack segment plus stack pointer together can be done atomically (without an interrupt handler running in the middle and using a half-initialized stack address).

For sti, this delay allows the kernel to do sti ret, without an interrupt handler running before we return from the current routine.

However, the virtualization instructions allow the hypervisor to inject interrupts. Therefore, it's the hypervisor/VMM's responsbility to not to deliver an interrupt on an unexpected places on the guest.

This test uses port IO to trigger VMEXIT before and after mov ss or sti, and tests the interruptibility under different occasions. It also tests when the interrupt will be delivered.

TEST=./tools/dev_container cargo nextest run --workspace --profile=default -E 'package(hypervisor) & binary(hypervisor_virtualization) & test(interruptible)'  --retries 0 --no-capture
BUG=b:334055761

Change-Id: Ib800c5e8054b4bcc4b20899d2cea1b113081c0e7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5568137
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Judson Powers <judsonp@google.com>
2024-05-28 16:46:05 +00:00
..
kvm hypervisor: remove kvm crate dependency 2024-05-07 19:55:57 +00:00
dirty_log.rs hypervisor: tests: require windows for haxm 2024-03-08 01:12:21 +00:00
hypervisor_virtualization.rs hypervisor: test interuptibility on special interrupt window 2024-05-28 16:46:05 +00:00
mmio_and_pio.rs Add hypervisor PIO tests. 2024-05-13 19:57:31 +00:00
mmio_fetch_memory.rs Remove target_arch = "x86" checks 2023-08-18 23:36:47 +00:00
read_only_memory.rs hypervisor: tests: require windows for haxm 2024-03-08 01:12:21 +00:00
real_run_addr.rs hypervisor: tests: require windows for haxm 2024-03-08 01:12:21 +00:00
remove_memory.rs hypervisor: tests: require windows for haxm 2024-03-08 01:12:21 +00:00
tsc_offsets.rs hypervisor: x86_64: provide single-MSR get/set APIs 2024-04-09 19:37:24 +00:00