> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf Of
> Brian Vazquez
> Sent: Thursday, May 1, 2025 10:06 AM
> To: Brian Vazquez <[email protected]>; Nguyen, Anthony L
> <[email protected]>; Kitszel, Przemyslaw
> <[email protected]>; David S. Miller <[email protected]>;
> Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>;
> Paolo Abeni <[email protected]>; [email protected]
> Cc: David Decotigny <[email protected]>; Singhai, Anjali
> <[email protected]>; Samudrala, Sridhar
> <[email protected]>; [email protected];
> [email protected]; Tantilov, Emil S <[email protected]>; Brian
> Vazquez <[email protected]>; Keller, Jacob E <[email protected]>;
> Chittim, Madhu <[email protected]>; Hay, Joshua A
> <[email protected]>; Luigi Rizzo <[email protected]>
> Subject: [Intel-wired-lan] [iwl-net PATCH v3] idpf: fix a race in txq wakeup
> 
> Add a helper function to correctly handle the lockless synchronization when
> the sender needs to block. The paradigm is
> 
>         if (no_resources()) {
>                 stop_queue();
>                 barrier();
>                 if (!no_resources())
>                         restart_queue();
>         }
> 
> netif_subqueue_maybe_stop already handles the paradigm correctly, but the
> code split the check for resources in three parts, the first one
> (descriptors) followed the protocol, but the other two (completions and
> tx_buf) were only doing the first part and so race prone.
> 
> Luckily netif_subqueue_maybe_stop macro already allows you to use a
> function to evaluate the start/stop conditions so the fix only requires the 
> right
> helper function to evaluate all the conditions at once.
> 
> The patch removes idpf_tx_maybe_stop_common since it's no longer needed
> and instead adjusts separately the conditions for singleq and splitq.
> 
> Note that idpf_tx_buf_hw_update doesn't need to check for resources since
> that will be covered in idpf_tx_splitq_frame.
> 
> To reproduce:
> 
> Reduce the threshold for pending completions to increase the chances of
> hitting this pause by changing your kernel:
> 
> drivers/net/ethernet/intel/idpf/idpf_txrx.h
> 
> -#define IDPF_TX_COMPLQ_OVERFLOW_THRESH(txcq)   ((txcq)->desc_count
> >> 1)
> +#define IDPF_TX_COMPLQ_OVERFLOW_THRESH(txcq)   ((txcq)->desc_count
> >> 4)
> 
> Use pktgen to force the host to push small pkts very aggressively:
> 
> ./pktgen_sample02_multiqueue.sh -i eth1 -s 100 -6 -d $IP -m $MAC \
>   -p 10000-10000 -t 16 -n 0 -v -x -c 64
> 
> Fixes: 6818c4d5b3c2 ("idpf: add splitq start_xmit")
> Reviewed-by: Jacob Keller <[email protected]>
> Reviewed-by: Madhu Chittim <[email protected]>
> Signed-off-by: Josh Hay <[email protected]>
> Signed-off-by: Brian Vazquez <[email protected]>
> Signed-off-by: Luigi Rizzo <[email protected]>
> ---
> 2.49.0.967.g6a0df3ecc3-goog

Tested-by: Samuel Salin <[email protected]>

Reply via email to