During vhost-user device initialization, UDP datagrams may arrive on
listening sockets before the guest has enabled the RX virtqueue.
When this happens, udp_vu_sock_recv() returns 0 without consuming
the datagram from the socket. The caller, udp_sock_fwd(), uses a
while loop with udp_peek_addr() to process pending datagrams. Since
the datagram remains in the socket buffer, udp_peek_addr() keeps
returning data available, causing a busy loop with 100% CPU usage.
Add an early check for virtqueue readiness in udp_vu_sock_to_tap(),
mirroring tcp_vu_data_from_sock(). When the queue is not enabled or
not started, explicitly discard the datagram with recvmsg() and
return. The caller will drain remaining datagrams through repeated
calls.
Fixes: 28997fcb29b5 ("vhost-user: add vhost-user")
Link: https://bugs.passt.top/show_bug.cgi?id=185
Signed-off-by: Laurent Vivier