From: <netanel@amazon.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: Netanel Belgazal <netanel@amazon.com>, <dwmw@amazon.com>,
<zorik@amazon.com>, <matua@amazon.com>, <saeedb@amazon.com>,
<msw@amazon.com>, <aliguori@amazon.com>, <nafea@amazon.com>,
<evgenys@amazon.com>, <gtzalik@amazon.com>
Subject: [PATCH net V2 6/7] net: ena: fix missing calls to READ_ONCE
Date: Sun, 9 Sep 2018 08:15:25 +0000 [thread overview]
Message-ID: <20180909081526.83979-7-netanel@amazon.com> (raw)
In-Reply-To: <20180909081526.83979-1-netanel@amazon.com>
From: Netanel Belgazal <netanel@amazon.com>
Add READ_ONCE calls where necessary (for example when iterating
over a memory field that gets updated by the hardware).
Signed-off-by: Netanel Belgazal <netanel@amazon.com>
---
drivers/net/ethernet/amazon/ena/ena_com.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
index 17f12c18d225..c37deef3bcf1 100644
--- a/drivers/net/ethernet/amazon/ena/ena_com.c
+++ b/drivers/net/ethernet/amazon/ena/ena_com.c
@@ -459,7 +459,7 @@ static void ena_com_handle_admin_completion(struct ena_com_admin_queue *admin_qu
cqe = &admin_queue->cq.entries[head_masked];
/* Go over all the completions */
- while ((cqe->acq_common_descriptor.flags &
+ while ((READ_ONCE(cqe->acq_common_descriptor.flags) &
ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK) == phase) {
/* Do not read the rest of the completion entry before the
* phase bit was validated
@@ -637,7 +637,7 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
mmiowb();
for (i = 0; i < timeout; i++) {
- if (read_resp->req_id == mmio_read->seq_num)
+ if (READ_ONCE(read_resp->req_id) == mmio_read->seq_num)
break;
udelay(1);
@@ -1796,8 +1796,8 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *dev, void *data)
aenq_common = &aenq_e->aenq_common_desc;
/* Go over all the events */
- while ((aenq_common->flags & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) ==
- phase) {
+ while ((READ_ONCE(aenq_common->flags) &
+ ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) == phase) {
pr_debug("AENQ! Group[%x] Syndrom[%x] timestamp: [%llus]\n",
aenq_common->group, aenq_common->syndrom,
(u64)aenq_common->timestamp_low +
--
2.15.2.AMZN
next prev parent reply other threads:[~2018-09-09 13:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-09 8:15 [PATCH net V2 0/7] bug fixes for ENA Ethernet driver netanel
2018-09-09 8:15 ` [PATCH net V2 1/7] net: ena: fix surprise unplug NULL dereference kernel crash netanel
2018-09-09 8:15 ` [PATCH net V2 2/7] net: ena: fix driver when PAGE_SIZE == 64kB netanel
2018-09-09 8:15 ` [PATCH net V2 3/7] net: ena: fix device destruction to gracefully free resources netanel
2018-09-09 8:15 ` [PATCH net V2 4/7] net: ena: fix potential double ena_destroy_device() netanel
2018-09-09 8:15 ` [PATCH net V2 5/7] net: ena: fix missing lock during device destruction netanel
2018-09-09 8:15 ` netanel [this message]
2018-09-09 8:15 ` [PATCH net V2 7/7] net: ena: fix incorrect usage of memory barriers netanel
2018-09-09 16:41 ` [PATCH net V2 0/7] bug fixes for ENA Ethernet driver David Miller
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=20180909081526.83979-7-netanel@amazon.com \
--to=netanel@amazon.com \
--cc=aliguori@amazon.com \
--cc=davem@davemloft.net \
--cc=dwmw@amazon.com \
--cc=evgenys@amazon.com \
--cc=gtzalik@amazon.com \
--cc=matua@amazon.com \
--cc=msw@amazon.com \
--cc=nafea@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=saeedb@amazon.com \
--cc=zorik@amazon.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).