From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: gwshan@linux.vnet.ibm.com, netdev@vger.kernel.org,
joel@jms.id.au, yuvali@mellanox.com, benh@kernel.crashing.org
Subject: Re: [PATCH net-next 1/8] net/ncsi: Avoid unused-value build warning from ia64-linux-gcc
Date: Thu, 29 Sep 2016 21:40:39 +1000 [thread overview]
Message-ID: <20160929114039.GA13381@gwshan> (raw)
In-Reply-To: <20160929.015404.76401694814645494.davem@davemloft.net>
On Thu, Sep 29, 2016 at 01:54:04AM -0400, David Miller wrote:
>From: Gavin Shan <gwshan@linux.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
next prev parent reply other threads:[~2016-09-29 11:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 5:03 [PATCH net-next 0/8] net/ncsi: NCSI Improvment and bug fixes Gavin Shan
2016-09-29 5:03 ` [PATCH net-next 1/8] net/ncsi: Avoid unused-value build warning from ia64-linux-gcc Gavin Shan
2016-09-29 5:54 ` David Miller
2016-09-29 11:40 ` Gavin Shan [this message]
2016-09-29 5:03 ` [PATCH net-next 2/8] net/ncsi: Introduce NCSI_RESERVED_CHANNEL Gavin Shan
2016-09-29 5:03 ` [PATCH net-next 3/8] net/ncsi: Don't probe on the reserved channel ID (0x1f) Gavin Shan
2016-09-29 5:03 ` [PATCH net-next 4/8] net/ncsi: Rework request index allocation Gavin Shan
2016-09-29 5:03 ` [PATCH net-next 5/8] net/ncsi: Allow to extend NCSI request properties Gavin Shan
2016-09-29 5:03 ` [PATCH net-next 6/8] net/ncsi: Rework the channel monitoring Gavin Shan
2016-09-29 5:03 ` [PATCH net-next 7/8] net/ncsi: Introduce ncsi_stop_dev() Gavin Shan
2016-09-29 5:03 ` [PATCH net-next 8/8] net/faraday: Stop NCSI device on shutdown Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160929114039.GA13381@gwshan \
--to=gwshan@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=joel@jms.id.au \
--cc=netdev@vger.kernel.org \
--cc=yuvali@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).