diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-08-25 12:28:57 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-08-26 21:54:54 -0400 |
commit | 88d7ebe59341dc3b82e662b80809694e3c6b3766 (patch) | |
tree | c9b89ab9ba6b2310e270b67600ca790cc85e24c3 /drivers/mfd/twl6040.c | |
parent | 291d284c6004e3a63d0c2f6c31570ab2126843a8 (diff) |
drm/vma: add access management helpers
The VMA offset manager uses a device-global address-space. Hence, any
user can currently map any offset-node they want. They only need to guess
the right offset. If we wanted per open-file offset spaces, we'd either
need VM_NONLINEAR mappings or multiple "struct address_space" trees. As
both doesn't really scale, we implement access management in the VMA
manager itself.
We use an rb-tree to store open-files for each VMA node. On each mmap
call, GEM, TTM or the drivers must check whether the current user is
allowed to map this file.
We add a separate lock for each node as there is no generic lock available
for the caller to protect the node easily.
As we currently don't know whether an object may be used for mmap(), we
have to do access management for all objects. If it turns out to slow down
handle creation/deletion significantly, we can optimize it in several
ways:
- Most times only a single filp is added per bo so we could use a static
"struct file *main_filp" which is checked/added/removed first before we
fall back to the rbtree+drm_vma_offset_file.
This could be even done lockless with rcu.
- Let user-space pass a hint whether mmap() should be supported on the
bo and avoid access-management if not.
- .. there are probably more ideas once we have benchmarks ..
v2: add drm_vma_node_verify_access() helper
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/mfd/twl6040.c')
0 files changed, 0 insertions, 0 deletions