Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The patch changes when poll() reports a SEQPACKET socket readable, but it does not change when sleeping pollers are woken. -- vsock/virtio: wait for EOM before reporting SEQPACKET readable For SEQPACKET sockets, this patch changes virtio_transport_notify_poll_in() to use the completed-message count (msg_count) instead of comparing queued bytes with the SO_RCVLOWAT target. As a result, poll() and epoll no longer report a socket readable when only part of a message has arrived.
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c > index 1e762a480df49..d659986bb48b0 100644 > --- a/net/vmw_vsock/virtio_transport_common.c > +++ b/net/vmw_vsock/virtio_transport_common.c > @@ -1107,7 +1107,11 @@ virtio_transport_notify_poll_in(struct vsock_sock *vsk, > size_t target, > bool *data_ready_now) > { > - *data_ready_now = vsock_stream_has_data(vsk) >= target; > + /* A SEQPACKET message is readable only after its EOM packet arrives. */ > + if (sk_vsock(vsk)->sk_type == SOCK_SEQPACKET) > + *data_ready_now = virtio_transport_seqpacket_has_data(vsk) != 0;
[Severity: Medium] This changes when poll() reports a SEQPACKET socket readable. Should the wakeup side change as well? For virtio, vhost and loopback, the RX wakeup comes from virtio_transport_recv_connected() calling vsock_data_ready(). That happens after virtio_transport_recv_enqueue() has done msg_count++ for an EOM packet. vsock_data_ready() still uses the byte count and rcvlowat test: net/vmw_vsock/af_vsock.c:vsock_data_ready() { ... if (vsock_stream_has_data(vsk) >= sk->sk_rcvlowat || sock_flag(sk, SOCK_DONE)) sk->sk_data_ready(sk); } So msg_count can go from 0 to 1, which makes poll() readable under the new rule, without any wakeup being sent. A couple of ways this can happen: - Userspace sets SO_RCVLOWAT to, say, 4096 on a SEQPACKET socket and sleeps in poll(), select() or epoll_wait(). The peer then sends a complete 100 byte message. poll() with a zero timeout now returns EPOLLIN, but rx_bytes is 100, which is less than 4096. The sleeping waiter is not woken until its timeout expires, more data arrives, or the peer shuts down. Edge-triggered epoll never sees the transition. - With the default rcvlowat of 1, a peer sends a zero-length OP_RW packet with VIRTIO_VSOCK_SEQ_EOM into an empty queue. msg_count is incremented and rx_bytes stays at 0, so poll() reports readable but no wakeup is sent. Linux senders skip zero-length OP_RW packets in virtio_transport_send_pkt_info(), so this needs a non-Linux or modified peer. Before this patch, poll readiness and the wakeup used the same rx_bytes >= rcvlowat test, so they always agreed. The commit message says: "SO_RCVLOWAT no longer affects SEQPACKET poll." Isn't that only true for a non-sleeping poll? A sleeping poller is still woken based on SO_RCVLOWAT. Would it make sense to make vsock_data_ready() SEQPACKET-aware too? For example, it could use the existing vsock_connectible_has_data() helper, which already returns seqpacket_has_data() for SOCK_SEQPACKET. Another option is to always wake for SEQPACKET once a message is complete.
> + else > + *data_ready_now = vsock_stream_has_data(vsk) >= target; > > return 0; > }
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40stellman-greene.com