From: Brian King <brking@linux.vnet.ibm.com>
Subject: ipr: Remove unnecessary memory barriers
Git-commit: a5fb407eed819e950e369060a822640582a1e538
Patch-mainline: yes
References: bnc#794550,fate#314040
    
    The ipr driver added some memory barriers in order to ensure
    a PowerPC sync instruction was executed prior to sending a
    command to the adapter to ensure the command block was
    coherent with respect to the PCI bus's view of memory.
    However, some time ago, the powerpc architecture writel
    macros were changed to include the sync since most drivers
    don't properly handle this. So remove these memory barriers
    since they are not needed and result in executing twice
    as many sync instructions, which has a significant performance
    penalty.
    
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Acked-by: Torsten Duwe <duwe@suse.de>

---
 drivers/scsi/ipr.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Index: b/drivers/scsi/ipr.c
===================================================================
--- a/drivers/scsi/ipr.c	2012-12-07 11:14:11.675457093 -0600
+++ b/drivers/scsi/ipr.c	2012-12-07 11:14:28.256404257 -0600
@@ -850,8 +850,6 @@ static void ipr_do_req(struct ipr_cmnd *
 
 	ipr_trc_hook(ipr_cmd, IPR_TRACE_START, 0);
 
-	mb();
-
 	ipr_send_command(ipr_cmd);
 }
 
@@ -985,8 +983,6 @@ static void ipr_send_hcam(struct ipr_ioa
 
 		ipr_trc_hook(ipr_cmd, IPR_TRACE_START, IPR_IOA_RES_ADDR);
 
-		mb();
-
 		ipr_send_command(ipr_cmd);
 	} else {
 		list_add_tail(&hostrcb->queue, &ioa_cfg->hostrcb_free_q);
@@ -5863,14 +5859,12 @@ static int ipr_queuecommand_lck(struct s
 			rc = ipr_build_ioadl(ioa_cfg, ipr_cmd);
 	}
 
-	if (likely(rc == 0)) {
-		mb();
-		ipr_send_command(ipr_cmd);
-	} else {
-		 list_move_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
-		 return SCSI_MLQUEUE_HOST_BUSY;
+	if (unlikely(rc != 0)) {
+		list_move_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+		return SCSI_MLQUEUE_HOST_BUSY;
 	}
 
+	ipr_send_command(ipr_cmd);
 	return 0;
 }
 
@@ -6248,8 +6242,6 @@ static unsigned int ipr_qc_issue(struct 
 		return AC_ERR_INVALID;
 	}
 
-	mb();
-
 	ipr_send_command(ipr_cmd);
 
 	return 0;
