[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220822183041.19637-1-kuniyu@amazon.com>
Date: Mon, 22 Aug 2022 11:30:41 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <kuba@...nel.org>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuni1840@...il.com>,
<kuniyu@...zon.com>, <matthias.tafelmeier@....net>,
<netdev@...r.kernel.org>, <pabeni@...hat.com>
Subject: Re: [PATCH v3 net 02/17] net: Fix data-races around weight_p and dev_weight_[rt]x_bias.
From: Jakub Kicinski <kuba@...nel.org>
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.
Thanks for catching!
procfs doesn't provide locking for writes, so we need a mutex like other
knobs.
> OTOH if there is some locking we shouldn't have to protect weight_p
> here.
Powered by blists - more mailing lists