From: James Bottomley <James.Bottomley@SteelEye.com>
To: Jesse Barnes <jbarnes@engr.sgi.com>
Cc: Matthew Wilcox <willy@debian.org>,
Grant Grundler <grundler@parisc-linux.org>,
Andrew Vasquez <andrew.vasquez@qlogic.com>,
pj@sgi.com, SCSI Mailing List <linux-scsi@vger.kernel.org>,
mdr@cthulhu.engr.sgi.com, jeremy@cthulhu.engr.sgi.com,
djh@cthulhu.engr.sgi.com, Andrew Morton <akpm@osdl.org>
Subject: Re: SCSI QLA not working on latest *-mm SN2
Date: 21 Sep 2004 13:20:08 -0400 [thread overview]
Message-ID: <1095787216.2507.340.camel@mulgrave> (raw)
In-Reply-To: <200409211303.19110.jbarnes@engr.sgi.com>
On Tue, 2004-09-21 at 13:03, Jesse Barnes wrote:
> +Driver writers are responsible for ensuring that I/O writes to memory-mapped
> +addresses on their device arrive when expected and in the order intended.
Really, no. You're making the document more confusing. PCI devices
have *two* types of non DMA accesses (well, three, but lets forget
configuration space for the moment).
I/O Space accesses (what we call PIO) and memory accesses (what we call
MMIO)
> +This is typically done by reading a 'safe' device or bridge register, causing
> +the I/O chipset to flush pending writes to the device before any reads are
Not "bridge register" the specs say this must be an access to the
device's space.
> +sent to the target device. A driver would usually use this technique
> +immediately prior to a read after a card reset or the exit of a critical
> +section of code protected by spinlocks. This would ensure that subsequent I/O
> +space accesses arrived only after all prior writes. There are really two
> +issues at play here, one is 'posting', i.e. memory-mapped I/O writes not sent
> +to the device immediately, and ordering, where on a large system writes from
> +different CPUs may arrive out of order.
>
> - ...
> +Some pseudocode to illustrate the problem of write posting:
> +
> +...
> +spin_lock_irqsave(&dev_lock, flags)
> +...
> +writel(resetval, reset_reg); /* reset the card */
> +udelay(10); /* wait for reset (also needs pioflush) */
> +val = readl(ring_ptr); /* read initial value */
> +spin_unlock_irqrestore(&dev_lock, flags)
> +...
> +
> +In this case, the card is reset by the first write. The driver attempts to
> +wait for the completion of the reset using udelay. But since the write may be
> +delayed and the udelay will probably start executing right away, it may be
> +that there's not enough time for the write to actually arrive at the card and
> +for the reset to occur before the read is executed. On some platforms, this
> +can result in a machine check. Unfortunately, there's no way to guarantee
> +that a write has arrived at a device short of a read from the same address
Not same address space, any address space (IO, memory or config) of the
device will do.
> +space, so in some cases, udelay() is the only option. In any case, the driver
> +should issue an ioflush() call prior to the udelay(), passing in 0 for the
No; using udelay() to try to wait for the flush of posted writes to
occur is always a bug.
> +addr argument if no safe register exists. This will allow the platform to
> +make an effort to get the write as close to the device as possible before
> +allowing the udelay to begin.
What ioflush() call? There's no such thing in PCI; this is effectively
our problem. If there were a nice flush instruction we wouldn't have to
worry about reading from somewhere on the device. The problem is that
there's no a-priori way of knowing what read is safe to do, so there's
no generic way to extract a posting flush API.
James
next prev parent reply other threads:[~2004-09-21 17:20 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <B179AE41C1147041AA1121F44614F0B060EF48@AVEXCH02.qlogic.org>
[not found] ` <20040916121235.5e4f9c32.pj@sgi.com>
[not found] ` <1095362263.16326.12.camel@praka>
2004-09-16 19:56 ` SCSI QLA not working on latest *-mm SN2 Paul Jackson
2004-09-16 20:05 ` Jesse Barnes
2004-09-16 20:56 ` Andrew Vasquez
2004-09-16 21:09 ` Jesse Barnes
2004-09-16 21:40 ` Andrew Vasquez
2004-09-16 22:25 ` Andrew Morton
2004-09-16 22:29 ` Jesse Barnes
2004-09-17 17:21 ` Jesse Barnes
2004-09-18 6:10 ` Grant Grundler
2004-09-18 17:57 ` Documentation/io_ordering.txt is wrong Matthew Wilcox
2004-09-20 23:39 ` Jesse Barnes
2004-09-21 0:38 ` Jesse Barnes
2004-09-20 22:40 ` SCSI QLA not working on latest *-mm SN2 Jesse Barnes
2004-09-20 23:27 ` Grant Grundler
2004-09-21 0:09 ` Jesse Barnes
2004-09-21 5:46 ` Grant Grundler
2004-09-21 6:45 ` Jeremy Higdon
2004-09-21 13:29 ` Jesse Barnes
2004-09-21 13:25 ` Jesse Barnes
2004-09-21 15:13 ` Jesse Barnes
2004-09-21 15:41 ` James Bottomley
2004-09-21 15:58 ` Jesse Barnes
2004-09-21 16:01 ` Matthew Wilcox
2004-09-21 16:05 ` Jesse Barnes
2004-09-21 16:11 ` James Bottomley
2004-09-21 16:18 ` Jesse Barnes
2004-09-21 16:24 ` James Bottomley
2004-09-21 17:03 ` Jesse Barnes
2004-09-21 17:15 ` Matthew Wilcox
2004-09-21 17:24 ` Jesse Barnes
2004-09-21 17:20 ` James Bottomley [this message]
2004-09-21 17:46 ` Jesse Barnes
2004-09-21 17:56 ` James Bottomley
2004-09-21 18:09 ` Jesse Barnes
2004-09-21 19:06 ` Grant Grundler
2004-09-21 19:40 ` Jesse Barnes
2004-09-21 22:44 ` Grant Grundler
2004-09-21 21:03 ` Jeremy Higdon
2004-09-21 21:11 ` Matthew Wilcox
2004-09-21 21:43 ` Jeremy Higdon
2004-09-21 22:33 ` Jesse Barnes
2004-09-22 0:02 ` Matthew Wilcox
2004-09-22 1:16 ` Jeremy Higdon
2004-09-22 1:44 ` Grant Grundler
2004-09-22 2:58 ` Jeremy Higdon
2004-09-22 14:32 ` I/O write ordering Matthew Wilcox
2004-09-22 14:40 ` Benjamin Herrenschmidt
2004-09-22 14:50 ` Jesse Barnes
2004-09-22 14:47 ` James Bottomley
2004-09-22 14:51 ` Benjamin Herrenschmidt
2004-09-22 15:11 ` James Bottomley
2004-09-22 15:11 ` Benjamin Herrenschmidt
2004-09-22 15:22 ` James Bottomley
2004-09-22 15:28 ` Benjamin Herrenschmidt
2004-09-22 15:43 ` James Bottomley
2004-09-23 0:19 ` Benjamin Herrenschmidt
2004-09-23 1:58 ` Matthew Wilcox
2004-09-23 3:01 ` James Bottomley
2004-09-23 3:40 ` Benjamin Herrenschmidt
2004-09-23 4:26 ` Grant Grundler
2004-09-21 23:03 ` SCSI QLA not working on latest *-mm SN2 Guennadi Liakhovetski
2004-09-16 23:14 ` Jeremy Higdon
2004-09-16 20:11 ` Andrew Morton
2004-09-21 21:22 Andrew Vasquez
2004-09-21 21:44 ` Jeremy Higdon
2004-09-21 22:37 ` Jesse Barnes
2004-09-21 22:49 ` Jeremy Higdon
-- strict thread matches above, loose matches on Subject: below --
2004-09-21 20:50 Andrew Vasquez
2004-09-21 21:06 ` Jeremy Higdon
2004-09-21 22:36 ` Jesse Barnes
2004-09-21 22:39 ` Jeremy Higdon
2004-09-21 22:43 ` Jesse Barnes
2004-09-21 22:54 ` Jeremy Higdon
2004-09-21 23:17 ` Jesse Barnes
2004-09-22 21:33 ` Jesse Barnes
2004-09-21 17:33 Andrew Vasquez
2004-09-21 17:52 ` Jesse Barnes
2004-09-21 18:04 ` Matthew Wilcox
2004-09-21 18:59 ` Matthew Wilcox
2004-09-21 19:10 ` Jesse Barnes
2004-09-21 15:58 Andrew Vasquez
2004-09-21 16:07 ` Jesse Barnes
2004-09-21 16:25 ` Matthew Wilcox
2004-09-21 16:33 ` James Bottomley
2004-09-21 20:39 ` Jeremy Higdon
2004-09-21 20:43 ` Jeremy Higdon
2004-09-17 22:55 Andrew Vasquez
2004-09-17 23:10 ` Jesse Barnes
2004-09-17 23:55 ` James Bottomley
2004-09-18 1:15 ` Andrew Vasquez
2004-09-18 1:25 ` Matthew Wilcox
2004-09-18 1:24 ` Andrew Vasquez
2004-09-18 2:36 ` Jeremy Higdon
2004-09-18 19:12 ` James Bottomley
2004-09-15 22:51 Paul Jackson
2004-09-15 23:13 ` Andrew Morton
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=1095787216.2507.340.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=akpm@osdl.org \
--cc=andrew.vasquez@qlogic.com \
--cc=djh@cthulhu.engr.sgi.com \
--cc=grundler@parisc-linux.org \
--cc=jbarnes@engr.sgi.com \
--cc=jeremy@cthulhu.engr.sgi.com \
--cc=linux-scsi@vger.kernel.org \
--cc=mdr@cthulhu.engr.sgi.com \
--cc=pj@sgi.com \
--cc=willy@debian.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