linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Herrmann <dh.herrmann@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Dave Airlie <airlied@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	David Herrmann <dh.herrmann@gmail.com>
Subject: [PATCH v2 0/4] Anonymous Inode Allocations
Date: Tue, 13 Aug 2013 19:42:15 +0200	[thread overview]
Message-ID: <1376415739-11685-1-git-send-email-dh.herrmann@gmail.com> (raw)
In-Reply-To: <1373499930-5055-1-git-send-email-dh.herrmann@gmail.com>

Hi

This is v2 of my anon_inodes allocation series. I would really like some
comments on #1 (and maybe #2) from VFS maintainers/developers so we can continue
with this work. Patches 1 and 2 are unchanged, I added 3 and 4 to clean up DRM
delayed initializations based on the new anon_inode.


This implements anon_inodes_new() to create anonymous inodes. Patch #1
describes the changes to anon_inodes.c and why DRM could make great use of this.
Patch #2 converts DRM core to use anon_inodes_new() instead of delayed
dev_mapping initialization. Patches #3 and #4 simplify the various driver bits
to drop unused code paths.

The idea is to get an anonymous backing inode for DRM devices without waiting
for the first char-dev inode. We use it to unmap userspace mappings via
unmap_mapping_range() if we have to evict buffers if GTT runs short or if the FW
framebuffers are destroyed.
We need the inode only once the first user-space mapping was created. But the
delayed initialization causes an ugly code base and keeps inodes of char-devs
around just to preserve the address_space.

We actually only need the address_space, but mm core requires a corresponding
file* and FS core requires mapping->host to be set (although I am not sure
whether we can hit those paths with char-devs). So I went with the whole
anonymous inode approach.

If anyone has an idea how to use an embedded "struct address_space" inside of
"drm_device" and set "dev_mapping->host" to the shared anon_inode_inode, I'd be
happy to implement it. However, I didn't succeed and I am actually not sure that
separate "struct address_space" are actually supported. For instance, DRM core
uses code like:
  container_of(dev_mapping, struct inode, i_data)
which would break in this case.

Cheers
David

David Herrmann (4):
  anon_inodes: allow external inode allocations
  DRM: use anon_inode instead of delayed inode init
  drm: init TTM dev_mapping in ttm_bo_device_init()
  drm/omap: remove useless if() in evict_entry()

 drivers/gpu/drm/ast/ast_ttm.c          |  4 +++-
 drivers/gpu/drm/cirrus/cirrus_ttm.c    |  4 +++-
 drivers/gpu/drm/drm_drv.c              |  1 -
 drivers/gpu/drm/drm_fops.c             | 24 +++--------------------
 drivers/gpu/drm/drm_stub.c             | 12 +++++++++++-
 drivers/gpu/drm/i915/i915_gem.c        |  3 ++-
 drivers/gpu/drm/mgag200/mgag200_ttm.c  |  4 +++-
 drivers/gpu/drm/nouveau/nouveau_gem.c  |  2 --
 drivers/gpu/drm/nouveau/nouveau_ttm.c  |  4 +++-
 drivers/gpu/drm/omapdrm/omap_gem.c     | 33 +++++++++++++++----------------
 drivers/gpu/drm/qxl/qxl_object.c       |  2 --
 drivers/gpu/drm/qxl/qxl_ttm.c          |  6 +++---
 drivers/gpu/drm/radeon/radeon_object.c |  1 -
 drivers/gpu/drm/radeon/radeon_ttm.c    |  5 +++--
 drivers/gpu/drm/ttm/ttm_bo.c           |  3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c    |  5 +++--
 fs/anon_inodes.c                       | 36 +++++++++++++++++++++++++++-------
 include/drm/drmP.h                     |  2 +-
 include/drm/drm_vma_manager.h          |  6 +++---
 include/drm/ttm/ttm_bo_driver.h        |  2 ++
 include/linux/anon_inodes.h            |  1 +
 21 files changed, 91 insertions(+), 69 deletions(-)

-- 
1.8.3.4

  parent reply	other threads:[~2013-08-13 17:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 23:45 [PATCH 0/2] Anonymous Inode Allocations David Herrmann
2013-07-10 23:45 ` [PATCH 1/2] anon_inodes: allow external inode allocations David Herrmann
2013-07-11  6:29   ` Daniel Vetter
2013-07-24  9:45   ` David Herrmann
2013-07-10 23:45 ` [PATCH 2/2] DRM: use anon_inode instead of delayed inode init David Herrmann
2013-07-11  6:57   ` Daniel Vetter
2013-08-13 17:42 ` David Herrmann [this message]
2013-08-13 17:42   ` [PATCH v2 1/4] anon_inodes: allow external inode allocations David Herrmann
2013-08-13 17:42   ` [PATCH v2 2/4] DRM: use anon_inode instead of delayed inode init David Herrmann
2013-08-13 17:42   ` [PATCH v2 3/4] drm: init TTM dev_mapping in ttm_bo_device_init() David Herrmann
2013-08-13 17:42   ` [PATCH v2 4/4] drm/omap: remove useless if() in evict_entry() David Herrmann

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=1376415739-11685-1-git-send-email-dh.herrmann@gmail.com \
    --to=dh.herrmann@gmail.com \
    --cc=airlied@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).