mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: memory barriers and dma_sync_single_for_*
Date: Sun, 09 Jul 2006 16:46:27 +0100	[thread overview]
Message-ID: <1152459987.27368.64.camel@localhost.localdomain> (raw)
In-Reply-To: <44B11861.3070703@s5r6.in-berlin.de>

Ar Sul, 2006-07-09 am 16:53 +0200, ysgrifennodd Stefan Richter:
> My question: Do I need wmb() within the following code?
> 
> 	dma_sync_single_for_cpu(..., DMA_TO_DEVICE);
> 	area->a = new_val_a;
> 	wmb();  /* necessary? */
> 	area->b = new_val_b;

Yes. Otherwise on some processors the I/O may be re-ordered

> 	dma_sync_single_for_device(..., DMA_TO_DEVICE);
> 
> Or are all changes to the area hidden from the device between 
> dma_sync_single_for_cpu and _for_device, thereby making the write order 
> a non-issue? Thanks,

Depends on the processor and setup. On x86-32 for example dma_sync_.. is
generally a NOP. In other environments nothing will be visible until the
sync.

Alan


      reply	other threads:[~2006-07-09 15:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-09 14:53 Stefan Richter
2006-07-09 15:46 ` Alan Cox [this message]

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=1152459987.27368.64.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    /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

Powered by JetHome