public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Keith Packard <keithp@keithp.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
	Dave Airlie <airlied@gmail.com>,
	Christoph Hellwig <hch@infradead.org>,
	Eric Anholt <eric@anholt.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
Date: Tue, 19 Aug 2008 11:50:11 -0700	[thread overview]
Message-ID: <200808191150.12345.jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1219164367.10772.420.camel@koto.keithp.com>

On Tuesday, August 19, 2008 9:46 am Keith Packard wrote:
> On Tue, 2008-08-19 at 20:00 +1000, Nick Piggin wrote:
> > Not exactly sure what you mean by this. But I would like to see an effort
> > made to use existing userspace APIs in order to do this swappable object
> > allocation over tmpfs scheme. As I said, I don't object to a nice kernel
> > implementation, but we would be in a much better position to assess it if
> > we had an existing userspace implementation to compare it with.
>
> We need to allocate objects from kernel mode to get the console running.
> I'd prefer to let that occur before user mode was available. Also,
> emulating the existing fbdev syscall interface will require that we
> allocate objects within the kernel.

Yeah there's no question we need early kernel space allocations of GEM 
objects.  We need to setup the frame buffer, ring buffer, hardware status 
page, and potentially other state at module init time so that people can see 
their boot messages.

> Hence, the question about how we should create objects from kernel mode.
> I think we can do this with a series of VFS function calls. Would that
> series of VFS calls be preferable to directly accessing the existing
> shmem API?
>
> Another alternative is to improve the existing shmem API to better
> capture what we're trying to do here. Both drm and sysv shm just want
> anonymous pages that are backed by swap. If we started from scratch,
> what API would we like to have here? Would we have it support both shmem
> and hugetlbfs?

Improving the shmem API makes sense to me.  There's a flip side to using the 
ioctls as well; in doing the GTT mapping with the current code, I had to add 
a new ioctl and create a new core function that would allow me to do I/O 
remapping from something other than an ->mmap hook.  I think we could have 
conceptually cleaner code and less hassle if we extended shmem a bit to allow 
for shmem "drivers" that could hook into its open/close/mmap/etc. routines 
(though in the mmap case in particular we'd either need to abuse an existing 
mmap flag or create a new one to recognize the backing store/GTT mapping 
distinction).

What do you think, Nick?  Adding this stuff to shmem would probably involve 
using the file->private_data inside shmem, and creating a new sub-driver 
registration function, then checking for sub-ops in the various important 
shmem operations structs...

The advantage of all this is that we could probably use regular fds for the 
most part (assuming we get a "high fd" mapping function sometime soon), and 
all the regular file operations routines, making GEM look a like more like a 
regular file system driver.

As for in-kernel stuff, as long as we keep the GEM shmem hooks separate from 
the actual bookkeeping (like we do now with i915_gem_create_ioctl() vs 
drm_gem_object_alloc() for example) we should be able to do the in-kernel 
stuff w/o jumping through too many VFS/VM hoops.  That would also assume we 
don't care about swapping in the in-kernel case, which we don't; we want to 
pin the kernel allocated frame buffer and other memory anyway, so using the 
internal functions should be fine.

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center

  reply	other threads:[~2008-08-19 18:50 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-01  6:58 [PATCH] PCI: Add pci_read_base() API Eric Anholt
2008-08-01  6:58 ` [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM Eric Anholt
2008-08-01  6:58   ` [PATCH] drm: Add GEM ("graphics execution manager") to i915 driver Eric Anholt
2008-08-01 15:44     ` Randy Dunlap
2008-08-01 18:11       ` Keith Packard
2008-08-06  1:11       ` Eric Anholt
2008-08-01  7:10   ` [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM Eric Anholt
2008-08-01 10:57   ` Hugh Dickins
2008-08-01 18:06     ` Keith Packard
2008-08-01 20:50   ` Christoph Hellwig
2008-08-01 23:01     ` Keith Packard
2008-08-03 12:49       ` John Stoffel
2008-08-03 17:52         ` Keith Packard
2008-08-03 23:35           ` files/process scaling problem? (was: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM) Ingo Oeser
2008-08-04  0:19             ` Keith Packard
2008-08-04  8:19               ` Alan Cox
2008-08-04 13:51                 ` Arjan van de Ven
2008-08-04 14:11                   ` Alan Cox
2008-08-04 16:38                     ` Arjan van de Ven
2008-08-04 16:58                     ` Keith Packard
2008-08-04 21:46                       ` Ingo Oeser
2008-08-04 22:20                         ` Dave Airlie
2008-08-05  0:34                         ` Keith Packard
2008-08-11  1:23       ` [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM Christoph Hellwig
2008-08-11  3:03         ` [PATCH] Export shmem_file_setup " Keith Packard
2008-08-04  1:54     ` [PATCH] Export shmem_file_setup and shmem_getpage " Keith Packard
2008-08-04  9:02       ` Nick Piggin
2008-08-04 10:26         ` Keith Packard
2008-08-04 10:43           ` Nick Piggin
2008-08-04 11:45             ` Keith Packard
2008-08-04 17:09               ` Hugh Dickins
2008-08-04 17:25                 ` Keith Packard
2008-08-04 18:39                   ` Hugh Dickins
2008-08-04 19:20                     ` Keith Packard
2008-08-04 19:55                       ` Hugh Dickins
2008-08-04 21:37                         ` Keith Packard
2008-08-05  2:25                         ` John Stoffel
2008-08-05  4:28                           ` Keith Packard
2008-08-06 16:20                             ` Stephane Marchesin
2008-08-06 17:24                               ` Arjan van de Ven
2008-08-06 17:32                                 ` Stephane Marchesin
2008-08-06 17:56                                   ` Keith Packard
2008-08-06 18:09                                     ` Stephane Marchesin
2008-08-06 21:22                                       ` Keith Packard
2008-08-07  2:16                                 ` Stephane Marchesin
2008-08-07  2:57                                   ` Keith Packard
2008-08-11  1:34                                 ` Christoph Hellwig
2008-08-05  4:28                 ` Nick Piggin
2008-08-11  1:30                 ` Christoph Hellwig
2008-08-04 21:58         ` Keith Packard
2008-08-04 22:22           ` Dave Airlie
2008-08-05  4:43           ` Nick Piggin
2008-08-05  5:19             ` Keith Packard
2008-08-07  0:45             ` Jesse Barnes
2008-08-19  1:17             ` Dave Airlie
2008-08-19 10:00               ` Nick Piggin
2008-08-19 16:46                 ` Keith Packard
2008-08-19 18:50                   ` Jesse Barnes [this message]
2008-08-21 13:42                     ` Jerome Glisse
2008-08-21 16:15                       ` Jesse Barnes

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=200808191150.12345.jbarnes@virtuousgeek.org \
    --to=jbarnes@virtuousgeek.org \
    --cc=airlied@gmail.com \
    --cc=eric@anholt.net \
    --cc=hch@infradead.org \
    --cc=keithp@keithp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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