From: "David Mosberger-Tang" <David.Mosberger@acm.org>
To: linux-ia64@vger.kernel.org
Subject: Re: I/O read, write implementation questions
Date: Tue, 25 Apr 2006 14:46:03 +0000 [thread overview]
Message-ID: <ed5aea430604250746v3e5935bat7c4a9e97377ed0f7@mail.gmail.com> (raw)
In-Reply-To: <444E2EA6.8000604@bull.net>
Zoltan,
On 4/25/06, Zoltan Menyhart <Zoltan.Menyhart@bull.net> wrote:
> 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?
Linux itself supports weak memory ordering. You want to minimize the
amount of fences in low-level primitives because they're expensive and
you only want to pay the prize of them when they're really needed.
> 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?
Nothing. Why *should* an unordered store be ordered with respect to
outb()? If you want ordering, either declare "flag" volatile or add
an explicit barrier.
> Why do not "readb()" ... "writeb()" include "mf.a"-s?
Again, acceptance is not normally needed by readX/writeX and mf.a is
extremely expensive (on the order of 1,000 cycles). If you want
ordering, you need to use explicit barriers (or rely on the effect of
"volatile" in ia64-specific code).
--david
--
Mosberger Consulting LLC, http://www.mosberger-consulting.com/
next prev parent reply other threads:[~2006-04-25 14:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-25 14:13 I/O read, write implementation questions Zoltan Menyhart
2006-04-25 14:46 ` David Mosberger-Tang [this message]
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=ed5aea430604250746v3e5935bat7c4a9e97377ed0f7@mail.gmail.com \
--to=david.mosberger@acm.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox