gramineproject / gramine-tdx

A library OS for Linux multi-process applications, with Intel TDX support (experimental)
GNU Lesser General Public License v3.0
19 stars 5 forks source link

[PAL/vm-common] vsock: add guest-side vsock buf management #26

Open dimakuv opened 6 months ago

dimakuv commented 6 months ago

Description of the changes

The guest (our Gramine) should use tx_cnt, peer_fwd_cnt and peer_buf_alloc to calculate the number of bytes currently available in the host buffer, and thus currently possible for Gramine to send on a particular connection (particular virtual socket). Previously, we didn't implement this guest-side buffer space management which could lead to app's select/poll/epoll incorrectly returning POLLOUT events.

This commit fixes this by implementing guest-side buffer space management as outlined by the virtio spec.

How to test this PR?

Actually, Redis and Memcached seem to not use this (i.e., don't perform poll(..., POLLOUT)). So I couldn't really test it, only in my head.


This change is Reviewable