From: Jesse Barnes <jbarnes@engr.sgi.com>
To: akpm@osdl.org, linux-kernel@vger.kernel.org
Cc: linux-scsi@vger.kernel.org, jeremy@sgi.com, jes@sgi.com
Subject: [PATCH] use mmiowb in qla1280.c
Date: Thu, 21 Oct 2004 16:17:14 -0700 [thread overview]
Message-ID: <200410211617.14809.jbarnes@engr.sgi.com> (raw)
In-Reply-To: <200410211613.19601.jbarnes@engr.sgi.com>
[-- 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(®->mailbox4, ha->req_ring_index);
- (void) RD_REG_WORD(®->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(®->mailbox4, ha->req_ring_index);
- (void) RD_REG_WORD(®->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(®->mailbox4, ha->req_ring_index);
- (void) RD_REG_WORD(®->mailbox4); /* PCI posted write flush */
+ mmiowb();
LEAVE("qla1280_isp_cmd");
}
next parent reply other threads:[~2004-10-21 23:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200410211613.19601.jbarnes@engr.sgi.com>
2004-10-21 23:17 ` Jesse Barnes [this message]
2004-10-22 9:53 ` [PATCH] use mmiowb in qla1280.c 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
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=200410211617.14809.jbarnes@engr.sgi.com \
--to=jbarnes@engr.sgi.com \
--cc=akpm@osdl.org \
--cc=jeremy@sgi.com \
--cc=jes@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox