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.
Description of the changes
The guest (our Gramine) should use
tx_cnt
,peer_fwd_cnt
andpeer_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