LKML Archive on
help / color / mirror / Atom feed
From: Grant Grundler <>
To: Michael Ellerman <>
	James Bottomley <>,
	Grant Grundler <>,
	Tony Luck <>,
	Jesse Barnes <>,
	Jes Sorensen <>,
	Randy Dunlap <>,
	Roland Dreier <>,
	David Miller <>,
	Benjamin Herrenschmidt <>,, Mark Nelson <>
Subject: Re: [PATCH 1/3 v3] dma: document dma_{un}map_{single|sg}_attrs() interface
Date: Thu, 13 Mar 2008 23:21:58 -0600	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, Mar 14, 2008 at 03:30:29PM +1100, Michael Ellerman wrote:
> > +DMA_ATTR_BARRIER is a barrier attribute for DMA.  DMA to a memory 
> > +region with the DMA_ATTR_BARRIER attribute forces all pending DMA 
> > +writes to complete, and thus provides a mechanism to strictly order 
> > +DMA from a device across all intervening busses and bridges.  This 
> > +barrier is not specific to a particular type of interconnect, it 
> > +applies to the system as a whole, and so its implementation must 
> > +account for the idiosyncracies of the system all the way from the 
> > +DMA device to memory. 
> You say a "DMA to a memory region with the DMA_ATTR_BARRIER attribute
> forces all pending DMA writes to complete". Does it force _all_ DMA
> writes to complete, or just writes to the region, or just writes coming
> from devices?

Yes to "_all_ DMA writes". re-read the second sentence.

> What if something is writing to a device?

aka MMIO writes. Not defined and in general unrelated. AFAIK, no
version of PCI has ordering rules for traffic going in opposite
directions. I'm 99% sure about this but haven't reviewed any
PCI docs in about 2 years.

Note I think it's possible for DMA READs to complete out of order
given PCI-x (IIRC) and PCI-e (I'm certain) support split transactions.
This means a device can have multiple DMA reads in flight and the
chipset/system firmware (aka BIOS) have to enable and support this
functionality as well. I _believe_ those split transactions can
complete out of order (since they are tagged like SCSI/SATA are)
and I expect it's up to the device to deal with that already.

Devices which do not support or use more than one split transaction
obviously won't have any DMA READ ordering issues.

On a related note, I always think of MSI/MSI-X as DMA Writes.
Michael's got me thinking we need to explicitly state that.
In "normal" use, the device will not issue an MSI until after
the "completion DMA write" has been issued and thus the MSI/MSI-X
transactions are NOT subject to the ordering requirement...but
that's not exactly true. We don't want the MSI to ever
pass the "completion DMA write".

Do we need to state the platform interconnect can NOT allow
successive DMA writes to pass the ordered DMA writes?
Or state MSI DMA writes are implied to be to an "ordered DMA region"?
Both statements?

> Does DMA_ATTR_BARRIER have any effect on reads?

It could but it's not defined to. :)
I thought about this before but wanted to keep the document short.

Perhaps two things should be done to address this:
1) rename this to DMA_ATTR_WRITE_BARRIER
2) state it has no explicit effect on DMA Reads.

If someone needs that changed in the future, we can then
define how reading from a region will trigger ordering rules.


> cheers
> -- 
> Michael Ellerman
> OzLabs, IBM Australia Development Lab
> wwweb:
> phone: +61 2 6212 1183 (tie line 70 21183)
> We do not inherit the earth from our ancestors,
> we borrow it from our children. - S.M.A.R.T Person

  reply	other threads:[~2008-03-14  5:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28  3:24 akepner
2008-02-29  2:45 ` Michael Ellerman
2008-02-29 18:25   ` Grant Grundler
2008-02-29 18:37     ` James Bottomley
2008-03-01  2:56       ` Benjamin Herrenschmidt
2008-03-01  3:11         ` Jesse Barnes
2008-03-01  7:18         ` Grant Grundler
2008-03-05 18:13       ` akepner
2008-03-05 19:02         ` Jesse Barnes
2008-03-06  6:01         ` Michael Ellerman
2008-03-12  1:19           ` akepner
2008-03-14  4:13             ` Grant Grundler
2008-03-14  4:30             ` Michael Ellerman
2008-03-14  5:21               ` Grant Grundler [this message]
2008-03-14 16:40                 ` Jesse Barnes
2008-03-18  1:08                 ` Michael Ellerman
2008-03-20  0:32               ` akepner
2008-02-29 21:23   ` akepner

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH 1/3 v3] dma: document dma_{un}map_{single|sg}_attrs() interface' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).