From: wenxiong@linux.vnet.ibm.com
To: davem@davemloft.net
Cc: ariel.elior@qlogic.com, netdev@vger.kernel.org,
Milton Miller <miltonm@bga.com>,
Wen Xiong <wenxiong@linux.vnet.ibm.com>
Subject: [PATCH RESEND 2/2] bnx2x: Fix kernel crash and data miscompare after EEH recovery
Date: Tue, 27 May 2014 14:11:24 -0500 [thread overview]
Message-ID: <20140527191235.743680910@linux.vnet.ibm.com> (raw)
In-Reply-To: 20140527191122.750711568@linux.vnet.ibm.com
[-- Attachment #1: bnx2x_rmb_fix --]
[-- Type: text/plain, Size: 1818 bytes --]
A rmb() is required to ensure that the CQE is not read before it
is written by the adapter DMA. PCI ordering rules will make sure
the other fields are written before the marker at the end of struct
eth_fast_path_rx_cqe but without rmb() a weakly ordered processor can
process stale data.
Without the barrier we have observed various crashes including
bnx2x_tpa_start being called on queues not stopped (resulting in message
start of bin not in stop) and NULL pointer exceptions from bnx2x_rx_int.
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Index: b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
===================================================================
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c 2014-05-23 10:34:21.000000000 -0500
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c 2014-05-27 13:51:12.067764759 -0500
@@ -906,6 +906,18 @@ static int bnx2x_rx_int(struct bnx2x_fas
bd_prod = RX_BD(bd_prod);
bd_cons = RX_BD(bd_cons);
+ /* A rmb() is required to ensure that the CQE is not read
+ * before it is written by the adapter DMA. PCI ordering
+ * rules will make sure the other fields are written before
+ * the marker at the end of struct eth_fast_path_rx_cqe
+ * but without rmb() a weakly ordered processor can process
+ * stale data. Without the barrier we have observed various
+ * crashes including bnx2x_tpa_start being called on queues
+ * not stopped (resulting in message start of bin not in
+ * stop) and NULL pointer exceptions from bnx2x_rx_int.
+ */
+ rmb();
+
cqe_fp_flags = cqe_fp->type_error_flags;
cqe_fp_type = cqe_fp_flags & ETH_FAST_PATH_RX_CQE_TYPE;
--
next prev parent reply other threads:[~2014-05-27 19:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 19:11 [PATCH RESEND 0/2] Adapter not recovery from EEH error injection wenxiong
2014-05-27 19:11 ` [PATCH RESEND 1/2] bnx2x: " wenxiong
2014-05-27 19:11 ` wenxiong [this message]
2014-05-28 8:38 ` [PATCH RESEND 2/2] bnx2x: Fix kernel crash and data miscompare after EEH recovery Dmitry Kravkov
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=20140527191235.743680910@linux.vnet.ibm.com \
--to=wenxiong@linux.vnet.ibm.com \
--cc=ariel.elior@qlogic.com \
--cc=davem@davemloft.net \
--cc=miltonm@bga.com \
--cc=netdev@vger.kernel.org \
/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).