Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requirements for interrupt abstractions in vm-device #68

Open
alsrdn opened this issue Dec 29, 2021 · 0 comments
Open

Requirements for interrupt abstractions in vm-device #68

alsrdn opened this issue Dec 29, 2021 · 0 comments

Comments

@alsrdn
Copy link

alsrdn commented Dec 29, 2021

I'm opening this issue to start the discussion around adding interrupt abstractions to the vm-device crate.

Motivation

Firecracker is working on adding support for PCI devices which naturally require support for MSI/MSI-X interrupts. CloudHypervisor already has PCI support implemented and has added support for MSI interrupts. Firecracker currently does not support MSI interrupts and uses a very simple model based on irqfds to implement interrupt delivery.

There is a large amount of device code that can be reused and shared across both CloudHypervisor and Firecracker that is not quite interoperable between VMMs today, one of the reasons being that they use different ways to work with interrupts.

Requirements

The goal is to create some abstractions in vm-device that can model the interface for working with interrupts.
This would allow devices to have VMM-independent implementations that can be reused.

Devices should be able to:

  • generate events that signal and interrupt the VM vCPUs
  • configure interrupts based on a pre-defined specification
  • enable/disable interrupt generation
  • mask/unmask interrupts
  • request new interrupts

The VMM should be able to:

  • implement different interrupt mechanisms based on the machine specification
  • manage interrupt sources
  • deliver events generated by the devices to the vCPUs
  • not need device specific knowledge or implementation (apart from standard configuration templates)

General requirements:

  • interrupt events should not depend on the type of hypervisor used by the VM
  • while new interrupt mechanisms rarely get added, the interfaces should allow for future extension and addition of new interrupt types
  • vm-device can hold standard interfaces and templates for common interrupt types (e.g. ISA, INTx, MSI)

Even though the interface will allow VMMs to implement interrupt mechanisms independently, it may be a good idea to also have a reference implementation in vm-device for a common use-case (e.g. KVM in-kernel IRQChip).

Prior work

There have been several PRs to add Interrupt management support to vm-device (#21 and #23).
There is also a different vm-device fork implementing these types of abstractions in the Cloud Hypervisor Github org (cloud-hypervisor#5) and an implementation that Cloud Hypervisor uses (https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/vm-device/src/interrupt/mod.rs).
Crossvm is using a similar interface the Trigger proposal (called Event) and adds functionality around that primitive when needed by sending requests to the hypervisor (e.g. VmIrqRequest) through a Tube (https://chromium.googlesource.com/chromiumos/platform/crosvm/+/refs/heads/main/devices/src/pci/vfio_pci.rs#178).

Next steps

We're working on proposal and a POC in Firecracker to showcase how this interface would work. The proposal is based on the previous work mentioned above and satisfies the requirements listed.
It would be great if we can get more input on the requirements of this interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant