[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20160929114039.GA13381@gwshan>
Date: Thu, 29 Sep 2016 21:40:39 +1000
From: Gavin Shan <gwshan@...ux.vnet.ibm.com>
To: David Miller <davem@...emloft.net>
Cc: gwshan@...ux.vnet.ibm.com, netdev@...r.kernel.org, joel@....id.au,
yuvali@...lanox.com, benh@...nel.crashing.org
Subject: Re: [PATCH net-next 1/8] net/ncsi: Avoid unused-value build warning
from ia64-linux-gcc
On Thu, Sep 29, 2016 at 01:54:04AM -0400, David Miller wrote:
>From: Gavin Shan <gwshan@...ux.vnet.ibm.com>
>Date: Thu, 29 Sep 2016 15:03:08 +1000
>
>> This replaces the atomic access to NCSI channel's state with READ_ONCE()
>> and WRITE_ONCE() to avoid the above build warning. We needn't hold the
>> channel's lock when updating its state as well. No logical changes
>> introduced.
>
>I don't understand this.
>
>If it's important to take the lock for the list add/del, then it must
>be important to make the state change appear atomic wrt. that lock as
>well.
>
>Can parallel threads of control enter these functions which change the
>state? If so, then you need to make the state changes under the lock.
>In fact, you probably have to make the state tests under the locks as
>well.
>
>If not, please explain what prevents it from happening.
>
Dave, thanks for your comments. I think it's occasionally working on
AST2400 and AST2500 platforms. It's reasonable to grab the lock before
fetching or updating the NCSI channel's state. Adding and removing the
channel from the list also need taking the lock as well. I will modify
the code accordingly in next revision.
AST2400/AST2500 has single CPU. The channel's state (and the linked
list) are changed in softirq context (packet Rx handler or timer),
meaning they are not accessed in parallel mode. However, NCSI stack
cannot make assumption to be run on single CPU platforms only. So
yes, we need the lock to protect them.
Thanks,
Gavin
Powered by blists - more mailing lists