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

virtIO fixes #2002

Merged
merged 4 commits into from
Feb 24, 2024
Merged

virtIO fixes #2002

merged 4 commits into from
Feb 24, 2024

Conversation

francescolavra
Copy link
Member

This changeset fixes a few issues on the virtio_net and virtio_blk drivers that have been observed when load-testing mysql running on AWS Firecracker.

Closes #1999.

This change adds a `kick` parameter to the vqmsg_commit_seqno()
function; this parameter specifies whether a virtIO device should
be notified of the new message on the virtqueue. The virtio_net
and virtio_socket drivers have been modified so that their
virtqueues can be refilled with multiple messages at a time (until
there are no free entries), and the `kick` argument is set to true
only for the last message; this allows refilling completely a
virtqueue after a temporary failure to push new messages (e.g.
because of a memory allocation failure), and avoids unnecessary
notifications to the virtIO device, which are costly because they
usually involve a VM exit.
With this change, an RX buffer can be immediately re-sent to the RX
virtqueue when released, instead of being deallocated. This allows
the driver to recover from low-memory conditions which may cause
the virtqueue to become empty (such as when the
virtio_sock_rxq_submit() function fails to push any messages), and
allows avoiding de-allocation and re-allocation (and consequently
re-initialization) of messages that can be re-submitted immediately
to the virtqueue.
When TCP segmentation (or UDP fragmentation) offload features are
enabled, a received packet can be composed of multiple TCP (or UDP)
packets, and thus exceed the size of RX buffers as they are
allocated in the existing code; if RX buffers are not mergeable,
each single buffer must be large enough to hold a received packet,
otherwise the device is unable to copy received packets to the RX
virtqueue.
This change modifies the virtio_net driver initialization code so
that the length of RX buffers is increased (to the maximum value
supported by lwIP) when large buffers are required. This fixes
"Receiving buffer is too small to hold frame of current size" error
messages that have been observed when running Nanos under AWS
Firecracker.

Closes #1999.
When disk reads or writes are triggered under memory pressure, the
kernel may be temporarily unable to allocate virtio_blk requests;
this change makes the virtio_blk driver handle gracefully such
conditions by returing an out-of-memory error status when they
happen, instead of triggering an assertion failure.
@francescolavra francescolavra merged commit 659f598 into master Feb 24, 2024
5 checks passed
@francescolavra francescolavra deleted the fix/virtio branch February 24, 2024 16:25
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

Successfully merging this pull request may close these issues.

Error in Load Testing with MySQL in Firecracker Environment - Buffer Size Issue
1 participant