firecracker-microvm / firecracker

Secure and fast microVMs for serverless computing.
http://firecracker-microvm.io
Apache License 2.0
26.33k stars 1.83k forks source link

[Feature Request] support for resetting virtio devices #3074

Open cperciva opened 2 years ago

cperciva commented 2 years ago

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

alsrdn commented 2 years ago

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

cperciva commented 2 years ago

@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).

alsrdn commented 2 years ago

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

pb8o commented 1 year ago

Waiting on #4073

iMilnb commented 10 months ago

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