Re: [PATCH net-next v8 4/4] tun/tap & vhost-net: avoid ptr_ring tail-drop when a qdisc is present

From: Michael S. Tsirkin

Date: Thu Apr 16 2026 - 06:52:34 EST


On Thu, Apr 16, 2026 at 10:54:45AM +0200, Simon Schippers wrote:
> To summarize the discussion from my POV:
>
> Open point: __ptr_ring_zero_tail() is only called after
> consuming ring.batch elements.
> 1) Consumer wakes up the producer but the slot is not cleaned.
> --> I disagree, the consumer only wakes after consuming ring.size/2.
> Then __ptr_ring_zero_tail() was called at least once.
> 2) Producer is woken up but see the ring is full, so it need to
> drop the packet.
> --> I disagree, because then NETDEV_TX_BUSY is returned. This is
> noticeable as qdisc requeue and only happens very rarely.
>
> Points I will address:
> - Minor nit on patch 2 by MST.
> - Rebase patch 3 because of commit d748047
> ("ptr_ring: disable KCSAN warnings").
> - Document the pair of the smp_mb__after_atomic() in tun_net_xmit
> with tun_ring_consume().
> - Use 1 ptr_ring spinlock instead of 2 (currently used for consume
> and empty check), not sure how to implement it pretty rn.
> - Run pktgen benchmarks with pg_set SHARED.

Thanks! The plan makes sense to me.

--
MST