All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 10/11] lpfc: Add missing memory barrier
@ 2016-12-19 23:07 James Smart
  2016-12-20 13:47 ` Hannes Reinecke
  2017-03-04  1:46 ` Mauricio Faria de Oliveira
  0 siblings, 2 replies; 3+ messages in thread
From: James Smart @ 2016-12-19 23:07 UTC (permalink / raw)
  To: linux-scsi


On loosely ordered memory systems (PPC for example), the WQE elements
were being updated in memory, but not necessarily flushed before the
separate doorbell was written to hw which would cause hw to dma the
WQE element. Thus, the hardware occasionally received partially
updated WQE data.

Add the memory barrier after updating the WQE memory.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
v2:
  revised for checkpatch warning - comment before wmb()

 drivers/scsi/lpfc/lpfc_sli.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index d0ffcf3..5c8663f 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -120,6 +120,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
 	if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED)
 		bf_set(wqe_wqid, &wqe->generic.wqe_com, q->queue_id);
 	lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size);
+	/* ensure WQE bcopy flushed before doorbell write */
+	wmb();
 
 	/* Update the host index before invoking device */
 	host_index = q->host_index;
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 10/11] lpfc: Add missing memory barrier
  2016-12-19 23:07 [PATCH v2 10/11] lpfc: Add missing memory barrier James Smart
@ 2016-12-20 13:47 ` Hannes Reinecke
  2017-03-04  1:46 ` Mauricio Faria de Oliveira
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2016-12-20 13:47 UTC (permalink / raw)
  To: James Smart, linux-scsi

On 12/20/2016 12:07 AM, James Smart wrote:
> 
> On loosely ordered memory systems (PPC for example), the WQE elements
> were being updated in memory, but not necessarily flushed before the
> separate doorbell was written to hw which would cause hw to dma the
> WQE element. Thus, the hardware occasionally received partially
> updated WQE data.
> 
> Add the memory barrier after updating the WQE memory.
> 
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <james.smart@broadcom.com>
> ---
> v2:
>   revised for checkpatch warning - comment before wmb()
> 
>  drivers/scsi/lpfc/lpfc_sli.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index d0ffcf3..5c8663f 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -120,6 +120,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
>  	if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED)
>  		bf_set(wqe_wqid, &wqe->generic.wqe_com, q->queue_id);
>  	lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size);
> +	/* ensure WQE bcopy flushed before doorbell write */
> +	wmb();
>  
>  	/* Update the host index before invoking device */
>  	host_index = q->host_index;
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 10/11] lpfc: Add missing memory barrier
  2016-12-19 23:07 [PATCH v2 10/11] lpfc: Add missing memory barrier James Smart
  2016-12-20 13:47 ` Hannes Reinecke
@ 2017-03-04  1:46 ` Mauricio Faria de Oliveira
  1 sibling, 0 replies; 3+ messages in thread
From: Mauricio Faria de Oliveira @ 2017-03-04  1:46 UTC (permalink / raw)
  To: James Smart, linux-scsi, Martin K. Petersen

On 12/19/2016 09:07 PM, James Smart wrote:
> On loosely ordered memory systems (PPC for example), the WQE elements
> were being updated in memory, but not necessarily flushed before the
> separate doorbell was written to hw which would cause hw to dma the
> WQE element. Thus, the hardware occasionally received partially
> updated WQE data.
>
> Add the memory barrier after updating the WQE memory.

Reviewed-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>

Martin, may you please flag this patch for stable?

Thank you,

-- 
Mauricio Faria de Oliveira
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-04  1:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 23:07 [PATCH v2 10/11] lpfc: Add missing memory barrier James Smart
2016-12-20 13:47 ` Hannes Reinecke
2017-03-04  1:46 ` Mauricio Faria de Oliveira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.