From: "Imran Badr" <imran.badr@cavium.com>
To: <root@chaos.analogic.com>
Cc: "'David S. Miller'" <davem@redhat.com>, <phillips@arcor.de>,
<linux-kernel@vger.kernel.org>
Subject: RE: Calculating kernel logical address ..
Date: Mon, 9 Sep 2002 11:12:27 -0700 [thread overview]
Message-ID: <01a301c2582c$754dbf30$9e10a8c0@IMRANPC> (raw)
In-Reply-To: <Pine.LNX.3.95.1020909134937.18141A-100000@chaos.analogic.com>
I believe that screen cards and audio drivers do exactly the same what I am
doing. You donot allocate memory in user space for DMA becuase that memory
is not guaranteed to be contiguous in physical space. Instead, you call
mmap() entry point of the driver, the driver maps kernel memory (allocated
by kmalloc or get_free_pages, or device memory) in to the process's space.
Now, the user proghram can directly access device memory /or copy data
directly to that buffer for DMA. This eliminates copy_from/to_user call
which could be expensive. I have seen 30-40 % performance improvement on my
i386 system.
But my question here still begging an answer: What would be the portable way
to calculate kernel logical address of that user buffer?
Thanks,
Imran.
-----Original Message-----
From: Richard B. Johnson [mailto:root@chaos.analogic.com]
Sent: Monday, September 09, 2002 11:01 AM
To: Imran Badr
Cc: 'David S. Miller'; phillips@arcor.de; linux-kernel@vger.kernel.org
Subject: RE: Calculating kernel logical address ..
On Mon, 9 Sep 2002, Imran Badr wrote:
>
> The virt_to_bus() macro would work only for kernel logical addresses. I am
> trying to find a portable way to figure out the kernel logical address of
a
> user buffer so that I could use virt_to_bus() for DMA. The user address is
> mmap'ed from kmalloc'ed buffer in the mmap() entry of my driver. Now when
> the user wants to send this data to the PCI device, it makes an ioctl call
> and give the user address to the driver. Now driver has to figure out the
> kernel logical address for DMA.
>
> Thanks,
> Imran.
>
Well I just read Documentation/DMA-mapping.txt as advised by David
and it seems as though it will no longer be possible to do what
many programmers have been wanting to do, to wit:
(1) In user-code, allocate a buffer.
(2) Lock that buffer into memory.
(3) Call some driver that DMAs data to/from that buffer.
Although I have never done this, I have heard that this is what
screen-cards (X-Servers), and audio boards have been doing. Also,
I'm told my some M$xperts that this is what "Direct-X" does. I
don't know anything about the direct-to/from user DMA, as is obvious,
but if that's being closed-off, there may be a problem that's
just beginning.
For some reason, (claimed performance reasons) user-mode code
has to be able to get data directly from hardware with no
intervening copy operation. I think any claimed advantage goes
away when you look at the overhead necessary for user-mode
code to sleep before, and awaken after, the DMA operation but
often marketing departments make those decisions.
So, is it correct that you cannot DMA to/from a user buffer?
Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.
next prev parent reply other threads:[~2002-09-09 18:10 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-09 17:06 Calculating kernel logical address Imran Badr
2002-09-09 17:29 ` Richard B. Johnson
2002-09-09 17:23 ` David S. Miller
2002-09-09 17:34 ` Martin J. Bligh
2002-09-09 17:40 ` Daniel Phillips
2002-09-09 17:31 ` Imran Badr
2002-09-09 18:00 ` Richard B. Johnson
2002-09-09 18:12 ` Imran Badr [this message]
2002-09-09 18:27 ` Daniel Phillips
2002-09-09 18:41 ` Imran Badr
2002-09-09 21:55 ` Alan Cox
2002-09-09 22:52 ` Imran Badr
2002-09-09 23:09 ` Alan Cox
2002-09-09 18:13 ` Jesse Barnes
2002-09-09 18:25 ` Daniel Phillips
2002-09-09 19:40 ` Andrew Morton
2002-09-09 20:41 ` Daniel Phillips
2002-09-10 6:43 ` Jens Axboe
2002-09-10 7:12 ` Andrew Morton
2002-09-09 18:42 ` Andrew Morton
2002-09-10 7:03 ` Gerd Knorr
2002-09-09 18:16 ` Kurt Ferreira
2002-09-09 18:17 ` David S. Miller
2002-09-09 18:17 ` Daniel Phillips
2002-09-09 18:43 ` Richard B. Johnson
2002-09-09 18:50 ` Daniel Phillips
2002-09-09 18:57 ` Richard B. Johnson
2002-09-09 18:08 ` Andrew Morton
2002-09-09 18:23 ` Daniel Phillips
2002-09-09 18:49 ` Imran Badr
2002-09-09 18:46 ` David S. Miller
2002-09-09 19:06 ` Daniel Phillips
2002-09-09 19:14 ` Andrew Morton
2002-09-09 19:23 ` Imran Badr
-- strict thread matches above, loose matches on Subject: below --
2002-09-09 21:19 Manfred Spraul
2002-09-09 21:47 ` Andrew Morton
2002-09-10 17:01 ` Manfred Spraul
2002-09-09 21:02 Manfred Spraul
2002-09-09 21:07 ` Imran Badr
2002-09-06 15:44 Manfred Spraul
2002-09-06 17:13 ` Imran Badr
2002-09-07 1:57 ` Daniel Phillips
2002-09-06 3:23 side-by-side Re: BYTE Unix Benchmarks Version 3.6 Daniel Phillips
2002-09-06 3:34 ` Calculating kernel logical address Imran Badr
2002-09-07 1:44 ` Daniel Phillips
2002-09-08 0:01 ` David S. Miller
2002-09-08 18:44 ` Daniel Phillips
2002-09-09 5:00 ` David S. Miller
2002-09-09 5:17 ` Daniel Phillips
2002-09-09 5:28 ` David S. Miller
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='01a301c2582c$754dbf30$9e10a8c0@IMRANPC' \
--to=imran.badr@cavium.com \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=phillips@arcor.de \
--cc=root@chaos.analogic.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