Subject: Re: [PATCH v3 net 02/17] net: Fix data-races around weight_p and dev_weight_[rt]x_bias.

From: Jakub Kicinski <[email-masked]>
Date: Fri, 19 Aug 2022 17:03:01 -0700

On Thu, 18 Aug 2022 11:26:38 -0700 Kuniyuki Iwashima wrote:
> -	dev_rx_weight = weight_p * dev_weight_rx_bias;
> -	dev_tx_weight = weight_p * dev_weight_tx_bias;
> +	WRITE_ONCE(dev_rx_weight,
> +		   READ_ONCE(weight_p) * READ_ONCE(dev_weight_rx_bias));
> +	WRITE_ONCE(dev_tx_weight,
> +		   READ_ONCE(weight_p) * READ_ONCE(dev_weight_tx_bias));

Is there some locking on procfs writes? Otherwise one interrupted write
may get overtaken by another and we'll end up with inconsistent values.
OTOH if there is some locking we shouldn't have to protect weight_p
here.