lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 13 Mar 2008 23:21:58 -0600
From:	Grant Grundler <grundler@...isc-linux.org>
To:	Michael Ellerman <michael@...erman.id.au>
Cc:	akepner@....com,
	James Bottomley <James.Bottomley@...senPartnership.com>,
	Grant Grundler <grundler@...isc-linux.org>,
	Tony Luck <tony.luck@...el.com>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Jes Sorensen <jes@....com>,
	Randy Dunlap <randy.dunlap@...cle.com>,
	Roland Dreier <rdreier@...co.com>,
	David Miller <davem@...emloft.net>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	linux-kernel@...r.kernel.org, Mark Nelson <mdnelson@....ibm.com>
Subject: Re: [PATCH 1/3 v3] dma: document dma_{un}map_{single|sg}_attrs()
	interface

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.

thanks,
grant

> 
> cheers
> 
> -- 
> Michael Ellerman
> OzLabs, IBM Australia Development Lab
> 
> wwweb: http://michael.ellerman.id.au
> 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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists