1. 08 1月, 2014 3 次提交
  2. 20 11月, 2013 1 次提交
    • T
      drm/ttm: Remove set_need_resched from the ttm fault handler · c58f009e
      Thomas Hellstrom 提交于
      Addresses
      "[BUG] completely bonkers use of set_need_resched + VM_FAULT_NOPAGE".
      
      In the first occurence it was used to try to be nice while releasing the
      mmap_sem and retrying the fault to work around a locking inversion.
      The second occurence was never used.
      
      There has been some discussion whether we should change the locking order to
      mmap_sem -> bo_reserve. This patch doesn't address that issue, and leaves
      that locking order undefined. The solution that we release the mmap_sem if
      tryreserve fails and wait for the buffer to become unreserved is something
      we want in any case, and follows how the core vm system waits for pages
      to be come unlocked while releasing the mmap_sem.
      
      The code also outlines what needs to be changed if we want to establish the
      locking order as mmap_sem -> bo::reserve.
      
      One slight issue that remains with this code is that the fault handler might
      be prone to starvation if another thread countinously reserves the buffer.
      IMO that usage pattern is highly unlikely.
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      c58f009e
  3. 13 11月, 2013 1 次提交
  4. 06 11月, 2013 1 次提交
  5. 19 8月, 2013 1 次提交
  6. 25 7月, 2013 1 次提交
    • D
      drm/ttm: convert to unified vma offset manager · 72525b3f
      David Herrmann 提交于
      Use the new vma-manager infrastructure. This doesn't change any
      implementation details as the vma-offset-manager is nearly copied 1-to-1
      from TTM.
      
      The vm_lock is moved into the offset manager so we can drop it from TTM.
      During lookup, we use the vma locking helpers to take a reference to the
      found object.
      In all other scenarios, locking stays the same as before. We always
      guarantee that drm_vma_offset_remove() is called only during destruction.
      Hence, helpers like drm_vma_node_offset_addr() are always safe as long as
      the node has a valid offset.
      
      This also drops the addr_space_offset member as it is a copy of vm_start
      in vma_node objects. Use the accessor functions instead.
      
      v4:
       - remove vm_lock
       - use drm_vma_offset_lock_lookup() to protect lookup (instead of vm_lock)
      
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
      Cc: Martin Peres <martin.peres@labri.fr>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@gmail.com>
      72525b3f
  7. 16 4月, 2013 1 次提交
  8. 28 11月, 2012 1 次提交
  9. 09 10月, 2012 1 次提交
    • K
      mm: kill vma flag VM_RESERVED and mm->reserved_vm counter · 314e51b9
      Konstantin Khlebnikov 提交于
      A long time ago, in v2.4, VM_RESERVED kept swapout process off VMA,
      currently it lost original meaning but still has some effects:
      
       | effect                 | alternative flags
      -+------------------------+---------------------------------------------
      1| account as reserved_vm | VM_IO
      2| skip in core dump      | VM_IO, VM_DONTDUMP
      3| do not merge or expand | VM_IO, VM_DONTEXPAND, VM_HUGETLB, VM_PFNMAP
      4| do not mlock           | VM_IO, VM_DONTEXPAND, VM_HUGETLB, VM_PFNMAP
      
      This patch removes reserved_vm counter from mm_struct.  Seems like nobody
      cares about it, it does not exported into userspace directly, it only
      reduces total_vm showed in proc.
      
      Thus VM_RESERVED can be replaced with VM_IO or pair VM_DONTEXPAND | VM_DONTDUMP.
      
      remap_pfn_range() and io_remap_pfn_range() set VM_IO|VM_DONTEXPAND|VM_DONTDUMP.
      remap_vmalloc_range() set VM_DONTEXPAND | VM_DONTDUMP.
      
      [akpm@linux-foundation.org: drivers/vfio/pci/vfio_pci.c fixup]
      Signed-off-by: NKonstantin Khlebnikov <khlebnikov@openvz.org>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Carsten Otte <cotte@de.ibm.com>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Morris <james.l.morris@oracle.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Suresh Siddha <suresh.b.siddha@intel.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Venkatesh Pallipadi <venki@google.com>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      314e51b9
  10. 20 3月, 2012 1 次提交
  11. 06 12月, 2011 1 次提交
  12. 28 10月, 2011 1 次提交
  13. 01 9月, 2011 1 次提交
    • M
      drm/ttm: add a way to bo_wait for either the last read or last write · dfadbbdb
      Marek Olšák 提交于
      Sometimes we want to know whether a buffer is busy and wait for it (bo_wait).
      However, sometimes it would be more useful to be able to query whether
      a buffer is busy and being either read or written, and wait until it's stopped
      being either read or written. The point of this is to be able to avoid
      unnecessary waiting, e.g. if a GPU has written something to a buffer and is now
      reading that buffer, and a CPU wants to map that buffer for read, it needs to
      only wait for the last write. If there were no write, there wouldn't be any
      waiting needed.
      
      This, or course, requires user space drivers to send read/write flags
      with each relocation (like we have read/write domains in radeon, so we can
      actually use those for something useful now).
      
      Now how this patch works:
      
      The read/write flags should passed to ttm_validate_buffer. TTM maintains
      separate sync objects of the last read and write for each buffer, in addition
      to the sync object of the last use of a buffer. ttm_bo_wait then operates
      with one the sync objects.
      Signed-off-by: NMarek Olšák <maraeo@gmail.com>
      Reviewed-by: NJerome Glisse <jglisse@redhat.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      dfadbbdb
  14. 22 11月, 2010 2 次提交
    • T
      drm/ttm: Fix up io_mem_reserve / io_mem_free calling · eba67093
      Thomas Hellstrom 提交于
      This patch attempts to fix up shortcomings with the current calling
      sequences.
      
      1) There's a fastpath where no locking occurs and only io_mem_reserved is
         called to obtain needed info for mapping. The fastpath is set per
         memory type manager.
      2) If the fastpath is disabled, io_mem_reserve and io_mem_free will be exactly
         balanced and not called recursively for the same struct ttm_mem_reg.
      3) Optionally the driver can choose to enable a per memory type manager LRU
         eviction mechanism that, when io_mem_reserve returns -EAGAIN will attempt
         to kill user-space mappings of memory in that manager to free up needed
         resources
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      Reviewed-by: NBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      eba67093
    • T
      drm/ttm/radeon/nouveau: Kill the bo lock in favour of a bo device fence_lock · 702adba2
      Thomas Hellstrom 提交于
      The bo lock used only to protect the bo sync object members, and since it
      is a per bo lock, fencing a buffer list will see a lot of locks and unlocks.
      Replace it with a per-device lock that protects the sync object members on
      *all* bos. Reading and setting these members will always be very quick, so
      the risc of heavy lock contention is microscopic. Note that waiting for
      sync objects will always take place outside of this lock.
      
      The bo device fence lock will eventually be replaced with a seqlock /
      rcu mechanism so we can determine that a bo is idle under a
      rcu / read seqlock.
      
      However this change will allow us to batch fencing and unreserving of
      buffers with a minimal amount of locking.
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      Reviewed-by: NJerome Glisse <j.glisse@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      702adba2
  15. 20 4月, 2010 1 次提交
    • J
      drm/ttm: ttm_fault callback to allow driver to handle bo placement V6 · 82c5da6b
      Jerome Glisse 提交于
      On fault the driver is given the opportunity to perform any operation
      it sees fit in order to place the buffer into a CPU visible area of
      memory. This patch doesn't break TTM users, nouveau, vmwgfx and radeon
      should keep working properly. Future patch will take advantage of this
      infrastructure and remove the old path from TTM once driver are
      converted.
      
      V2 return VM_FAULT_NOPAGE if callback return -EBUSY or -ERESTARTSYS
      V3 balance io_mem_reserve and io_mem_free call, fault_reserve_notify
         is responsible to perform any necessary task for mapping to succeed
      V4 minor cleanup, atomic_t -> bool as member is protected by reserve
         mecanism from concurent access
      V5 the callback is now responsible for iomapping the bo and providing
         a virtual address this simplify TTM and will allow to get rid of
         TTM_MEMTYPE_FLAG_NEEDS_IOREMAP
      V6 use the bus addr data to decide to ioremap or this isn't needed
         but we don't necesarily need to ioremap in the callback but still
         allow driver to use static mapping
      Signed-off-by: NJerome Glisse <jglisse@redhat.com>
      Reviewed-by: NThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      82c5da6b
  16. 16 12月, 2009 1 次提交
  17. 10 12月, 2009 1 次提交
  18. 28 9月, 2009 1 次提交
  19. 29 7月, 2009 1 次提交
    • D
      drm/radeon/kms: add initial colortiling support. · e024e110
      Dave Airlie 提交于
      This adds new set/get tiling interfaces where the pitch
      and macro/micro tiling enables can be set. Along with
      a flag to decide if this object should have a surface when mapped.
      
      The only thing we need to allocate with a mapped surface should be
      the frontbuffer. Note rotate scanout shouldn't require one, and
      back/depth shouldn't either, though mesa needs some fixes.
      
      It fixes the TTM interfaces along Thomas's suggestions, and I've tested
      the surface stealing code with two X servers and not seen any lockdep issues.
      
      I've stopped tiling the fbcon frontbuffer, as I don't see there being
      any advantage other than testing, I've left the testing commands in there,
      just flip the fb_tiled to true in radeon_fb.c
      
      Open: Can we integrate endian swapping in with this?
      
      Future features:
      texture tiling - need to relocate texture registers TXOFFSET* with tiling info.
      
      This also merges Michel's cleanup surfaces regs at init time patch
      even though it makes sense on its own, this patch really relies on it.
      
      Some PowerMac firmwares set up a tiling surface at the beginning of VRAM
      which messes us up otherwise.
      that patch is:
      Signed-off-by: NMichel Dänzer <daenzer@vmware.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      e024e110
  20. 15 7月, 2009 1 次提交
  21. 24 6月, 2009 1 次提交
  22. 15 6月, 2009 1 次提交
    • T
      drm: Add the TTM GPU memory manager subsystem. · ba4e7d97
      Thomas Hellstrom 提交于
      TTM is a GPU memory manager subsystem designed for use with GPU
      devices with various memory types (On-card VRAM, AGP,
      PCI apertures etc.). It's essentially a helper library that assists
      the DRM driver in creating and managing persistent buffer objects.
      
      TTM manages placement of data and CPU map setup and teardown on
      data movement. It can also optionally manage synchronization of
      data on a per-buffer-object level.
      
      TTM takes care to provide an always valid virtual user-space address
      to a buffer object which makes user-space sub-allocation of
      big buffer objects feasible.
      
      TTM uses a fine-grained per buffer-object locking scheme, taking
      care to release all relevant locks when waiting for the GPU.
      Although this implies some locking overhead, it's probably a big
      win for devices with multiple command submission mechanisms, since
      the lock contention will be minimal.
      
      TTM can be used with whatever user-space interface the driver
      chooses, including GEM. It's used by the upcoming Radeon KMS DRM driver
      and is also the GPU memory management core of various new experimental
      DRM drivers.
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NJerome Glisse <jglisse@redhat.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      ba4e7d97