mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: david@gibson.dropbear.id.au
Cc: James.Bottomley@steeleye.com, jgarzik@pobox.com,
	linux-kernel@vger.kernel.org, miles@gnu.org
Subject: Re: [RFC] generic device DMA implementation
Date: Thu, 5 Dec 2002 23:14:16 -0800	[thread overview]
Message-ID: <200212060714.XAA06006@adam.yggdrasil.com> (raw)

David Gibson wrote:
>On Thu, Dec 05, 2002 at 06:08:22PM -0800, Adam J. Richter wrote:
[...]
>> 	In linux-2.5.50/drivers/net/lasi_82596.c, the macros
>> CHECK_{WBACK,INV,WBACK_INV} have definitions like:
>> 
>> #define  CHECK_WBACK(addr,len) \
>> 	do { if (!dma_consistent) dma_cache_wback((unsigned long)addr,len); } while (0)
>> 
>> 	These macros are even used in IO paths like i596_rx().  The
>> "if()" statement in each of these macros is the extra branch that
>> disappears on most architectures under James's proposal.
>
>Erm... I have no problem with the macros that James's proposal would
>use to take away this branch - I would expect to use exactly the same
>ones.  It's just the notion of "try to get consistent memory, but get
>me any old memory otherwise" that I'm not so convinced by.
>
>In any case, on platforms where the dma_malloc() could really return
>either consistent or non-consistent memory, James's sync macros would
>have to have an equivalent branch within.

	Yeah, I should have said "because then you don't have to have a
branch for the case where the platform always or *never* returns
consistent memory on a give machine."

>> >What performance advantages of consistent memory?

>> [...]  For
>> example, pci_sync_single is 55 lines of C code in
>> linux-2.5.50/arch/sparc64/kernel/pci_iommu.c.
>
>Hmm... fair enough.  Ok, I can see the point of a fall back to
>non-consistent approach given that.  So I guess the idea makes sense,
>so long as dma_malloc() (without the consistent flag) is taken to be
>"give me DMAable memory, consistent or not, whichever is cheaper for
>this platform" rather than "give me DMAable memory, consistent if
>possible".  It was originally presented as the latter which misled me.

	As long as dma_sync_maybe works with the addresses returned by
dma_malloc and dma_malloc only returns the types of memory that the
callers claims to be prepared to deal with, the decision about what
kind of memory dma_malloc should return when it has a choice is up to
the platform implementation.

>I think the change to the parameters which I suggested in a reply to
>James makes this a bit clearer.

	I previously suggested some of the changes in your description:
name them dma_{malloc,free} (which James basically agrees with), have
a flags field.  However, given that it's a parameter and you're going
to pass a constant symbol like DMA_CONSISTENT or DMA_INCONSISTENT to it,
it doesn't really matter if its an enum or an int to start with, as it
could be changed later with minimal or zero driver changes.

	I like your term DMA_CONSISTENT better than
DMA_CONFORMANCE_CONSISTANT.  I think the word "conformance" in there
does not reduce the time that it takes to figure out what the symbol
means.  I don't think any other facility will want to use the terms
DMA_{,IN}CONSISTENT, so I prefer that we go with the more medium sized
symbol.

	Naming the parameter to dma_malloc "bus" would imply that it
will not look at individual device information like dma_mask, which is
wrong.  Putting the flags field in the middle of the parameter list
will make the dma_malloc and dma_free lists unnnecessarily different.
I think these two were just oversights in your posting.

	Anyhow, I think we're in full agreement at this point on the
