public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] use mmiowb in qla1280.c
       [not found] <200410211613.19601.jbarnes@engr.sgi.com>
@ 2004-10-21 23:17 ` Jesse Barnes
  2004-10-22  9:53   ` Jes Sorensen
  2004-10-24 16:20   ` James Bottomley
  0 siblings, 2 replies; 6+ messages in thread
From: Jesse Barnes @ 2004-10-21 23:17 UTC (permalink / raw)
  To: akpm, linux-kernel; +Cc: linux-scsi, jeremy, jes

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

There are a few spots in qla1280.c that don't need a full PCI write flush to 
the device, but rather a simple write ordering guarantee.  This patch changes 
some of the PIO reads that cause write flushes into mmiowb calls instead, 
which is a lighter weight way of ensuring ordering.

Jes and James, can you ack this and/or push it in via the SCSI BK tree?

Thanks,
Jesse

Signed-off-by: Jeremy Higdon <jeremy@sgi.com>
Signed-off-by: Jesse Barnes <jbarnes@sgi.com>



[-- Attachment #2: qla1280-mmiowb-4.patch --]
[-- Type: text/plain, Size: 1654 bytes --]

===== drivers/scsi/qla1280.c 1.69 vs edited =====
--- 1.69/drivers/scsi/qla1280.c	2004-10-20 06:46:21 -07:00
+++ edited/drivers/scsi/qla1280.c	2004-10-21 16:06:11 -07:00
@@ -3400,7 +3400,8 @@
 	sp->flags |= SRB_SENT;
 	ha->actthreads++;
 	WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index);
-	(void) RD_REG_WORD(&reg->mailbox4); /* PCI posted write flush */
+	/* Enforce mmio write ordering; see comment in qla1280_isp_cmd(). */
+	mmiowb();
 
  out:
 	if (status)
@@ -3668,7 +3669,8 @@
 	sp->flags |= SRB_SENT;
 	ha->actthreads++;
 	WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index);
-	(void) RD_REG_WORD(&reg->mailbox4); /* PCI posted write flush */
+	/* Enforce mmio write ordering; see comment in qla1280_isp_cmd(). */
+	mmiowb();
 
 out:
 	if (status)
@@ -3778,9 +3780,21 @@
 	} else
 		ha->request_ring_ptr++;
 
-	/* Set chip new ring index. */
+	/*
+	 * Update request index to mailbox4 (Request Queue In).
+	 * The mmiowb() ensures that this write is ordered with writes by other
+	 * CPUs.  Without the mmiowb(), it is possible for the following:
+	 *    CPUA posts write of index 5 to mailbox4
+	 *    CPUA releases host lock
+	 *    CPUB acquires host lock
+	 *    CPUB posts write of index 6 to mailbox4
+	 *    On PCI bus, order reverses and write of 6 posts, then index 5,
+	 *       causing chip to issue full queue of stale commands
+	 * The mmiowb() prevents future writes from crossing the barrier.
+	 * See Documentation/DocBook/deviceiobook.tmpl for more information.
+	 */
 	WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index);
-	(void) RD_REG_WORD(&reg->mailbox4); /* PCI posted write flush */
+	mmiowb();
 
 	LEAVE("qla1280_isp_cmd");
 }

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

* Re: [PATCH] use mmiowb in qla1280.c
  2004-10-21 23:17 ` [PATCH] use mmiowb in qla1280.c Jesse Barnes
@ 2004-10-22  9:53   ` Jes Sorensen
  2004-10-24 16:20   ` James Bottomley
  1 sibling, 0 replies; 6+ messages in thread
From: Jes Sorensen @ 2004-10-22  9:53 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: akpm, linux-kernel, linux-scsi, jeremy

>>>>> "Jesse" == Jesse Barnes <jbarnes@engr.sgi.com> writes:

Jesse> There are a few spots in qla1280.c that don't need a full PCI
Jesse> write flush to the device, but rather a simple write ordering
Jesse> guarantee.  This patch changes some of the PIO reads that cause
Jesse> write flushes into mmiowb calls instead, which is a lighter
Jesse> weight way of ensuring ordering.

Jesse> Jes and James, can you ack this and/or push it in via the SCSI
Jesse> BK tree?

ACK!

James will you push this one?

Cheers,
Jes

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

* Re: [PATCH] use mmiowb in qla1280.c
  2004-10-21 23:17 ` [PATCH] use mmiowb in qla1280.c Jesse Barnes
  2004-10-22  9:53   ` Jes Sorensen
@ 2004-10-24 16:20   ` James Bottomley
  2004-10-25 16:18     ` Jesse Barnes
  1 sibling, 1 reply; 6+ messages in thread
From: James Bottomley @ 2004-10-24 16:20 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: Andrew Morton, Linux Kernel, SCSI Mailing List, jeremy, jes

On Thu, 2004-10-21 at 19:17, Jesse Barnes wrote:
> There are a few spots in qla1280.c that don't need a full PCI write flush to 
> the device, but rather a simple write ordering guarantee.  This patch changes 
> some of the PIO reads that cause write flushes into mmiowb calls instead, 
> which is a lighter weight way of ensuring ordering.
> 
> Jes and James, can you ack this and/or push it in via the SCSI BK tree?

This doesn't seem to work:

  CC [M]  drivers/scsi/qla1280.o
drivers/scsi/qla1280.c: In function `qla1280_64bit_start_scsi':
drivers/scsi/qla1280.c:3404: warning: implicit declaration of function
`mmiowb'

  MODPOST
*** Warning: "mmiowb" [drivers/scsi/qla1280.ko] undefined!

James



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

* Re: [PATCH] use mmiowb in qla1280.c
  2004-10-24 16:20   ` James Bottomley
@ 2004-10-25 16:18     ` Jesse Barnes
  2004-10-25 19:02       ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Jesse Barnes @ 2004-10-25 16:18 UTC (permalink / raw)
  To: James Bottomley
  Cc: Andrew Morton, Linux Kernel, SCSI Mailing List, jeremy, jes

On Sunday, October 24, 2004 9:20 am, James Bottomley wrote:
> On Thu, 2004-10-21 at 19:17, Jesse Barnes wrote:
> > There are a few spots in qla1280.c that don't need a full PCI write flush
> > to the device, but rather a simple write ordering guarantee.  This patch
> > changes some of the PIO reads that cause write flushes into mmiowb calls
> > instead, which is a lighter weight way of ensuring ordering.
> >
> > Jes and James, can you ack this and/or push it in via the SCSI BK tree?
>
> This doesn't seem to work:
>
>   CC [M]  drivers/scsi/qla1280.o
> drivers/scsi/qla1280.c: In function `qla1280_64bit_start_scsi':
> drivers/scsi/qla1280.c:3404: warning: implicit declaration of function
> `mmiowb'
>
>   MODPOST
> *** Warning: "mmiowb" [drivers/scsi/qla1280.ko] undefined!

Only works in Andrew's tree until he pushes mmiowb to Linus.

Jesse

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

* Re: [PATCH] use mmiowb in qla1280.c
  2004-10-25 16:18     ` Jesse Barnes
@ 2004-10-25 19:02       ` Andrew Morton
  2004-10-25 19:33         ` Jesse Barnes
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2004-10-25 19:02 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: James.Bottomley, linux-kernel, linux-scsi, jeremy, jes

Jesse Barnes <jbarnes@engr.sgi.com> wrote:
>
> > *** Warning: "mmiowb" [drivers/scsi/qla1280.ko] undefined!
> 
>  Only works in Andrew's tree until he pushes mmiowb to Linus.

I haven't been following this stuff at all closely and I need help
determining which patches should be pushed, and when.  Please.

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

* Re: [PATCH] use mmiowb in qla1280.c
  2004-10-25 19:02       ` Andrew Morton
@ 2004-10-25 19:33         ` Jesse Barnes
  0 siblings, 0 replies; 6+ messages in thread
From: Jesse Barnes @ 2004-10-25 19:33 UTC (permalink / raw)
  To: Andrew Morton; +Cc: James.Bottomley, linux-kernel, linux-scsi, jeremy, jes

On Monday, October 25, 2004 12:02 pm, Andrew Morton wrote:
> Jesse Barnes <jbarnes@engr.sgi.com> wrote:
> > > *** Warning: "mmiowb" [drivers/scsi/qla1280.ko] undefined!
> >
> >  Only works in Andrew's tree until he pushes mmiowb to Linus.
>
> I haven't been following this stuff at all closely and I need help
> determining which patches should be pushed, and when.  Please.

I think it's safe to push the main mmiowb() patch now, then James and the 
netdev tree can start including driver changes to make use of it.

Thanks,
Jesse

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

end of thread, other threads:[~2004-10-25 19:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200410211613.19601.jbarnes@engr.sgi.com>
2004-10-21 23:17 ` [PATCH] use mmiowb in qla1280.c Jesse Barnes
2004-10-22  9:53   ` Jes Sorensen
2004-10-24 16:20   ` James Bottomley
2004-10-25 16:18     ` Jesse Barnes
2004-10-25 19:02       ` Andrew Morton
2004-10-25 19:33         ` Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox