mbox series

[net,v2,0/3] Add missing xdp_do_flush() invocations.

Message ID 20230918153611.165722-1-bigeasy@linutronix.de (mailing list archive)
Headers show
Series Add missing xdp_do_flush() invocations. | expand

Message

Sebastian Andrzej Siewior Sept. 18, 2023, 3:36 p.m. UTC
Hi,

I've been looking at the drivers/ XDP users and noticed that some
XDP_REDIRECT user don't invoke xdp_do_flush() at the end.

v1…v2: https://lore.kernel.org/all/20230908135748.794163-1-bigeasy@linutronix.de
  - Collected tags.
  - Dropped the #4 patch which was touching cpu_map_bpf_prog_run()
    because it is not needed.

Sebastian

Comments

Jesper Dangaard Brouer Sept. 20, 2023, 7:04 a.m. UTC | #1
Hi Sebastian,


On 18/09/2023 17.36, Sebastian Andrzej Siewior wrote:
> Hi,
> 
> I've been looking at the drivers/ XDP users and noticed that some
> XDP_REDIRECT user don't invoke xdp_do_flush() at the end.

I'm wondering if we could detect (and WARN) in the net core e.g.
net_rx_action() that a driver is missing a flush?

The idea could be to check the per CPU (struct) bpf_redirect_info.
Or check (per CPU) dev_flush_list.

If some is worried about performance implications, then we can hide this
under CONFIG_DEBUG_NET.

> v1…v2: https://lore.kernel.org/all/20230908135748.794163-1-bigeasy@linutronix.de
>    - Collected tags.
>    - Dropped the #4 patch which was touching cpu_map_bpf_prog_run()
>      because it is not needed.
> 

For the fixes in this set:

Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>

Thanks for fixing these! - at it can lead to strange to debug cases.
--Jesper
Sebastian Andrzej Siewior Sept. 20, 2023, 7:54 a.m. UTC | #2
On 2023-09-20 09:04:27 [+0200], Jesper Dangaard Brouer wrote:
> Hi Sebastian,

Hi Jesper,

> On 18/09/2023 17.36, Sebastian Andrzej Siewior wrote:
> > Hi,
> > 
> > I've been looking at the drivers/ XDP users and noticed that some
> > XDP_REDIRECT user don't invoke xdp_do_flush() at the end.
> 
> I'm wondering if we could detect (and WARN) in the net core e.g.
> net_rx_action() that a driver is missing a flush?
> 
> The idea could be to check the per CPU (struct) bpf_redirect_info.
> Or check (per CPU) dev_flush_list.
> 
> If some is worried about performance implications, then we can hide this
> under CONFIG_DEBUG_NET.

I had a WARN_ON in mind since the list has to be empty after the
completion of a NAPI callback. Now that you are bringing it up let me
actually do something…

> --Jesper

Sebastian
patchwork-bot+netdevbpf@kernel.org Sept. 21, 2023, 7:40 a.m. UTC | #3
Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Mon, 18 Sep 2023 17:36:08 +0200 you wrote:
> Hi,
> 
> I've been looking at the drivers/ XDP users and noticed that some
> XDP_REDIRECT user don't invoke xdp_do_flush() at the end.
> 
> v1…v2: https://lore.kernel.org/all/20230908135748.794163-1-bigeasy@linutronix.de
>   - Collected tags.
>   - Dropped the #4 patch which was touching cpu_map_bpf_prog_run()
>     because it is not needed.
> 
> [...]

Here is the summary with links:
  - [net,v2,1/3] net: ena: Flush XDP packets on error.
    https://git.kernel.org/netdev/net/c/6f411fb5ca94
  - [net,v2,2/3] bnxt_en: Flush XDP for bnxt_poll_nitroa0()'s NAPI
    https://git.kernel.org/netdev/net/c/edc0140cc3b7
  - [net,v2,3/3] octeontx2-pf: Do xdp_do_flush() after redirects.
    https://git.kernel.org/netdev/net/c/70b2b6892645

You are awesome, thank you!