All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Higdon <jeremy@sgi.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>, akpm@osdl.org
Cc: Jesse Barnes <jbarnes@engr.sgi.com>,
	linux-kernel@vger.kernel.org, gnb@sgi.com,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH] I/O space write barrier
Date: Fri, 15 Oct 2004 17:38:09 -0700	[thread overview]
Message-ID: <20041016003809.GA299051@sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.60.0409302317590.3449@poirot.grange>

On Thu, Sep 30, 2004 at 11:21:39PM +0200, Guennadi Liakhovetski wrote:
> 
> A pretty obvious note: instead of repeating this nice but pretty lengthy 
> comment 3 times in the same file, wouldn't it be better to write at 
> further locations something like
> 
> 	/* Enforce IO-ordering. See comment in <function> for details. */
> 
> Also helps if you later have to modify the comment, or move it, or add 
> more mmiowb()s, or do some other modifications.
> 
> Thanks
> Guennadi
> ---
> Guennadi Liakhovetski

Suggestion applied.  Now that the mmiowb is in the mm patch, this
patch to qla1280 should be ready for inclusion therein also.

signed-off-by: Jeremy Higdon <jeremy@sgi.com>


--- linux-2.6.9-rc4.orig/drivers/scsi/qla1280.c	2004-10-15 17:21:21.000000000 -0700
+++ linux-2.6.9-rc4/drivers/scsi/qla1280.c	2004-10-15 17:23:08.000000000 -0700
@@ -3409,7 +3409,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)
@@ -3677,7 +3678,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)
@@ -3787,9 +3789,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");
 }

  reply	other threads:[~2004-10-16  0:38 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-27 18:03 [PATCH] I/O space write barrier Jesse Barnes
2004-09-29 10:36 ` Greg Banks
2004-09-29 20:35   ` David S. Miller
2004-09-29 20:43     ` Jesse Barnes
2004-09-29 20:50       ` David S. Miller
2004-09-30  2:23         ` Greg Banks
2004-09-29 22:55 ` Jesse Barnes
2004-09-30  7:15   ` Jeremy Higdon
2004-09-30 21:21     ` Guennadi Liakhovetski
2004-10-16  0:38       ` Jeremy Higdon [this message]
2004-10-16  3:20         ` Matthew Wilcox
2004-10-16  3:31           ` Jeremy Higdon
  -- strict thread matches above, loose matches on Subject: below --
2004-10-21 23:13 Jesse Barnes
2004-10-21 23:13 ` Jesse Barnes
2004-10-22  1:01 ` Grant Grundler
2004-10-22  1:01   ` Grant Grundler
2004-10-22  3:05   ` Jesse Barnes
2004-10-22  3:05     ` Jesse Barnes
2004-10-22  4:26     ` Greg Banks
2004-10-22  4:26       ` Greg Banks
2004-10-22 15:26     ` Grant Grundler
2004-10-22 15:26       ` Grant Grundler
2004-10-05 22:38 Jesse Barnes
2004-10-04 20:39 Albert Cahalan
2004-10-04 21:20 ` Jesse Barnes
2004-10-05  0:32   ` Albert Cahalan
2004-10-05  1:22     ` Benjamin Herrenschmidt
2004-10-05  2:26       ` Jesse Barnes
2004-10-05  3:04         ` Benjamin Herrenschmidt
2004-10-05 15:33           ` Jesse Barnes
2004-10-05 22:41             ` Benjamin Herrenschmidt
2004-10-05 23:09               ` Jesse Barnes
2004-10-05 23:57               ` Roland Dreier
2004-10-06  1:45                 ` Benjamin Herrenschmidt
2004-10-05  2:33     ` Jesse Barnes
2004-09-23 18:48 Jesse Barnes
2004-09-23 19:03 ` James Bottomley
2004-09-23 19:07   ` Jesse Barnes
2004-09-23 19:27     ` James Bottomley
2004-09-23 19:41       ` Jesse Barnes
2004-09-23 19:57       ` Jeremy Higdon
2004-09-23 22:22       ` Jeremy Higdon
2004-09-23 23:36         ` James Bottomley
2004-09-24  5:03           ` Jeremy Higdon
2004-09-23 19:55     ` Jeremy Higdon
2004-09-23 20:09       ` Jesse Barnes
2004-09-27  0:45 ` Benjamin Herrenschmidt
2004-09-27 15:41   ` Jesse Barnes
2004-09-22 15:45 Jesse Barnes

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=20041016003809.GA299051@sgi.com \
    --to=jeremy@sgi.com \
    --cc=akpm@osdl.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=gnb@sgi.com \
    --cc=jbarnes@engr.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@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 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.