Re: [PATCH 2/4] staging: octeon: Use DEV_STAT_INC()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 09, 2024 at 05:19:09PM +0800, zhangheng wrote:
> syzbot/KCSAN reported that races happen when multiple CPUs updating
> dev->stats.tx_error concurrently. Adopt SMP safe DEV_STATS_INC() to
> update the dev->stats fields.
> ---
>  drivers/staging/octeon/ethernet-tx.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
> index bbf33b88bb7c..f9c38bf25851 100644
> --- a/drivers/staging/octeon/ethernet-tx.c
> +++ b/drivers/staging/octeon/ethernet-tx.c
> @@ -442,7 +442,7 @@ netdev_tx_t cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
>  	case QUEUE_DROP:
>  		skb->next = to_free_list;
>  		to_free_list = skb;
> -		dev->stats.tx_dropped++;
> +		DEV_STATS_INC(dev, tx_dropped);
>  		break;
>  	case QUEUE_HW:
>  		cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, -1);
> @@ -516,7 +516,7 @@ netdev_tx_t cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
>  	if (unlikely(!work)) {
>  		printk_ratelimited("%s: Failed to allocate a work queue entry\n",
>  				   dev->name);
> -		dev->stats.tx_dropped++;
> +		DEV_STATS_INC(dev, tx_dropped);
>  		dev_kfree_skb_any(skb);
>  		return 0;
>  	}
> @@ -527,7 +527,7 @@ netdev_tx_t cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
>  		printk_ratelimited("%s: Failed to allocate a packet buffer\n",
>  				   dev->name);
>  		cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
> -		dev->stats.tx_dropped++;
> +		DEV_STATS_INC(dev, tx_dropped);
>  		dev_kfree_skb_any(skb);
>  		return 0;
>  	}
> @@ -644,8 +644,8 @@ netdev_tx_t cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
>  	/* Submit the packet to the POW */
>  	cvmx_pow_work_submit(work, work->word1.tag, work->word1.tag_type,
>  			     cvmx_wqe_get_qos(work), cvmx_wqe_get_grp(work));
> -	dev->stats.tx_packets++;
> -	dev->stats.tx_bytes += skb->len;
> +	DEV_STATS_INC(dev, tx_packets);
> +	DEV_STATS_ADD(dev, tx_bytes, skb->len);
>  	dev_consume_skb_any(skb);
>  	return 0;
>  }
> -- 
> 2.45.2
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch does not have a Signed-off-by: line.  Please read the
  kernel file, Documentation/process/submitting-patches.rst and resend
  it after adding that line.  Note, the line needs to be in the body of
  the email, before the patch, not at the bottom of the patch or in the
  email signature.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux