Skip to content

Commit

Permalink
vsock: Fix CPU util 100% in vhost-device-vsock
Browse files Browse the repository at this point in the history
When communicating with kata-agent (and other sample code)
using vhost-device-vsock, the default EPOLLLT mode causes
the process to continuously attempt to read from the socket.
This results in the vhost-device-vsock process
reaching a CPU utilization of 100%.

Signed-off-by: SU Hang <[email protected]>
  • Loading branch information
SU Hang committed Feb 6, 2025
1 parent 99ec307 commit 2588b27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vhost-device-vsock/src/vsock_conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,14 @@ impl<S: AsRawFd + ReadVolatile + Write + WriteVolatile + IsHybridVsock> VsockCon
if VhostUserVsockThread::epoll_modify(
self.epoll_fd,
self.stream.as_raw_fd(),
epoll::Events::EPOLLIN | epoll::Events::EPOLLOUT,
epoll::Events::EPOLLIN | epoll::Events::EPOLLOUT | epoll::Events::EPOLLET,
)
.is_err()
{
if let Err(e) = VhostUserVsockThread::epoll_register(
self.epoll_fd,
self.stream.as_raw_fd(),
epoll::Events::EPOLLIN | epoll::Events::EPOLLOUT,
epoll::Events::EPOLLIN | epoll::Events::EPOLLOUT | epoll::Events::EPOLLET,
) {
// TODO: let's move this logic out of this func, and handle it properly
error!("epoll_register failed: {:?}, but proceed further.", e);
Expand Down

0 comments on commit 2588b27

Please sign in to comment.