public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] Kill dma_is_consistent()
Date: Thu, 23 Nov 2006 09:59:33 -0600	[thread overview]
Message-ID: <1164297574.2829.9.camel@mulgrave.il.steeleye.com> (raw)
In-Reply-To: <20061123150312.GA32406@linux-mips.org>

On Thu, 2006-11-23 at 15:03 +0000, Ralf Baechle wrote:
> dma_is_consistent() is ill-designed in that it does not have a struct device
> argument which makes proper support for systems that consist of a mix of
> coherent and non-coherent DMA devices hard.

At the time the interface was designed, the general consensus was that
it was easier to recognise incoherent memory regions by their address
range than by which device they came from.  The main proponent of this
being arm, if I remember rightly.

>   There also is just a single
> user, a BUG_ON() call in the 53c700.c SCSI driver so removing instead of
> fixing it up seems to be the thing to do.

Really, no, this is a bad idea.  However, if you want to make it per
device as well as per dma_addr_t, please feel free ... the patch will be
marginally smaller than the one you just submitted ...

> -	/* all of these offsets are L1_CACHE_BYTES separated.  It is fatal
> -	 * if this isn't sufficient separation to avoid dma flushing issues */
> -	BUG_ON(!dma_is_consistent(pScript) && L1_CACHE_BYTES < dma_get_cache_alignment());

Really, this is a good BUG_ON; it detects a condition that would cause
incredibly subtle and extremely hard to diagnose data corruption
problems in the driver caused by mixed cacheline incoherency.  It's the
price I paid in the driver for having my data separations for the
mailboxes determined at compile time rather than runtime.  If you want
to take this out, we need to use dma_get_cache_alignment() to determine
the mailbox separations and set them up accordingly at runtime.

James



  reply	other threads:[~2006-11-23 16:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23 15:03 [PATCH] Kill dma_is_consistent() Ralf Baechle
2006-11-23 15:59 ` James Bottomley [this message]
2006-11-23 16:06   ` Russell King
2006-11-23 17:24   ` [PATCH] Add struct dev pointer to dma_is_consistent() Ralf Baechle

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=1164297574.2829.9.camel@mulgrave.il.steeleye.com \
    --to=james.bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ralf@linux-mips.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