From: Zoltan Menyhart <Zoltan.Menyhart@bull.net>
To: linux-ia64@vger.kernel.org
Subject: I/O read, write implementation questions
Date: Tue, 25 Apr 2006 14:13:58 +0000 [thread overview]
Message-ID: <444E2EA6.8000604@bull.net> (raw)
The SDM shows on pages 2:585-586 how the I/O space reads and
writes have to be iplemented, e.g.:
outb: ...
mf
st1.rel [port_addr] = in1
mf.a
mf
inb: ...
mf
ld1.acq r8 = [port_addr]
mf.a
mf
The actual implementation does not include the pairs of "mf"-s.
Can someone, please, explain me why they are left off?
The following code sequence:
outb(data, port_addr);
flag = 1;
may be compiled as:
add r8 = 1, r0
add r2 = flag_offs, r1
;;
st1.rel [port_addr] = data
mf.a
st1 [r2] = r8
What prevents "st1 [r2] = r8" from being seen before
"st1.rel [port_addr] = data" is seen?
("mf.a" is unordered, see Table 4-14, SDM vol2.)
Similar hazardous code can be constructed with "inb()".
Why do not "readb()" ... "writeb()" include "mf.a"-s?
Let's take an example from the "ia-64 Linux Kernel" book, chapter 7.2.1:
dmabuf[0] = 5;
memcpy(dmabuf + 1, "hello", 5);
mb();
readl(dmactl); // Memory mapped I/O
// And let's add:
flag = 1;
What prevents "flag = 1" from being seen before the DMA is actually
kicked off?
The ".acq" generated by "readl()" - because "dmactl" is a volatile
pointer - plays with the OzQ only.
As "dmactl" is an uncached address, the read request goes into the
In-Order Output Queue.
Nothing remains in the OzQ ahead of "flag = 1", it gets committed
happily against the L2 cache, i.e. it becomes globally visible.
Our uncached read request is still sitting in the In-Order Output Queue...
It would not help if I added an "mb()" before "flag = 1".
Thanks,
Zoltan
next reply other threads:[~2006-04-25 14:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-25 14:13 Zoltan Menyhart [this message]
2006-04-25 14:46 ` I/O read, write implementation questions David Mosberger-Tang
2006-04-25 15:20 ` Zoltan Menyhart
2006-04-25 23:20 ` Grant Grundler
2006-04-26 15:48 ` Brent Casavant
2006-04-26 15:53 ` Brent Casavant
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=444E2EA6.8000604@bull.net \
--to=zoltan.menyhart@bull.net \
--cc=linux-ia64@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.