From: sashiko-bot@kernel.org
To: "Simon Schippers" <simon.schippers@tu-dortmund.de>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH net-next v14 2/5] tun/tap: add ptr_ring consume helper with netdev queue wakeup
Date: Wed, 05 Aug 2026 01:57:35 +0000 [thread overview]
Message-ID: <20260805015736.3A8021F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260803183641.96882-3-simon.schippers@tu-dortmund.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] vhost-net bypasses `tun_ring_consume()`, causing permanent TX queue stalls when `IFF_BACKPRESSURE` is used.
--
--- Patch [2]: [PATCH net-next v14 2/5] tun/tap: add ptr_ring consume helper with netdev queue wakeup ---
commit 751c5819e676787b1b9d745ec0ad8353ee77415e
Author: Simon Schippers <simon.schippers@tu-dortmund.de>
tun/tap: add ptr_ring consume helper with netdev queue wakeup
This commit introduces tun_ring_consume() that wraps ptr_ring_consume() and
calls __tun_wake_queue(). The queue is woken up when the ring is half empty
or entirely empty to support traffic shaping with IFF_BACKPRESSURE.
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 51e80000bd0ed..d49b6bfd104db 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
[ ... ]
> @@ -2116,13 +2171,61 @@ static ssize_t tun_put_user(struct tun_struct *tun,
[ ... ]
> +static void *tun_ring_consume(struct tun_struct *tun, struct tun_file *tfile)
> +{
> + void *ptr;
> +
> + spin_lock(&tfile->tx_ring.consumer_lock);
> + ptr = __ptr_ring_consume(&tfile->tx_ring);
> + if (ptr)
> + __tun_wake_queue(tun, tfile, 1);
> +
> + spin_unlock(&tfile->tx_ring.consumer_lock);
> + return ptr;
> +}
[Severity: Medium]
Will vhost-net bypass this wrapper and cause permanent TX queue stalls when
IFF_BACKPRESSURE is enabled?
Looking at vhost_net_buf_produce() in drivers/vhost/net.c, vhost-net consumes
packets directly from the tun ring:
drivers/vhost/net.c:vhost_net_buf_produce() {
...
rxq->tail = ptr_ring_consume_batched(nvq->rx_ring, rxq->queue,
VHOST_NET_BATCH);
...
}
Because vhost-net uses ptr_ring_consume_batched() directly, it bypasses
tun_ring_consume() and prevents __tun_wake_queue() from being called. This
leaves the stopped netdev queue permanently stalled.
While IFF_BACKPRESSURE is currently masked out of TUN_FEATURES in this commit
(meaning it cannot be triggered by userspace today), this structural flaw in
the backpressure design will trigger unconditionally once the feature flag is
fully enabled.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803183641.96882-1-simon.schippers@tu-dortmund.de?part=2
next prev parent reply other threads:[~2026-08-05 1:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 18:36 [PATCH net-next v14 0/5] tun/tap & vhost-net: apply qdisc backpressure on full ptr_ring to reduce TX drops Simon Schippers
2026-08-03 18:36 ` [PATCH net-next v14 1/5] tun/tap: add IFF_BACKPRESSURE flag Simon Schippers
2026-08-05 1:57 ` sashiko-bot
2026-08-03 18:36 ` [PATCH net-next v14 2/5] tun/tap: add ptr_ring consume helper with netdev queue wakeup Simon Schippers
2026-08-05 1:57 ` sashiko-bot [this message]
2026-08-03 18:36 ` [PATCH net-next v14 3/5] vhost-net: wake queue of tun/tap after ptr_ring consume Simon Schippers
2026-08-03 18:36 ` [PATCH net-next v14 4/5] ptr_ring: move free-space check into separate helper Simon Schippers
2026-08-05 1:57 ` sashiko-bot
2026-08-03 18:36 ` [PATCH net-next v14 5/5] tun/tap & vhost-net: stop tail-drop when IFF_BACKPRESSURE is set Simon Schippers
2026-08-05 5:20 ` [PATCH net-next v14 0/5] tun/tap & vhost-net: apply qdisc backpressure on full ptr_ring to reduce TX drops Simon Schippers
2026-08-08 1:10 ` patchwork-bot+netdevbpf
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=20260805015736.3A8021F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simon.schippers@tu-dortmund.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.