substantive stuff at this point.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

             reply	other threads:[~2002-12-06  7:10 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-06  7:14 Adam J. Richter [this message]
2002-12-06 16:26 ` James Bottomley
2002-12-06 17:48   ` Miles Bader
2002-12-07  9:56   ` David Gibson
2002-12-07  9:45 ` David Gibson
2002-12-07 11:26   ` Russell King
2002-12-08  5:28     ` David Gibson
  -- strict thread matches above, loose matches on Subject: below --
2002-12-07 14:37 Adam J. Richter
2002-12-07  4:12 Adam J. Richter
2002-12-06 22:52 Adam J. Richter
2002-12-06 22:17 Adam J. Richter
2002-12-06 22:26 ` James Bottomley
2002-12-06 22:29   ` David S. Miller
2002-12-06 22:48     ` James Bottomley
2002-12-06 22:49       ` David S. Miller
2002-12-06 22:32   ` Arjan van de Ven
2002-12-06 17:39 Adam J. Richter
2002-12-06 18:07 ` Matthew Wilcox
2002-12-06 17:07 Adam J. Richter
2002-12-06 16:48 James Bottomley
2002-12-06 16:19 Adam J. Richter
2002-12-06 16:40 ` Matthew Wilcox
2002-12-06 18:17 ` David S. Miller
2002-12-06 18:29   ` James Bottomley
2002-12-06 18:31     ` David S. Miller
2002-12-06 18:40       ` James Bottomley
2002-12-06 18:42         ` David S. Miller
2002-12-06 21:04           ` Oliver Xymoron
2002-12-07 10:19       ` David Gibson
2002-12-06 18:36   ` Matthew Wilcox
2002-12-06 18:38     ` David S. Miller
2002-12-06  7:41 Adam J. Richter
2002-12-06 15:50 ` David S. Miller
2002-12-06  6:15 David Brownell
2002-12-06  2:08 Adam J. Richter
2002-12-06  2:53 ` David Gibson
2002-12-06  4:03   ` David S. Miller
2002-12-05 20:27 Adam J. Richter
2002-12-05 17:49 Manfred Spraul
2002-12-06  0:08 ` David Gibson
2002-12-05 12:21 Adam J. Richter
2002-12-05 12:44 ` Russell King
2002-12-05 12:13 Adam J. Richter
2002-12-05 11:57 Adam J. Richter
2002-12-06  0:06 ` David Gibson
2002-12-05  5:20 Adam J. Richter
2002-12-05  3:02 Adam J. Richter
2002-12-05  6:15 ` David Gibson
2002-12-05  1:21 Adam J. Richter
2002-12-05  2:40 ` David Gibson
2002-12-05  2:49   ` Miles Bader
2002-12-05  6:12     ` David Gibson
2002-12-05  0:43 Adam J. Richter
2002-12-05  0:55 ` Jeff Garzik
2002-12-05  2:02 ` James Bottomley
2002-12-04 17:47 James Bottomley
2002-12-04 18:27 ` Jeff Garzik
2002-12-04 19:36   ` James Bottomley
2002-12-04 21:19 ` Miles Bader
2002-12-04 21:21 ` Miles Bader
2002-12-04 21:42   ` James Bottomley
2002-12-05  5:44     ` Miles Bader
2002-12-04 21:46   ` James Bottomley
2002-12-05  2:31     ` Miles Bader
2002-12-05  3:06       ` James Bottomley
2002-12-05  5:02       ` David Gibson
2002-12-05 11:15     ` Benjamin Herrenschmidt
2002-12-05 11:16       ` William Lee Irwin III
2002-12-05 15:12       ` James Bottomley
2002-12-05  0:47 ` David Gibson
2002-12-05  0:54   ` Jeff Garzik
2002-12-05  1:44   ` James Bottomley
2002-12-05  2:38     ` David Gibson
2002-12-05  3:13       ` James Bottomley
2002-12-05  5:05         ` David Gibson
2002-12-05 15:03           ` James Bottomley
2002-12-05 23:54             ` David Gibson
2002-12-05  3:17       ` Miles Bader
2002-12-05  6:06         ` David Gibson
2002-12-05  6:43           ` Miles Bader
2002-12-05 23:44             ` David Gibson
2002-12-06  2:23               ` Miles Bader
2002-12-05  3:41       ` Jeff Garzik
2002-12-05  6:04         ` David Gibson
2002-12-05 16:29           ` Jeff Garzik
2002-12-05 23:59             ` David Gibson
2002-12-05 11:08   ` Benjamin Herrenschmidt
2002-12-05 11:35     ` Russell King
2002-12-05 15:24       ` James Bottomley
2002-12-06  0:01     ` David Gibson

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=200212060714.XAA06006@adam.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miles@gnu.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

all inboxes | Powered by JetHome®