public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: akepner@sgi.com
Cc: Jes Sorensen <jes@sgi.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	rdreier@cisco.com, linux-ia64 <linux-ia64@vger.kernel.org>
Subject: Re: [PATCH 2/3] dma: override "dma_flags_set_dmaflush" for sn-ia64
Date: Tue, 21 Aug 2007 20:16:32 +0000	[thread overview]
Message-ID: <20070821201631.GF9163@parisc-linux.org> (raw)
In-Reply-To: <20070821193522.GD5592@sgi.com>

On Tue, Aug 21, 2007 at 12:35:22PM -0700, akepner@sgi.com wrote:
> +int
> +dma_flags_set_dmaflush(int dir)
> +
> +Amend dir (one of the enum dma_data_direction values), with a platform-
> +specific "dmaflush" attribute. Unless the platform supports "posted DMA" 
> +this is a no-op. 
> +
> +On platforms that support posted DMA, dma_flags_set_dmaflush() causes 
> +device writes to the associated memory region to flush in-flight DMA. 
> +This can be important, for example, when (DMA) writes to the memory 
> +region indicate that DMA of data is complete. If DMA of data and DMA of 
> +the completion indication race, as they can do when the platform supports 
> +posted DMA, then the completion indication may arrive in host memory 
> +ahead of some data.

So, let me try to understand ... your hardware allows writes from the
device to pass other writes from the device?  Doesn't that violate the
PCI spec?  I'm thinking about this (page 43 of PCI 2.3):

  Posted memory writes moving in the same direction through a bridge
  will complete on the destination bus in the same order they complete
  on the originating bus. Even if a single burst on the originating bus
  is terminated with Disconnect on the destination bus so that it is
  broken into multiple transactions, those transactions must not allow
  the data phases to complete on the destination bus in any order other
  than their order on the originating bus.

> +To prevent this, you might map the memory region used for completion 
> +indications as follows:
> +
> +	int count, flags = dma_flags_set_dmaflush(DMA_BIDIRECTIONAL);
> +	.....
> +	count = dma_map_sg(dev, sglist, nents, flags);

So any device driver used on your hardware has to add a call to this new
function, or it'll see data corruption?  Not acceptable, IMO.

If this is a performance optimisation, then by all means add a function
drivers can call to say "it's OK, I know about this brokenness, and I
don't depend on it", but safety first.

-- 
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  parent reply	other threads:[~2007-08-21 20:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070818002746.GU1813@sgi.com>
2007-08-20  8:24 ` [PATCH 2/3] dma: override "dma_flags_set_dmaflush" for sn-ia64 Jes Sorensen
2007-08-20 16:07   ` akepner
2007-08-21 19:35   ` akepner
2007-08-21 20:05     ` Randy Dunlap
2007-08-21 20:55       ` James Bottomley
2007-08-22  0:34         ` akepner
2007-08-22  1:14           ` James Bottomley
2007-08-22  7:39             ` Jes Sorensen
2007-08-22 14:02               ` James Bottomley
2007-08-22 16:03                 ` Jesse Barnes
2007-08-22 16:44                   ` James Bottomley
2007-08-22 16:51                     ` Jesse Barnes
2007-08-22 17:04                       ` James Bottomley
2007-08-22 17:03                         ` Jes Sorensen
2007-08-22 18:10                           ` James Bottomley
2007-08-23  8:45                             ` Jes Sorensen
2007-08-22 17:17                         ` Jesse Barnes
2007-08-22 18:13                           ` James Bottomley
2007-08-22 18:44                             ` akepner
2007-08-23  5:58               ` Jeremy Higdon
2007-08-22 15:54             ` akepner
2007-08-21 20:16     ` Matthew Wilcox [this message]
2007-08-21 21:37       ` akepner
2007-08-22  7:44       ` Jes Sorensen

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=20070821201631.GF9163@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=akepner@sgi.com \
    --cc=jes@sgi.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.com \
    /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