From: netdev-bot+sashiko@kernel.org
To: physicalmtea@gmail.com
Cc: stefanha@redhat.com, sgarzare@redhat.com, mst@redhat.com,
jasowangio@gmail.com, eperezma@redhat.com,
xuanzhuo@linux.alibaba.com, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, virtualization@lists.linux.dev,
kvm@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 4/4] vsock/virtio: defer RX readable notifications until batch unlock
Date: Wed, 14 Oct 2026 06:33:03 +0000 [thread overview]
Message-ID: <179195958316.434549.14684073562290997454@kernel.org> (raw)
In-Reply-To: <20261013063112.168321-5-physicalmtea@gmail.com>
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 defers sock_def_readable() until after
release_sock() so that a reader is not woken while the RX worker still…
--
vsock/virtio: defer RX readable notifications until batch unlock
This commit records when an RX batch makes a socket readable. It then
calls the saved sock_def_readable() callback once, after the batch
releases the socket lock, instead of calling it per packet. The
original sk_data_ready callback is saved in __vsock_create(), and
batching now also requires sk_data_ready to still match it.
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index d6ebfde880db6..84822d6bfb958 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
[ ... ]
> @@ -1975,6 +1987,10 @@ void virtio_transport_rx_batch_finish(struct virtio_transport_rx_batch *batch)
> vsock_sk(sk)->default_write_space(sk);
>
> release_sock(sk);
> +
> + if (data_ready_pending)
> + vsock_sk(sk)->default_data_ready(sk);
> +
[Severity: Medium]
Do blocking recv() readers still get woken while the worker holds the
socket lock?
virtio_transport_rx_batch_finish() still calls default_write_space()
(sock_def_write_space()) before release_sock(). That function wakes
the same wait queue that sk_sleep(sk) returns:
net/core/sock.c:sock_def_write_space() {
...
if (skwq_has_sleeper(wq))
wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT |
EPOLLWRNORM | EPOLLWRBAND);
...
}
A blocking stream reader uses DEFINE_WAIT(wait) in
__vsock_stream_recvmsg(). It sleeps on that queue through
vsock_connectible_wait_data():
prepare_to_wait(sk_sleep(sk), wait, TASK_INTERRUPTIBLE);
DEFINE_WAIT() uses autoremove_wake_function(), which ignores the
EPOLLOUT key. So the EPOLLOUT wakeup also wakes the reader and removes
it from the queue.
On a socket that mostly receives, tx_cnt - peer_fwd_cnt is about zero.
That means virtio_transport_space_update() reports free credit for
nearly every batch, and virtio_transport_recv_pkt_locked() sets
batch->write_space_pending:
if (space_available) {
if (batch)
batch->write_space_pending = true;
else
sk->sk_write_space(sk);
}
In that case the reader wakes under the lock, calls lock_sock(), and
waits on sk_lock.wq until release_sock(). When the deferred
default_data_ready() runs, no sleeper is left. This looks like the
situation the commit message says the patch avoids:
"Waking a reader at that point can make it immediately wait
for the same lock."
It seems only poll/epoll waiters that filter on EPOLLIN alone would
benefit from the deferral.
The previous patch in the series ("vsock/virtio: coalesce RX
write-space notifications in lock batches") argues that a writer
cannot use new credit until the lock is released. Could the
default_write_space() call move after release_sock() as well? If not,
could the commit message say why write-space stays under the lock and
that blocking readers are not covered?
> sock_put(sk);
> }
> EXPORT_SYMBOL_GPL(virtio_transport_rx_batch_finish);
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261013063112.168321-1-physicalmtea%40gmail.com
prev parent reply other threads:[~2026-10-14 6:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 6:31 [PATCH net-next v3 0/4] vsock/virtio: reduce RX per-packet socket overhead Jia Jia
2026-10-13 6:31 ` [PATCH net-next v3 1/4] vsock/virtio: split socket lookup from locked RX processing Jia Jia
2026-10-13 6:31 ` [PATCH net-next v3 2/4] vsock/virtio: amortize RX socket locking for stream packets Jia Jia
2026-10-14 6:33 ` netdev-bot+sashiko
2026-10-13 6:31 ` [PATCH net-next v3 3/4] vsock/virtio: coalesce RX write-space notifications in lock batches Jia Jia
2026-10-14 6:33 ` netdev-bot+sashiko
2026-10-13 6:31 ` [PATCH net-next v3 4/4] vsock/virtio: defer RX readable notifications until batch unlock Jia Jia
2026-10-14 6:33 ` netdev-bot+sashiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179195958316.434549.14684073562290997454@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=eperezma@redhat.com \
--cc=horms@kernel.org \
--cc=jasowangio@gmail.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=physicalmtea@gmail.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®