Define how Firecracker handles a failed virtio device reset

Abierto
#6,281 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
8/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
linux, rust

Línea de trabajo

This is a design decision, not a code change yet. Start with VirtioDevice::reset() and the reset path in src/vmm/src/devices/virtio/transport/pci/common_config.rs and transport/mmio.rs, and trace what happens to device_status when a reset fails. Done means a maintainer-agreed behaviour for failed resets, with the options and their trade-offs recorded in the issue, before any implementation starts.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Status: Parked

VirtioDevice::reset() can fail only where Firecracker has handed work to something outside its
own synchronous control: an out-of-process vhost-user backend (#6277) or io_uring operations that
are still in flight (#6278). Every other in-tree device returns true unconditionally. We should
decide what Firecracker ought to do in those cases.

What happens today (main on 2026-10-21)

  • PCI: the transport sets device_status at 0 whether or not the reset succeeded
    (common_config.rs). That was a deliberate choice, made when no device implemented
    reset yet and so every reset failed (dcdcd800): the Linux virtio-pci guest driver
    polls device_status until it reads 0 (virtio_pci_modern.c), and nothing would
    ever clear FAILED, so reporting the failure that way would have left the guest stuck in that
    loop and unable to complete a shutdown. This does not follow the specification, though: the
    device must present 0 only once the reset is done (spec), and must not touch
    the queues afterwards (spec), so everything still in flight has to be drained
    before device_status reads 0. Firecracker rejects any subsequent re-initialization instead,
    on the grounds that the device is still active. The missing piece is a vhost-user-blk reset that
    stops the backend (#6277);
    once every device can complete its reset, device_status no longer needs to read 0 before
    the reset is actually done.
  • MMIO: the transport sets FAILED if the reset fails (mmio.rs). The guest never looks —
    once its write of 0 has completed, the Linux MMIO guest driver returns without reading the
    status back (virtio_mmio.c). That is correct for MMIO transport version 2, which
    is the version Firecracker implements (mmio.rs): there the device must finish
    the reset before the driver's write of 0 to device_status has completed, so the driver has
    nothing to wait for. The specification spells this out since a change made after v1.3
    (transport-mmio.tex). Firecracker rejects any subsequent re-initialization here
    as well, since no status transition out of FAILED is valid.

So on either transport the guest treats the reset as complete, tears the device down and reuses the
pages that held the vring and the request buffers. Meanwhile the work Firecracker could not stop —
a vhost-user backend still serving the queue, or an io_uring operation still in flight — may write
into those pages afterwards and corrupt the guest's memory.

Rejecting re-initialization bounds how far the guest can drive the device, but it does nothing about
those writes.

Open questions

Note that the guest is blocked while we handle the reset: the write to device_status traps into
Firecracker and the vCPU does not resume until our handler returns, so whatever we decide to do
happens inside that write. What the guest does not do, at least on MMIO, is check the outcome
afterwards — so we cannot signal the failure and rely on the guest to act on it.

There are at least three failure modes to choose between.

Option What is lost Character
Keep draining the vCPU stays blocked until the device is quiesced silent, potentially indefinite
Give up draining and terminate the microVM the microVM itself deterministic, immediately visible
Give up draining and carry on (today's behaviour) integrity of guest memory probabilistic, silent

Which of these a user would rather have may well depend on their workload, so letting them choose is
itself one of the options, rather than fixing a single behaviour in Firecracker.

It is also worth looking at how other VMMs (e.g. QEMU and Cloud Hypervisor) respond when a device
reset cannot be completed.

Lenguaje dominante
Rust
Estrellas
38.2k
Forks
2.8k
Merge medio
2 d 12 h
PR fusionados (30 d)
59

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firecracker-microvm/firecracker

Todos los issues de firecracker-microvm/firecracker

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.