All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-kernel@vger.kernel.org, fuse-devel@lists.sourceforge.net,
	akpm@linux-foundation.org, npiggin@suse.de
Subject: Re: [PATCH 4/4] FUSE: implement direct mmap
Date: Sat, 04 Jul 2009 20:14:32 +0900	[thread overview]
Message-ID: <4A4F3998.5020805@kernel.org> (raw)
In-Reply-To: <E1MMMgq-0002R2-FO@pomaz-ex.szeredi.hu>

Hello, Miklos.

Miklos Szeredi wrote:
>> Simlar thing can be done by letting the kernel part of fuse keep track
>> of mapped pages using server provided page IDs and letting the server
>> determine sharing or creation of pages and communicate it to the
>> kernel part.  It would require more code but the interface should be
>> less convoluted and more flexible.  Is this what you have in mind?
> 
> Something like that.  In fact we could possibly allow even sharing the
> pages with userspace, similarly to how drivers do it with the
> hardware.

This was possible with the original implementation.  Hmmm... we'll
need some sort of filehandle to represent the address space one way or
the other.

> Afaics sound drivers now map the dma memory with remap_pfn_range().
> Similary we could allocate a chunk of non-swapabble kernel memory on
> request from the userspace server and map its pages using this trick
> to both the server's and the client's address space.
> 
> This is still sort of OSSP specific, I don't see clearly how it could
> be made more generic.

Using non-swappable memory would be fine for most device emulations
but mapping large amount of pages would be problematic.  Hmmm... this
is difficult.  It's a compromise among flexibility, scalability and
code complexity.

>>>> mmap request is handled in two steps.  MMAP first queries the server
>>>> whether it wants to share the mapping with an existing one or create a
>>>> new one, and if so, with which flags.  MMAP_COMMIT notifies the server
>>>> the result of mmap and if successful the fd the server can use to
>>>> access the mmap region.
>>> And you might have noticed I'm not a big fan of these three way handshake
>>> messages ;)
>> Believe it or not, I'm not particularly big fan of it either.  I just
>> couldn't think of anything better at the time.  :-)
> 
> A better scheme would be to assume that MMAP is successful, and if
> there's an error, send a MUNMAP request.  That way the normal case is
> simpler and there's no need for an extra message type.

The reason why the second stage was necessary was because the fd needs
to be communicated back to the server.  The kernel doesn't know
whether the server wants to share an existing fd or create a new one
so the MMAP queries that and MMAP_COMMIT communicates newly created fd
if necessary.  What can be done is to always create a new fd and let
the server override it if it wants the map to be shared and then the
kernel can kill the unused fd.

Thanks.

-- 
tejun

  reply	other threads:[~2009-07-04 11:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-18  9:24 [PATCHSET] FUSE/CUSE: implement direct mmap, take#3 Tejun Heo
2009-06-18  9:24 ` [PATCH 1/4] fdtable: export alloc_fd() Tejun Heo
2009-06-24  4:39   ` Al Viro
2009-06-30  3:05     ` Tejun Heo
2009-06-18  9:24 ` [PATCH 2/4] FUSE: make request_wait_answer() wait for ->end() completion Tejun Heo
     [not found]   ` <20090623165354.073a61fe.akpm@linux-foundation.org>
2009-06-24  0:04     ` Tejun Heo
2009-06-24 10:02   ` Miklos Szeredi
2009-06-29 16:20     ` Tejun Heo
2009-06-18  9:24 ` [PATCH 3/4] FUSE: implement fuse_req->prep() Tejun Heo
2009-06-23 23:56   ` Andrew Morton
2009-06-24  0:07     ` Tejun Heo
2009-06-18  9:24 ` [PATCH 4/4] FUSE: implement direct mmap Tejun Heo
2009-06-24  0:14   ` Andrew Morton
2009-06-29 16:59     ` Tejun Heo
2009-06-24 10:33   ` Miklos Szeredi
2009-06-29 16:42     ` Tejun Heo
2009-07-02 13:51       ` Miklos Szeredi
2009-07-04 11:14         ` Tejun Heo [this message]
2009-07-06 11:41           ` Miklos Szeredi
2009-07-08 23:14             ` Tejun Heo
2009-07-09 10:35               ` Miklos Szeredi
2009-06-18  9:27 ` [PATCH libfuse] implement direct mmap support Tejun Heo

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=4A4F3998.5020805@kernel.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=npiggin@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.