lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aGKsASYLRO0P5npe@mini-arch>
Date: Mon, 30 Jun 2025 08:23:45 -0700
From: Stanislav Fomichev <stfomichev@...il.com>
To: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Cc: Jason Xing <kerneljasonxing@...il.com>, davem@...emloft.net,
	edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
	bjorn@...nel.org, magnus.karlsson@...el.com,
	jonathan.lemon@...il.com, sdf@...ichev.me, ast@...nel.org,
	daniel@...earbox.net, hawk@...nel.org, john.fastabend@...il.com,
	joe@...a.to, willemdebruijn.kernel@...il.com, bpf@...r.kernel.org,
	netdev@...r.kernel.org, Jason Xing <kernelxing@...cent.com>
Subject: Re: [PATCH net-next v4 1/2] net: xsk: update tx queue consumer
 immediately after transmission

On 06/30, Maciej Fijalkowski wrote:
> On Fri, Jun 27, 2025 at 04:57:44PM +0800, Jason Xing wrote:
> > From: Jason Xing <kernelxing@...cent.com>
> > 
> > For afxdp, the return value of sendto() syscall doesn't reflect how many
> > descs handled in the kernel. One of use cases is that when user-space
> > application tries to know the number of transmitted skbs and then decides
> > if it continues to send, say, is it stopped due to max tx budget?
> > 
> > The following formular can be used after sending to learn how many
> > skbs/descs the kernel takes care of:
> > 
> >   tx_queue.consumers_before - tx_queue.consumers_after
> > 
> > Prior to the current patch, in non-zc mode, the consumer of tx queue is
> > not immediately updated at the end of each sendto syscall when error
> > occurs, which leads to the consumer value out-of-dated from the perspective
> > of user space. So this patch requires store operation to pass the cached
> > value to the shared value to handle the problem.
> > 
> > More than those explicit errors appearing in the while() loop in
> > __xsk_generic_xmit(), there are a few possible error cases that might
> > be neglected in the following call trace:
> > __xsk_generic_xmit()
> >     xskq_cons_peek_desc()
> >         xskq_cons_read_desc()
> > 	    xskq_cons_is_valid_desc()
> > It will also cause the premature exit in the while() loop even if not
> > all the descs are consumed.
> > 
> > Based on the above analysis, using @sent_frame could cover all the possible
> > cases where it might lead to out-of-dated global state of consumer after
> > finishing __xsk_generic_xmit().
> > 
> > The patch also adds a common helper __xsk_tx_release() to keep align
> > with the zc mode usage in xsk_tx_release().
> > 
> > Signed-off-by: Jason Xing <kernelxing@...cent.com>
> 
> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>

Acked-by: Stanislav Fomichev <sdf@...ichev.me>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