1. 10 12月, 2012 4 次提交
  2. 28 11月, 2012 3 次提交
  3. 20 11月, 2012 9 次提交
  4. 16 11月, 2012 2 次提交
  5. 07 11月, 2012 1 次提交
  6. 23 10月, 2012 2 次提交
    • T
      drm/ttm: Fix a theoretical race in ttm_bo_cleanup_refs() · b8e902f2
      Thomas Hellstrom 提交于
      In theory, that function could release the lru lock between
      checking for bo on ddestroy list and a successful reserve if the bo
      was already reserved, and the function was called with waiting reserves
      allowed.
      However, all current reservers of a bo on the ddestroy list would
      atomically take the bo off the list after a successful reserve so this
      race should not have been hit, so no need to backport for stable.
      
      This patch also fixes a case found by Maarten Lankhorst where
      ttm_mem_evict_first called with no_wait_gpu would incorrectly
      spin waiting for bo idle if trying to evict a busy buffer that
      also sits on the ddestroy list.
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      b8e902f2
    • T
      drm/ttm: Fix a theoretical race · 7bc17a78
      Thomas Hellstrom 提交于
      The ttm_mem_evict_first function could theoretically drop the
      lru lock without retrying if a reservation from off the LRU list
      ended up waiting.
      However, since currently there are no users that could cause a wait
      in that situation so this is not suitable for stable
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      7bc17a78
  7. 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
  8. 03 10月, 2012 1 次提交
  9. 02 10月, 2012 2 次提交
  10. 24 8月, 2012 1 次提交
  11. 12 6月, 2012 1 次提交
    • T
      drm/ttm: Fix buffer object metadata accounting regression v2 · a393c730
      Thomas Hellstrom 提交于
      A regression was introduced in the 3.3 rc series, commit
      "drm/ttm: simplify memory accounting for ttm user v2",
      causing the metadata of buffer objects created using the ttm_bo_create()
      function to be accounted twice.
      That causes massive leaks with the vmwgfx driver running for example
      SpecViewperf Catia-03 test 2, eventually killing the app.
      
      Furthermore, the same commit introduces a regression where
      metadata accounting is leaked if a buffer object is
      initialized with an illegal size. This is also fixed with this commit.
      
      v2: Fixed an error path and removed an unused variable.
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      a393c730
  12. 02 6月, 2012 1 次提交
  13. 23 5月, 2012 1 次提交
  14. 20 3月, 2012 2 次提交
  15. 26 1月, 2012 1 次提交
    • B
      drm/ttm: fix two regressions since move_notify changes · 9f1feed2
      Ben Skeggs 提交于
      Both changes in dc97b340 cause serious
      regressions in the nouveau driver.
      
      move_notify() was originally able to presume that bo->mem is the old node,
      and new_mem is the new node.  The above commit moves the call to
      move_notify() to after move() has been done, which means that now, sometimes,
      new_mem isn't the new node at all, bo->mem is, and new_mem points at a
      stale, possibly-just-been-killed-by-move node.
      
      This is clearly not a good situation.  This patch reverts this change, and
      replaces it with a cleanup in the move() failure path instead.
      
      The second issue is that the call to move_notify() from cleanup_memtype_use()
      causes the TTM ghost objects to get passed into the driver.  This is clearly
      bad as the driver knows nothing about these "fake" TTM BOs, and ends up
      accessing uninitialised memory.
      
      I worked around this in nouveau's move_notify() hook by ensuring the BO
      destructor was nouveau's.  I don't particularly like this solution, and
      would rather TTM never pass the driver these objects.  However, I don't
      clearly understand the reason why we're calling move_notify() here anyway
      and am happy to work around the problem in nouveau instead of breaking the
      behaviour expected by other drivers.
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      Reviewed-by: NThomas Hellstrom <thellstrom@vmware.com>
      Cc: Jerome Glisse <j.glisse@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      9f1feed2
  16. 13 1月, 2012 1 次提交
    • K
      ttm/dma: Remove the WARN() which is not useful. · 0e113315
      Konrad Rzeszutek Wilk 提交于
      . It was useful during development, but now on a production system
      we can get this (if the user forgot to upload the firmware):
      
      [drm] radeon: irq initialized.
      [drm] GART: num cpu pages 131072, num gpu pages 131072
      [drm] radeon: ib pool ready.
      [drm] Loading SUMO Microcode
      r600_cp: Failed to load firmware "radeon/SUMO_pfp.bin"
      atl1c 0000:03:00.0: version 1.0.1.0-NAPI.213057] [drm:evergreen_startup] *ERROR* Failed to load firmware!
      radeon 0000:00:01.0: disabling GPU acceleration
      88] radeon 0000:00:01.0: ffff8801bb782400 unpin not necessary
      ------------[ cut here ]------------
      WARNING: at /home/konrad/linux-linus/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c:956 ttm_dma_unpopulate+0x79/0x300 [ttm]()
      Hardware name: System Product Name
      Modules linked in: e1000e atl1c radeon(+) ahci libahci libata scsi_mod fbcon tileblit font ttm bitblit softcursor drm_kms_helper wmi xen_blkfront xen_netfront fb_sys_fops sysimgblt sysfillrect syscopyarea xenfs xen_privcmd
      Pid: 1600, comm: modprobe Not tainted 3.2.0-06100-ge343a895 #1
      Call Trace:
       [<ffffffff8108973a>] warn_slowpath_common+0x7a/0xb0
       [<ffffffff81089785>] warn_slowpath_null+0x15/0x20
       [<ffffffffa0060309>] ttm_dma_unpopulate+0x79/0x300 [ttm]
       [<ffffffffa01341c0>] radeon_ttm_tt_unpopulate+0x120/0x130 [radeon]
       [<ffffffffa0056e0c>] ttm_tt_destroy+0x2c/0x70 [ttm]
       [<ffffffffa0057a4e>] ttm_bo_cleanup_memtype_use+0x3e/0x80 [ttm]
       [<ffffffffa00595a1>] ttm_bo_release+0x251/0x280 [ttm]
       [<ffffffffa0059610>] ttm_bo_unref+0x40/0x60 [ttm]
       [<ffffffffa0134d02>] radeon_bo_unref+0x42/0x80 [radeon]
       [<ffffffffa0186dfb>] radeon_sa_bo_manager_fini+0x6b/0x80 [radeon]
       [<ffffffffa0146b8f>] radeon_ib_pool_fini+0x6f/0x90 [radeon]
       [<ffffffffa014be49>] r100_ib_fini+0x19/0x20 [radeon]
       [<ffffffffa017b47e>] evergreen_init+0x1ee/0x2d0 [radeon]
      
      The big WARN() has nothing to do with the culprit - which is that
      the firmware was not loaded. So lets remove the WARN() from the TTM DMA code.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NJerome Glisse <jglisse@redhat.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      0e113315
  17. 10 1月, 2012 1 次提交
  18. 06 1月, 2012 3 次提交
    • J
      ttm: fix agp since ttm tt rework · dea7e0ac
      Jerome Glisse 提交于
      ttm tt rework modified the way we allocate and populate the
      ttm_tt structure, the AGP side was missing some bit to properly
      work. Fix those and fix radeon and nouveau AGP support.
      
      Tested on radeon only so far.
      Signed-off-by: NJerome Glisse <jglisse@redhat.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      dea7e0ac
    • K
      drm/ttm/dma: Fix accounting error when calling ttm_mem_global_free_page and... · 2c05114d
      Konrad Rzeszutek Wilk 提交于
      drm/ttm/dma: Fix accounting error when calling ttm_mem_global_free_page and don't try to free freed pages.
      
      The code to figure out how many pages to shrink the pool
      ends up capping the 'count' at _manager->options.max_size - which is OK.
      Except that the 'count' is also used when accounting for how many pages
      are recycled - which we end up with the invalid values. This fixes
      it by using a different value for the amount of pages to shrink.
      
      On top of that we would free the cached page pool - which is nonsense
      as they are deleted from the pool - so there are no free pages in that
      pool..
      
      Also we also missed the opportunity to batch the amount of pages
      to free (similar to how ttm_page_alloc.c does it). This reintroduces
      the code that was lost during rebasing.
      Reviewed-by: NJerome Glisse <jglisse@redhat.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      2c05114d
    • K
      drm/ttm/dma: Only call set_pages_array_wb when the page is not in WB pool. · 36d7c537
      Konrad Rzeszutek Wilk 提交于
      Otherwise we are doing redundant work. Especially since the 'unbind'
      and 'unpopulate' have been merged and nouveau driver ends up calling
      it quite excessivly. On a GeForce 8600 GT with Gnome Shell (GNOME 3)
      we end up spending about 54% CPU time in __change_page_attr_set_clr
      checking the page flags.
      
      The callgraph (annotated) looks as so before this patch:
      
          53.29%  gnome-shell  [kernel.kallsyms]                   [k] static_protections
                  |
                  --- static_protections
                     |
                     |--91.80%-- __change_page_attr_set_clr
                     |          change_page_attr_set_clr
                     |          set_pages_array_wb
                     |          |
                     |          |--96.55%-- ttm_dma_unpopulate
                     |          |          nouveau_ttm_tt_unpopulate
                     |          |          ttm_tt_destroy
                     |          |          ttm_bo_cleanup_memtype_use
                     |          |          ttm_bo_release
                     |          |          kref_put
                     |          |          ttm_bo_unref
                     |          |          nouveau_gem_object_del
                     |          |          drm_gem_object_free
                     |          |          kref_put
                     |          |          drm_gem_object_unreference_unlocked
                     |          |          drm_gem_object_handle_unreference_unlocked.part.1
                     |          |          drm_gem_handle_delete
                     |          |          drm_gem_close_ioctl
                     |          |          drm_ioctl
                     |          |          do_vfs_ioctl
                     |          |          sys_ioctl
                     |          |          system_call_fastpath
                     |          |          __GI___ioctl
                     |          |
                     |           --3.45%-- ttm_dma_pages_put
                     |                     ttm_dma_page_pool_free
                     |                     ttm_dma_unpopulate
                     |                     nouveau_ttm_tt_unpopulate
                     |                     ttm_tt_destroy
                     |                     ttm_bo_cleanup_memtype_use
                     |                     ttm_bo_release
                     |                     kref_put
                     |                     ttm_bo_unref
                     |                     nouveau_gem_object_del
                     |                     drm_gem_object_free
                     |                     kref_put
                     |                     drm_gem_object_unreference_unlocked
                     |                     drm_gem_object_handle_unreference_unlocked.part.1
                     |                     drm_gem_handle_delete
                     |                     drm_gem_close_ioctl
                     |                     drm_ioctl
                     |                     do_vfs_ioctl
                     |                     sys_ioctl
                     |                     system_call_fastpath
                     |                     __GI___ioctl
                     |
                      --8.20%-- change_page_attr_set_clr
                                set_pages_array_wb
                                |
                                |--93.76%-- ttm_dma_unpopulate
                                |          nouveau_ttm_tt_unpopulate
                                |          ttm_tt_destroy
                                |          ttm_bo_cleanup_memtype_use
                                |          ttm_bo_release
                                |          kref_put
                                |          ttm_bo_unref
                                |          nouveau_gem_object_del
                                |          drm_gem_object_free
                                |          kref_put
                                |          drm_gem_object_unreference_unlocked
                                |          drm_gem_object_handle_unreference_unlocked.part.1
                                |          drm_gem_handle_delete
                                |          drm_gem_close_ioctl
                                |          drm_ioctl
                                |          do_vfs_ioctl
                                |          sys_ioctl
                                |          system_call_fastpath
                                |          __GI___ioctl
                                |
                                 --6.24%-- ttm_dma_pages_put
                                           ttm_dma_page_pool_free
                                           ttm_dma_unpopulate
                                           nouveau_ttm_tt_unpopulate
                                           ttm_tt_destroy
                                           ttm_bo_cleanup_memtype_use
                                           ttm_bo_release
                                           kref_put
                                           ttm_bo_unref
                                           nouveau_gem_object_del
                                           drm_gem_object_free
                                           kref_put
                                           drm_gem_object_unreference_unlocked
                                           drm_gem_object_handle_unreference_unlocked.part.1
                                           drm_gem_handle_delete
                                           drm_gem_close_ioctl
                                           drm_ioctl
                                           do_vfs_ioctl
                                           sys_ioctl
                                           system_call_fastpath
                                           __GI___ioctl
      
      and after this patch all of that disappears.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      36d7c537
  19. 06 12月, 2011 3 次提交
    • J
      drm/ttm: callback move_notify any time bo placement change v4 · dc97b340
      Jerome Glisse 提交于
      Previously we were calling back move_notify in error path when the
      bo is returned to it's original position or when destroy the bo.
      When destroying the bo set the new mem placement as NULL when calling
      back in the driver.
      
      Updating nouveau to deal with NULL placement properly.
      
      v2: reserve the object before calling move_notify in bo destroy path
          at that point ttm should be the only piece of code interacting
          with the object so atomic_set is safe here.
      v3: callback move notify only once the bo is in its new position
          call move notify want swaping out the buffer
      v4:- don't call move_notify when swapin out bo, assume driver should
           do what is appropriate in swap notify
         - move move_notify call back to ttm_bo_cleanup_memtype_use for
           destroy path
      Reviewed-by: NJerome Glisse <jglisse@redhat.com>
      Reviewed-by: NThomas Hellstrom <thellstrom@vmware.com>
      dc97b340
    • J
      drm/ttm: simplify memory accounting for ttm user v2 · 57de4ba9
      Jerome Glisse 提交于
      Provide helper function to compute the kernel memory size needed
      for each buffer object. Move all the accounting inside ttm, simplifying
      driver and avoiding code duplication accross them.
      
      v2 fix accounting of ghost object, one would have thought that i
         would have run into the issue since a longtime but it seems
         ghost object are rare when you have plenty of vram ;)
      Signed-off-by: NJerome Glisse <jglisse@redhat.com>
      Reviewed-by: NThomas Hellstrom <thellstrom@vmware.com>
      57de4ba9
    • J
      drm/ttm: isolate dma data from ttm_tt V4 · 8e7e7052
      Jerome Glisse 提交于
      Move dma data to a superset ttm_dma_tt structure which herit
      from ttm_tt. This allow driver that don't use dma functionalities
      to not have to waste memory for it.
      
      V2 Rebase on top of no memory account changes (where/when is my
         delorean when i need it ?)
      V3 Make sure page list is initialized empty
      V4 typo/syntax fixes
      Signed-off-by: NJerome Glisse <jglisse@redhat.com>
      Reviewed-by: NThomas Hellstrom <thellstrom@vmware.com>
      8e7e7052