Re: [PATCH net v3] tun/tap & vhost-net: make qdisc backpressure opt-in via IFF_BACKPRESSURE
From: Michael S. Tsirkin
Date: Tue Jul 21 2026 - 11:04:34 EST
On Tue, Jul 21, 2026 at 04:04:33PM +0200, Simon Schippers wrote:
> On 7/14/26 18:50, Simon Schippers wrote:
> > On 7/14/26 15:40, Michael S. Tsirkin wrote:
> >> On Thu, Jul 09, 2026 at 11:55:11AM +0200, Simon Schippers wrote:
> >>> Commit 1d6e569b7d0c ("tun/tap & vhost-net: avoid ptr_ring tail-drop
> >>> when a qdisc is present") did not show a relevant performance regression
> >>> in my testing but on Brett Sheffield's librecast testbed it shows a
> >>> significant performance drop in a IPv6 multicast testcase. The regression
> >>> can be pinpointed when multiple iperf3 TCP threads are sending. For 8
> >>> threads the performance dropped from 13.5 Gbit/s to 9.13 Gbit/s. This is
> >>> the reason why this patch makes the qdisc backpressure behavior opt-in.
> >>>
> >>> One option to accomplish the opt-in would be to set the default qdisc to
> >>> noqueue at init. However this may also break userspace as users might
> >>> have chosen a custom qdisc even though most of the qdiscs did nothing
> >>> for tun/tap in the past due to missing backpressure...
> >>>
> >>> This is the reason why in this patch, the flag IFF_BACKPRESSURE is
> >>> introduced instead which is required to enable the backpressure logic.
> >>> This means the stopping logic in tun_net_xmit() and the waking logic in
> >>> __tun_wake_queue() are skipped if the flag is disabled. Setting
> >>> IFF_BACKPRESSURE makes an attached qdisc effective by stopping the queue
> >>> instead of tail-dropping when the internal ring is full.
> >>>
> >>> To avoid a possible stall due to disabling IFF_BACKPRESSURE, the new
> >>> helper tun_force_wake_queue() is implemented. The helper safely wakes the
> >>> respective netdev queue and resets cons_cnt while the consumer_lock and
> >>> the producer_lock of the ring are held. The helper is run in tun_attach()
> >>> when a queue (re)attaches, in tun_set_iff() for attached tfiles, and
> >>> in tun_queue_resize().
> >>>
> >>> The documentation in tuntap.rst is updated accordingly.
> >>>
> >>> Fixes: 1d6e569b7d0c ("tun/tap & vhost-net: avoid ptr_ring tail-drop when a qdisc is present")
> >>> Reported-by: Brett Sheffield <brett@xxxxxxxxxxxxx>
> >>> Closes: https://lore.kernel.org/netdev/akVnoOYQOrt8k-Gu@xxxxxxxxxxxxxxxxxxxx/T/#u
> >>> Signed-off-by: Simon Schippers <simon.schippers@xxxxxxxxxxxxxx>
> >>
> >>
> >> The patch itself is fine:
> >>
> >> Acked-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> >>
> >> What bothers me is the timing: we
> >> are past freeze and this new interface hasn't been tested
> >> much.
> >>
> >> We can either apply this, or revert the original patch for now
> >> and reapply with this for next.
> >
> > I prefer applying it, but you maintainers must decide that.
> >
>
> Hi,
> just a gentle ping.
> Has there been any decision on this patch?
>
> Thanks!
Hi netdev maintainers. Given there's a perf regression otherwise,
we should either take this or revert the original and reapply
in next.
Thanks!
--
MST