[PATCH 3.16 109/136] i40e: Use smp_rmb rather than read_barrier_depends

From: Ben Hutchings
Date: Sat Feb 10 2018 - 23:51:01 EST


3.16.54-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Brian King <brking@xxxxxxxxxxxxxxxxxx>

commit 52c6912fde0133981ee50ba08808f257829c4c93 upstream.

The original issue being fixed in this patch was seen with the ixgbe
driver, but the same issue exists with i40e as well, as the code is
very similar. read_barrier_depends is not sufficient to ensure
loads following it are not speculatively loaded out of order
by the CPU, which can result in stale data being loaded, causing
potential system crashes.

Signed-off-by: Brian King <brking@xxxxxxxxxxxxxxxxxx>
Acked-by: Jesse Brandeburg <jesse.brandeburg@xxxxxxxxx>
Tested-by: Andrew Bowers <andrewx.bowers@xxxxxxxxx>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@xxxxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -3047,7 +3047,7 @@ static bool i40e_clean_fdir_tx_irq(struc
break;

/* prevent any other reads prior to eop_desc */
- read_barrier_depends();
+ smp_rmb();

/* if the descriptor isn't done, no work yet to do */
if (!(eop_desc->cmd_type_offset_bsz &
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -657,7 +657,7 @@ static bool i40e_clean_tx_irq(struct i40
break;

/* prevent any other reads prior to eop_desc */
- read_barrier_depends();
+ smp_rmb();

/* we have caught up to head, no work left to do */
if (tx_head == tx_desc)