firecracker icon indicating copy to clipboard operation
firecracker copied to clipboard

[Feature Request] support for resetting virtio devices

Open cperciva opened this issue 1 year ago • 5 comments

Feature Request

During the FreeBSD boot process, it resets network devices. (Why? Good question.) When running in Firecrackers, this means resetting the vtnet device.

Describe the desired solution

When a status of 0 is written to the virtio device, it should reset.

It looks like the MMIO code in Firecracker gets this right, but it calls a _reset routine for the device and none of the devices have implemented it. As a result, the device is currently entering FAILED state instead.

Describe possible alternatives

FreeBSD's virtio driver doesn't actually notice that the device is in FAILED state, and Firecracker's devices continue to work despite being marked as FAILED -- so everything ends up working except for Firecracker logging warnings of ack virtio features in invalid state 0x8f and update virtio queue in invalid state 0x8f. But this (arguably buggy) behaviour of ignoring that the device has failed could change in the future, so it would be good to avoid having it marked as failed in the first place.

Additional context

Checks

  • [x] Have you searched the Firecracker Issues database for similar requests?
  • [x] Have you read all the existing relevant Firecracker documentation?
  • [x] Have you read and understood Firecracker's core tenets?

cperciva avatar Jul 31 '22 18:07 cperciva

@cperciva can you share your kernel and rootfs so we can reproduce the issue?

alsrdn avatar Aug 08 '22 10:08 alsrdn

@alsrdn Happy to share, but FreeBSD relies on PVH booting (see #3041) so it doesn't work on mainline Firecracker yet. Unless you want to work on virtio reset urgently I'd suggest waiting until I can get PVH support merged to Firecracker (which is next on my to-do list after I finish the outstanding issues on FreeBSD's side).

cperciva avatar Aug 08 '22 18:08 cperciva

Ah yes, that makes sense. Better to wait then.

alsrdn avatar Aug 09 '22 10:08 alsrdn

Waiting on #4073

pb8o avatar Sep 18 '23 09:09 pb8o

I can confirm the same behavior occurs also in NetBSD when bringing up the VirtIO NIC.

iMilnb avatar Jan 11 '24 12:01 iMilnb