From: "Hans J. Koch" <hjk-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
To: Edward Estabrook
<edward.estabrook.lkml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
hjk-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
gregkh-l3A5Bk7waGM@public.gmane.org,
edward.estabrook-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
edward_estabrook-+2HdxjxtzLdBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH 1/1] Userspace I/O (UIO): Add support for userspace DMA (corrected)
Date: Thu, 11 Dec 2008 01:33:41 +0100 [thread overview]
Message-ID: <20081211003340.GB3078@local> (raw)
In-Reply-To: <208aa0f00812031751n27a75d21h8747054651639463-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wed, Dec 03, 2008 at 05:51:30PM -0800, Edward Estabrook wrote:
> From: Edward Estabrook <Edward_Estabrook-+2HdxjxtzLdBDgjK7y7TUQ@public.gmane.org>
>
> Here is a patch that adds the ability to dynamically allocate and use
> coherent DMA
> from userspace by extending the Userspace IO driver. This patch applies against
> 2.6.28-rc6.
Hi Edward,
sorry I didn't answer sooner. It was not lack of interest in your work, I
just had to think about it (and had quite a lot of other work, too).
I consider your idea of having DMA coherent memory allocatable from userspace
a valid demand. However, the interface should be implemented differently.
As a general requirement, all information you need to pass to userspace has
to go through sysfs. This is a UIO design decision and should not be changed
lightly. Please don't fill information into the allocated memory.
We shouldn't mix dynamically allocated DMA regions with the already existing
static memory mappings. There should be an extra directory, maybe called
/sys/class/uio/uioN/dyn_dma_mem/ containing information about this kind of
DMA memory. This directory would not exist by default, it's only created if
some user actually allocates such memory.
In the UIO core, these mappings should be handled with a dynamic list, not
a static array. The number of possible mappings has to be limited to a
sensible maximum, maybe 50 or 100. The code handling the existing static
mappings could mostly stay as-is.
Userspace can allocate new DMA memory by using some magic number as the offset
parameter of mmap() like you suggested. However, this magic should be just one
of the bits 16..31 (e.g. 0x00010000) to have other bits available for future
extensions.
I think you should also reconsider the way you unmap the memory. It's certainly
right to unmap everything when the device is unregistered, but I think there's
more to think about:
- Should the memory be freed as soon as all users have the device closed?
- What happens if a user calls munmap() on such a mapping?
I'm looking forward to your next version.
Thanks,
Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-12-11 0:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-04 1:51 [PATCH 1/1] Userspace I/O (UIO): Add support for userspace DMA (corrected) Edward Estabrook
[not found] ` <208aa0f00812031751n27a75d21h8747054651639463-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-12-04 4:17 ` Greg KH
[not found] ` <20081204041739.GA16329-l3A5Bk7waGM@public.gmane.org>
2008-12-04 5:34 ` Edward Estabrook
2008-12-04 19:40 ` Hans J. Koch
2008-12-06 0:16 ` Edward Estabrook
2008-12-11 0:33 ` Hans J. Koch [this message]
2008-12-25 12:30 ` Joerg Roedel
[not found] ` <20081225123004.GA13640-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2008-12-25 15:20 ` Hans J. Koch
2008-12-27 0:49 ` Andreas Bombe
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=20081211003340.GB3078@local \
--to=hjk-hfztesqfncyowbw4kg4ksq@public.gmane.org \
--cc=edward.estabrook-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=edward.estabrook.lkml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=edward_estabrook-+2HdxjxtzLdBDgjK7y7TUQ@public.gmane.org \
--cc=gregkh-l3A5Bk7waGM@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).