Skip to content

Commit

Permalink
vdev: log waiting of the first vhost-user request
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitrii Iakunin <zeil@nebius.com>
  • Loading branch information
zeil committed Feb 4, 2025
1 parent ac74e30 commit 552c243
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ static void arm_msg_handling_timer(struct vhd_vdev *vdev, int secs)
static void vdev_handle_start(struct vhd_vdev *vdev, uint32_t req,
bool ack_pending)
{
/* detach timer_handler attached right after accept, no-op after the first request */
vhd_detach_io_handler(vdev->timer_handler);

/* do not accept further messages until this one is fully handled */
vhd_detach_io_handler(vdev->conn_handler);

Expand Down Expand Up @@ -1978,9 +1981,13 @@ static int timer_read(void *opaque)

elapsed_time(vdev, &elapsed);

VHD_OBJ_WARN(vdev, "long processing %s (%u): elapsed %jd.%03lds",
vhost_req_name(vdev->req), vdev->req,
(intmax_t)elapsed.tv_sec, elapsed.tv_nsec / NSEC_PER_MSEC);
if (likely(vdev->req != VHOST_USER_NONE)) {
VHD_OBJ_WARN(vdev, "long processing %s (%u): elapsed %jd.%03lds",
vhost_req_name(vdev->req), vdev->req,
(intmax_t)elapsed.tv_sec, elapsed.tv_nsec / NSEC_PER_MSEC);
} else {
VHD_OBJ_WARN(vdev, "Still waiting for a vhost-user request...");
}

return 0;
}
Expand Down Expand Up @@ -2018,8 +2025,6 @@ static int server_read(void *opaque)
if (!timer_handler) {
goto close_timer;
}
/* it only needs to be attached during message handling */
vhd_detach_io_handler(timer_handler);

vhd_detach_io_handler(vdev->listen_handler);

Expand All @@ -2030,6 +2035,9 @@ static int server_read(void *opaque)
vdev->negotiated_features = 0;
vdev->negotiated_protocol_features = 0;
VHD_OBJ_INFO(vdev, "Connection established, sock = %d", connfd);

arm_msg_handling_timer(vdev, MSG_HANDLING_LOG_INTERVAL);

return 0;

close_timer:
Expand Down

0 comments on commit 552c243

Please sign in to comment.