Bug P2
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: crosvm/crosvm
Branch: main
commit 2a417a0b1b44f30cab05daf94c7c175dd90ec341
Author: Daniel Verkamp <dverkamp@chromium.org>
Date: Tue Nov 28 16:43:48 2023
vmm_vhost: change Connection send API to send_message()
Make the connection API provide a send_message() API instead of
send_iovec(). This moves the responsibility for ensuring all data of a
message is sent into the platform-specific code (SocketConnection and
TubeConnection), which can now use different approaches.
The send_iovec_all() function is moved into the socket code, and the
socket implementation of send_message() now sends all of the data in a
single sendmsg() call. This is acceptable now, since the
Windows-specific requirement for splitting the header and data into
separate sends does not apply to the unix-only socket code.
The tube code now relies on the Tube::send() function to ensure all data
is delivered, removing the send_iovec_all() retry loop from Windows
entirely.
BUG=b:273574299
Change-Id: I9652e4ee3e95bb9ecf700dac93b0d5b806469ab2
Reviewed-on:https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5075018
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
M third_party/vmm_vhost/src/connection.rs
M third_party/vmm_vhost/src/connection/socket.rs
M third_party/vmm_vhost/src/connection/tube.rs
M third_party/vmm_vhost/src/master.rs
https://chromium-review.googlesource.com/5075018
Branch: main
commit 2a417a0b1b44f30cab05daf94c7c175dd90ec341
Author: Daniel Verkamp <dverkamp@chromium.org>
Date: Tue Nov 28 16:43:48 2023
vmm_vhost: change Connection send API to send_message()
Make the connection API provide a send_message() API instead of
send_iovec(). This moves the responsibility for ensuring all data of a
message is sent into the platform-specific code (SocketConnection and
TubeConnection), which can now use different approaches.
The send_iovec_all() function is moved into the socket code, and the
socket implementation of send_message() now sends all of the data in a
single sendmsg() call. This is acceptable now, since the
Windows-specific requirement for splitting the header and data into
separate sends does not apply to the unix-only socket code.
The tube code now relies on the Tube::send() function to ensure all data
is delivered, removing the send_iovec_all() retry loop from Windows
entirely.
BUG=b:273574299
Change-Id: I9652e4ee3e95bb9ecf700dac93b0d5b806469ab2
Reviewed-on:
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
M third_party/vmm_vhost/src/
M third_party/vmm_vhost/src/connection/
M third_party/vmm_vhost/src/connection/
M third_party/vmm_vhost/src/
ap...@google.com <ap...@google.com> #3
Project: chromiumos/platform/crosvm
Branch: chromeos
commit 8ae4282a8186fd5a02b35bb5458bc0c064074076
Author: crosvm-luci-ci-builder <crosvm-luci-ci-builder@crosvm-infra.iam.gserviceaccount.com>
Date: Wed Dec 06 13:00:26 2023
Merge with upstream 2023-12-06
2a417a0b1b vmm_vhost: change Connection send API to send_message()
https://chromium.googlesource.com/crosvm/crosvm/+log/69a9a0e4a08910e5ca3de88ffcaed81ded9f0eb7..2a417a0b1b44f30cab05daf94c7c175dd90ec341
BUG=b:273574299
Change-Id: I6775b296712f241f51ee1625486a74fca272f4f9
https://chromium-review.googlesource.com/5097263
Branch: chromeos
commit 8ae4282a8186fd5a02b35bb5458bc0c064074076
Author: crosvm-luci-ci-builder <crosvm-luci-ci-builder@crosvm-infra.iam.gserviceaccount.com>
Date: Wed Dec 06 13:00:26 2023
Merge with upstream 2023-12-06
2a417a0b1b vmm_vhost: change Connection send API to send_message()
BUG=b:273574299
Change-Id: I6775b296712f241f51ee1625486a74fca272f4f9
Description
On Linux, vhost-user uses
SOCK_STREAM
sockets (as specified by the protocol), which means that message boundaries are not preserved between sender and receiver. However, the current implementation of the vhost-user handler assumes that the whole header and body of a message can be read in onerecv()
call each. Since the socket is set to non-blocking mode, when a full message isn't available, even though the calling code useswait_readable()
to wait for some data to be available, therecv()
function can return EAGAIN rather than completing successfully if not enough data has been received yet.We should improve the vhost-user socket code so that it does not depend on receiving the full header/body at once.
A few options for fixing this, in order from most to least desirable:
async
versions of theUnixStream
functionsrecv()
until all data has been receivedEAGAIN
and retry in a loop until all data has been received (possibly withpoll()
or similar to wait until more data is available)