linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Pavel Roskin <proski@gnu.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Zan Lynx <zlynx@acm.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Jon Masters <jcm@jonmasters.org>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH 2.6.25] module: allow ndiswrapper to use GPL-only symbols
Date: Tue, 4 Mar 2008 13:57:44 +0100	[thread overview]
Message-ID: <20080304125744.GF29777@elte.hu> (raw)
In-Reply-To: <20080304003723.z79pcavdk4wgoc44@webmail.spamcop.net>


* Pavel Roskin <proski@gnu.org> wrote:

>>> ndiswrapper contains essentially two drivers in one - PCI and USB. 
>>> The PCI driver uses DMA, which should be a strong argument for 
>>> keeping it in the kernel.
>>
>> how exactly does it use DMA - how does it allocate the memory it 
>> later on DMAs into, and how does it typically program that DMA target 
>> - is there any control over that in the NDIS protocol - or will NDIS 
>> drivers just write random addresses to the mmio space and then the 
>> hardware does DMA to/from those addresses? [without the NDIS 
>> framework having any knowledge about the encoding of those bits?]
>
> Sorry for delay.  I'm really not sure.  The maintainer of ndiswrapper 
> is currently offline, and I'm just trying to take care of the basic 
> stuff.
>
> All I can say is NdisMAllocateSharedMemory maps to 
> dma_alloc_coherent(), and there are some references to scatter-gather 
> lists.  There is a call to dma_map_single(), which is ultimately 
> called by the Tx function net_dev->hard_start_xmit.
>
> I understand there is some control from NDIS.  At least it can request 
> memory available for DMA.

so ... i suspect the requirement would be for 
NdisMAllocateSharedMemory() to return a linear address that is DMA-able, 
and to properly map it to a physical address via dma_map_single(). I can 
see only one complication in pushing this to user-space: physical 
fragmentation of allocations. What are the typical buffer sizes that 
NDIS drivers request from the kernel? Is it frequently above 4K?

you could try to create a syscall-ish API towards the kernel that allows 
DMA, it would have the following functionality:

- allocate a piece of continuous memory and return its physical address
  plus its linear address as well and map the linear address into the
  user-space pagetables. This memory would be unfragmented on the 
  physical side.

you probably could even use/hack hugetlbfs right now to achieve 
something very similar. (hugetlbfs pages are unfragmented 2MB 
largepages)

if the NDIS API is done halfways right, then there's no need for any of 
these buffers to be in kernel-space and for the driver to run in kernel 
space.

i think someone should really try to push a known-well-behaving NDIS 
driver (for which a Linux driver exists too) down to user-space. NDIS 
has been around since Netware so it's a pretty well-understood driver 
model. And with an iommu it could all be made a safe sandbox as well (an 
NDIS device could never exit its sandbox).

	Ingo

  reply	other threads:[~2008-03-04 12:58 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28 22:11 [PATCH 2.6.25] module: allow ndiswrapper to use GPL-only symbols Pavel Roskin
2008-02-28 23:25 ` Linus Torvalds
2008-02-29  6:20   ` Pavel Roskin
2008-02-29 16:08     ` Linus Torvalds
2008-02-29 16:54       ` Chris Friesen
2008-02-29 17:06         ` Linus Torvalds
2008-02-29 17:59           ` Chris Friesen
2008-03-06 14:56         ` David Woodhouse
2008-02-29 16:59       ` Zan Lynx
2008-02-29 17:07         ` Linus Torvalds
2008-02-29 17:20           ` Pavel Roskin
2008-02-29 17:33             ` Linus Torvalds
2008-02-29 19:39               ` Pavel Roskin
2008-02-29 19:53                 ` Linus Torvalds
2008-02-29 20:08                   ` Pavel Roskin
2008-02-29 20:28                     ` Linus Torvalds
2008-02-29 21:13                       ` Pavel Roskin
2008-02-29 20:17                 ` John W. Linville
2008-02-29 20:40                   ` David Newall
2008-02-29 20:59                     ` Pavel Roskin
2008-02-29 21:08                       ` David Newall
2008-02-29 22:17                         ` Pavel Roskin
2008-03-01  8:15                           ` David Newall
2008-02-29 20:44                   ` Pavel Roskin
2008-02-29 21:15                 ` Ingo Molnar
2008-02-29 22:31                   ` Pavel Roskin
2008-03-03 10:57                     ` Ingo Molnar
2008-03-04  5:37                       ` Pavel Roskin
2008-03-04 12:57                         ` Ingo Molnar [this message]
2008-03-04 17:19                           ` Linus Torvalds
2008-03-04 17:38                             ` Greg KH
2008-03-04 17:45                             ` Pavel Roskin
2008-03-04 21:20                               ` Ingo Molnar
2008-03-04 23:23                                 ` Pavel Roskin
2008-03-04 20:51                             ` Ingo Molnar
2008-03-04 23:25                               ` Jiri Kosina
2008-03-05 13:21                                 ` Ingo Molnar
2008-02-29 17:18         ` Jon Masters
2008-02-29 21:55           ` Adrian Bunk

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=20080304125744.GF29777@elte.hu \
    --to=mingo@elte.hu \
    --cc=jcm@jonmasters.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=proski@gnu.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@linux-foundation.org \
    --cc=zlynx@acm.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).