1. 05 8月, 2016 5 次提交
  2. 04 8月, 2016 1 次提交
  3. 20 7月, 2016 2 次提交
  4. 16 7月, 2016 1 次提交
  5. 24 6月, 2016 2 次提交
  6. 09 5月, 2016 1 次提交
  7. 26 2月, 2016 1 次提交
  8. 09 12月, 2015 1 次提交
    • C
      drm/i915: Add soft-pinning API for execbuffer · 506a8e87
      Chris Wilson 提交于
      Userspace can pass in an offset that it presumes the object is located
      at. The kernel will then do its utmost to fit the object into that
      location. The assumption is that userspace is handling its own object
      locations (for example along with full-ppgtt) and that the kernel will
      rarely have to make space for the user's requests.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      
      v2: Fixed incorrect eviction found by Michal Winiarski - fix suggested by Chris
      Wilson.  Fixed incorrect error paths causing crash found by Michal Winiarski.
      (Not published externally)
      
      v3: Rebased because of trivial conflict in object_bind_to_vm.  Fixed eviction
      to allow eviction of soft-pinned objects when another soft-pinned object used
      by a subsequent execbuffer overlaps reported by Michal Winiarski.
      (Not published externally)
      
      v4: Moved soft-pinned objects to the front of ordered_vmas so that they are
      pinned first after an address conflict happens to avoid repeated conflicts in
      rare cases (Suggested by Chris Wilson).  Expanded comment on
      drm_i915_gem_exec_object2.offset to cover this new API.
      
      v5: Added I915_PARAM_HAS_EXEC_SOFTPIN parameter for detecting this capability
      (Kristian). Added check for multiple pinnings on eviction (Akash). Made sure
      buffers are not considered misplaced without the user specifying
      EXEC_OBJECT_SUPPORTS_48B_ADDRESS.  User must assume responsibility for any
      addressing workarounds.  Updated object2.offset field comment again to clarify
      NO_RELOC case (Chris).  checkpatch cleanup.
      
      v6: Trivial rebase on latest drm-intel-nightly
      
      v7: Catch attempts to pin above the max virtual address size and return
      EINVAL (Tvrtko). Decouple EXEC_OBJECT_SUPPORTS_48B_ADDRESS and
      EXEC_OBJECT_PINNED flags, user must pass both flags in any attempt to pin
      something at an offset above 4GB (Chris, Daniel Vetter).
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Akash Goel <akash.goel@intel.com>
      Cc: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
      Cc: Michal Winiarski <michal.winiarski@intel.com>
      Cc: Zou Nanhai <nanhai.zou@intel.com>
      Cc: Kristian Høgsberg <hoegsberg@gmail.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Reviewed-by: NMichel Thierry <michel.thierry@intel.com>
      Acked-by: PDT
      Signed-off-by: NThomas Daniel <thomas.daniel@intel.com>
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1449575707-20933-1-git-send-email-thomas.daniel@intel.com
      506a8e87
  9. 07 10月, 2015 1 次提交
  10. 20 3月, 2015 1 次提交
  11. 06 1月, 2015 2 次提交
  12. 19 9月, 2014 1 次提交
  13. 27 5月, 2014 1 次提交
    • C
      drm/i915: Prevent negative relocation deltas from wrapping · d23db88c
      Chris Wilson 提交于
      This is pure evil. Userspace, I'm looking at you SNA, repacks batch
      buffers on the fly after generation as they are being passed to the
      kernel for execution. These batches also contain self-referenced
      relocations as a single buffer encompasses the state commands, kernels,
      vertices and sampler. During generation the buffers are placed at known
      offsets within the full batch, and then the relocation deltas (as passed
      to the kernel) are tweaked as the batch is repacked into a smaller buffer.
      This means that userspace is passing negative relocations deltas, which
      subsequently wrap to large values if the batch is at a low address. The
      GPU hangs when it then tries to use the large value as a base for its
      address offsets, rather than wrapping back to the real value (as one
      would hope). As the GPU uses positive offsets from the base, we can
      treat the relocation address as the minimum address read by the GPU.
      For the upper bound, we trust that userspace will not read beyond the
      end of the buffer.
      
      So, how do we fix negative relocations from wrapping? We can either
      check that every relocation looks valid when we write it, and then
      position each object such that we prevent the offset wraparound, or we
      just special-case the self-referential behaviour of SNA and force all
      batches to be above 256k. Daniel prefers the latter approach.
      
      This fixes a GPU hang when it tries to use an address (relocation +
      offset) greater than the GTT size. The issue would occur quite easily
      with full-ppgtt as each fd gets its own VM space, so low offsets would
      often be handed out. However, with the rearrangement of the low GTT due
      to capturing the BIOS framebuffer, it is already affecting kernels 3.15
      onwards. I think only IVB+ is susceptible to this bug, but the workaround
      should only kick in rarely, so it seems sensible to always apply it.
      
      v3: Use a bias for batch buffers to prevent small negative delta relocations
      from wrapping.
      
      v4 from Daniel:
      - s/BIAS/BATCH_OFFSET_BIAS/
      - Extract eb_vma_misplaced/i915_vma_misplaced since the conditions
        were growing rather cumbersome.
      - Add a comment to eb_get_batch explaining why we do this.
      - Apply the batch offset bias everywhere but mention that we've only
        observed it on gen7 gpus.
      - Drop PIN_OFFSET_FIX for now, that slipped in from a feature patch.
      
      v5: Add static to eb_get_batch, spotted by 0-day tester.
      
      Testcase: igt/gem_bad_reloc
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78533
      Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (v3)
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d23db88c
  14. 31 3月, 2014 1 次提交
  15. 14 2月, 2014 1 次提交
    • D
      drm/i915: Consolidate binding parameters into flags · 1ec9e26d
      Daniel Vetter 提交于
      Anything more than just one bool parameter is just a pain to read,
      symbolic constants are much better.
      
      Split out from Chris' vma-binding rework patch.
      
      v2: Undo the behaviour change in object_pin that Chris spotted.
      
      v3: Split out misplaced hunk to handle set_cache_level errors,
      spotted by Jani.
      
      v4: Keep the current over-zealous binding logic in the execbuffer code
      working with a quick hack while the overall binding code gets shuffled
      around.
      
      v5: Reorder the PIN_ flags for more natural patch splitup.
      
      v6: Pull out the PIN_GLOBAL split-up again.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Ben Widawsky <benjamin.widawsky@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1ec9e26d
  16. 30 1月, 2014 2 次提交
  17. 22 1月, 2014 1 次提交
  18. 18 12月, 2013 1 次提交
  19. 10 12月, 2013 1 次提交
  20. 01 10月, 2013 1 次提交
  21. 13 9月, 2013 2 次提交
  22. 04 9月, 2013 1 次提交
    • D
      drm/i915: More vma fixups around unbind/destroy · b93dab6e
      Daniel Vetter 提交于
      The important bugfix here is that we must not unlink the vma when
      we keep it around as a placeholder for the execbuf code. Since then we
      won't find it again when execbuf gets interrupt and restarted and
      create a 2nd vma. And since the code as-is isn't fit yet to deal with
      more than one vma, hilarity ensues.
      
      Specifically the dma map/unmap of the sg table isn't adjusted for
      multiple vmas yet and will blow up like this:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
      IP: [<ffffffffa008fb37>] i915_gem_gtt_finish_object+0x73/0xc8 [i915]
      PGD 56bb5067 PUD ad3dd067 PMD 0
      Oops: 0000 [#1] SMP
      Modules linked in: tcp_lp ppdev parport_pc lp parport ipv6 dm_mod dcdbas snd_hda_codec_hdmi pcspkr snd_hda_codec_realtek serio_raw i2c_i801 iTCO_wdt iTCO_vendor_support snd_hda_intel snd_hda_codec lpc_ich snd_hwdep mfd_core snd_pcm snd_page_alloc snd_timer snd soundcore acpi_cpufreq i915 video button drm_kms_helper drm mperf freq_table
      CPU: 1 PID: 16650 Comm: fbo-maxsize Not tainted 3.11.0-rc4_nightlytop_d93f59_debug_20130814_+ #6957
      Hardware name: Dell Inc. OptiPlex 9010/03JR84, BIOS A01 05/04/2012
      task: ffff8800563b3f00 ti: ffff88004bdf4000 task.ti: ffff88004bdf4000
      RIP: 0010:[<ffffffffa008fb37>]  [<ffffffffa008fb37>] i915_gem_gtt_finish_object+0x73/0xc8 [i915]
      RSP: 0018:ffff88004bdf5958  EFLAGS: 00010246
      RAX: 0000000000000000 RBX: ffff8801135e0000 RCX: ffff8800ad3bf8e0
      RDX: ffff8800ad3bf8e0 RSI: 0000000000000000 RDI: ffff8801007ee780
      RBP: ffff88004bdf5978 R08: ffff8800ad3bf8e0 R09: 0000000000000000
      R10: ffffffff86ca1810 R11: ffff880036a17101 R12: ffff8801007ee780
      R13: 0000000000018001 R14: ffff880118c4e000 R15: ffff8801007ee780
      FS:  00007f401a0ce740(0000) GS:ffff88011e280000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000008 CR3: 000000005635c000 CR4: 00000000001407e0
      Stack:
       ffff8801007ee780 ffff88005c253180 0000000000018000 ffff8801135e0000
       ffff88004bdf59a8 ffffffffa0088e55 0000000000000011 ffff8801007eec00
       0000000000018000 ffff880036a17101 ffff88004bdf5a08 ffffffffa0089026
      Call Trace:
       [<ffffffffa0088e55>] i915_vma_unbind+0xdf/0x1ab [i915]
       [<ffffffffa0089026>] __i915_gem_shrink+0x105/0x177 [i915]
       [<ffffffffa0089452>] i915_gem_object_get_pages_gtt+0x108/0x309 [i915]
       [<ffffffffa0085ba9>] i915_gem_object_get_pages+0x61/0x90 [i915]
       [<ffffffffa008f22b>] ? gen6_ppgtt_insert_entries+0x103/0x125 [i915]
       [<ffffffffa008a113>] i915_gem_object_pin+0x1fa/0x5df [i915]
       [<ffffffffa008cdfe>] i915_gem_execbuffer_reserve_object.isra.6+0x8d/0x1bc [i915]
       [<ffffffffa008d156>] i915_gem_execbuffer_reserve+0x229/0x367 [i915]
       [<ffffffffa008dbf6>] i915_gem_do_execbuffer.isra.12+0x4dc/0xf3a [i915]
       [<ffffffff810fc823>] ? might_fault+0x40/0x90
       [<ffffffffa008eb89>] i915_gem_execbuffer2+0x187/0x222 [i915]
       [<ffffffffa000971c>] drm_ioctl+0x308/0x442 [drm]
       [<ffffffffa008ea02>] ? i915_gem_execbuffer+0x3ae/0x3ae [i915]
       [<ffffffff817db156>] ? __do_page_fault+0x3dd/0x481
       [<ffffffff8112fdba>] vfs_ioctl+0x26/0x39
       [<ffffffff811306a2>] do_vfs_ioctl+0x40e/0x451
       [<ffffffff817deda7>] ? sysret_check+0x1b/0x56
       [<ffffffff8113073c>] SyS_ioctl+0x57/0x87
       [<ffffffff8135bbfe>] ? trace_hardirqs_on_thunk+0x3a/0x3f
       [<ffffffff817ded82>] system_call_fastpath+0x16/0x1b
      Code: 48 c7 c6 84 30 0e a0 31 c0 e8 d0 e9 f7 ff bf c6 a7 00 00 e8 07 af 2c e1 41 f6 84 24 03 01 00 00 10 75 44 49 8b 84 24 08 01 00 00 <8b> 50 08 48 8b 30 49 8b 86 b0 04 00 00 48 89 c7 48 81 c7 98 00
      RIP  [<ffffffffa008fb37>] i915_gem_gtt_finish_object+0x73/0xc8 [i915]
       RSP <ffff88004bdf5958>
      CR2: 0000000000000008
      
      As a consequence we need to change the "only one vma for now" check in
      vma_unbind - since vma_destroy isn't always called the obj->vma_list
      might not be empty. Instead check that the vma list is singular at the
      beginning of vma_unbind. This is also more symmetric with bind_to_vm.
      
      This fixes the igt/gem_evict_everything|alignment testcases.
      
      v2:
      - Add a paranoid WARN to mark_free in the eviction code to make sure
        we never try to evict a vma used by the execbuf code right now.
      - Move the check for a temporary execbuf vma into vma_destroy -
        otherwise the failure path cleanup in bind_to_vm will blow up.
      
      Our first attempting at fixing this was
      
      commit 1be81a2f2cfd8789a627401d470423358fba2d76
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Tue Aug 20 12:56:40 2013 +0100
      
          drm/i915: Don't destroy the vma placeholder during execbuffer reservation
      
      Squash with this when merging!
      
      v3: Improvements suggested in Chris' review:
      - Move the WARN_ON in vma_destroy that checks for vmas with an drm_mm
        allocation before the early return.
      - Bail out if we hit the WARN in mark_free to hopefully make the
        kernel survive for long enough to capture it.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Ben Widawsky <ben@bwidawsk.net>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68298
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68171
      Tested-by: lu hua <huax.lu@intel.com> (v2)
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b93dab6e
  23. 23 8月, 2013 1 次提交
    • B
      drm/i915/vma: Correct use after free in eviction · 8637b407
      Ben Widawsky 提交于
      The vma will [possibly] be destroyed during unbind in eviction.
      Immediately after this, we try to delete the list entry.
      
      Chris and Ville did the debug on this before I woke up, I just get to
      take credit for the fix :p
      
      For future reference the Oops that Mika reported:
      
      [  403.472448] BUG: unable to handle kernel paging request at 6b6b6b6b
      [  403.472473] IP: [<c12c1500>] __list_del_entry+0x20/0xe0
      [  403.472514] *pdpt = 000000002e89c001 *pde = 0000000000000000
      [  403.472556] Oops: 0000 [#1] SMP
      [  403.472582] Modules linked in: mxm_wmi snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_midi snd_rawmidi psmouse snd_seq_midi_event snd_seq serio_raw snd_timer snd_seq_device snd soundcore snd_page_alloc wmi bnep rfcomm bluetooth mac_hid parport_pc ppdev lp parport usbhid dm_crypt firewire_ohci firewire_core crc_itu_t i915 drm_kms_helper e1000e ptp drm i2c_algo_bit pps_core xhci_hcd video
      [  403.472895] CPU: 2 PID: 1940 Comm: Xorg Not tainted 3.11.0-rc2+ #827
      [  403.472938] Hardware name:                  /DZ77BH-55K, BIOS BHZ7710H.86A.0070.2012.0416.2117 04/16/2012
      [  403.473002] task: ec866c00 ti: ee6a2000 task.ti: ee6a2000
      [  403.473039] EIP: 0060:[<c12c1500>] EFLAGS: 00013202 CPU: 2
      [  403.473078] EIP is at __list_del_entry+0x20/0xe0
      [  403.473109] EAX: f016d9bc EBX: f016d9bc ECX: 6b6b6b6b EDX: 6b6b6b6b
      [  403.473151] ESI: 00000000 EDI: ee6a3c90 EBP: ee6a3c60 ESP: ee6a3c48
      [  403.473193]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      [  403.473230] CR0: 80050033 CR2: 6b6b6b6b CR3: 2ec43000 CR4: 001407f0
      [  403.473271] Stack:
      [  403.473285]  f63b2ff0 f61f98c0 f61f8000 f016d9bc 00000000 f016d9bc ee6a3cac f8519a4a
      [  403.473347]  00000000 00000000 10000000 f61f8000 0100a000 10000000 00000001 008ca000
      [  403.473410]  f64ee840 f61f98c0 f016d9bc f016dcec ee6a3c98 ee6a3c98 f61f98c0 dcc58f00
      [  403.473472] Call Trace:
      [  403.473509]  [<f8519a4a>] i915_gem_evict_something+0x17a/0x2d0 [i915]
      [  403.473567]  [<f8516ed1>] i915_gem_object_pin+0x271/0x660 [i915]
      [  403.473622]  [<f851c740>] ? i915_ggtt_clear_range+0x20/0x20 [i915]
      [  403.473676]  [<f8517afa>] i915_gem_object_pin_to_display_plane+0xda/0x190 [i915]
      [  403.473742]  [<f852d9fa>] intel_pin_and_fence_fb_obj+0xba/0x140 [i915]
      [  403.473800]  [<f852db40>] intel_gen7_queue_flip+0x30/0x1c0 [i915]
      [  403.473856]  [<f85337b0>] intel_crtc_page_flip+0x1a0/0x320 [i915]
      [  403.473911]  [<f847b549>] ? drm_framebuffer_reference+0x39/0x80 [drm]
      [  403.473965]  [<f847f9fb>] drm_mode_page_flip_ioctl+0x28b/0x320 [drm]
      [  403.474018]  [<f846fec8>] drm_ioctl+0x4b8/0x560 [drm]
      [  403.474064]  [<f847f770>] ? drm_mode_gamma_get_ioctl+0xd0/0xd0 [drm]
      [  403.474113]  [<c1140f8a>] ? do_sync_read+0x6a/0xa0
      [  403.474154]  [<f846fa10>] ? drm_copy_field+0x80/0x80 [drm]
      [  403.474193]  [<c115134c>] do_vfs_ioctl+0x7c/0x5b0
      [  403.474228]  [<c1141d2f>] ? vfs_read+0xef/0x160
      [  403.474263]  [<c108dcbb>] ? ktime_get_ts+0x4b/0x120
      [  403.474298]  [<c1151917>] SyS_ioctl+0x97/0xa0
      [  403.474330]  [<c1590bc1>] sysenter_do_call+0x12/0x22
      [  403.474364] Code: 55 f4 8b 45 f8 e9 75 ff ff ff 90 55 89 e5 53 83 ec 14 8b 08 8b 50 04 81 f9 00 01 10 00 74 24 81 fa 00 02 20 00 0f 84 8e 00 00 00 <8b> 1a 39 d8 75 62 8b 59 04 39 d8 75 35 89 51 04 89 0a 83 c4 14
      [  403.474566] EIP: [<c12c1500>] __list_del_entry+0x20/0xe0 SS:ESP 0068:ee6a3c48
      [  403.476513] CR2: 000000006b6b6b6b
      
      v2: Missed the drm_object_unreference use after free (Ville)
      Daniel Vetter <daniel@ffwll.ch> writes:
      Reported-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      [danvet: Add the Oops from Mika to the commit message.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8637b407
  24. 22 8月, 2013 1 次提交
  25. 08 8月, 2013 3 次提交
    • B
      drm/i915: mm_list is per VMA · ca191b13
      Ben Widawsky 提交于
      formerly: "drm/i915: Create VMAs (part 5) - move mm_list"
      
      The mm_list is used for the active/inactive LRUs. Since those LRUs are
      per address space, the link should be per VMx .
      
      Because we'll only ever have 1 VMA before this point, it's not incorrect
      to defer this change until this point in the patch series, and doing it
      here makes the change much easier to understand.
      
      Shamelessly manipulated out of Daniel:
      "active/inactive stuff is used by eviction when we run out of address
      space, so needs to be per-vma and per-address space. Bound/unbound otoh
      is used by the shrinker which only cares about the amount of memory used
      and not one bit about in which address space this memory is all used in.
      Of course to actual kick out an object we need to unbind it from every
      address space, but for that we have the per-object list of vmas."
      
      v2: only bump GGTT LRU in i915_gem_object_set_to_gtt_domain (Chris)
      
      v3: Moved earlier in the series
      
      v4: Add dropped message from v3
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      [danvet: Frob patch to apply and use vma->node.size directly as
      discused with Ben. Also drop a needles BUG_ON before move_to_inactive,
      the function itself has the same check.]
      [danvet 2nd: Rebase on top of the lost "drm/i915: Cleanup more of VMA
      in destroy", specifically unlink the vma from the mm_list in
      vma_unbind (to keep it symmetric with bind_to_vm) instead of
      vma_destroy.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ca191b13
    • B
      drm/i915: Use new bind/unbind in eviction code · f6cd1f15
      Ben Widawsky 提交于
      Eviction code, like the rest of the converted code needs to be aware of
      the address space for which it is evicting (or the everything case, all
      addresses). With the updated bind/unbind interfaces of the last patch,
      we can now safely move the eviction code over.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f6cd1f15
    • B
      drm/i915: plumb VM into bind/unbind code · 07fe0b12
      Ben Widawsky 提交于
      As alluded to in several patches, and it will be reiterated later... A
      VMA is an abstraction for a GEM BO bound into an address space.
      Therefore it stands to reason, that the existing bind, and unbind are
      the ones which will be the most impacted. This patch implements this,
      and updates all callers which weren't already updated in the series
      (because it was too messy).
      
      This patch represents the bulk of an earlier, larger patch. I've pulled
      out a bunch of things by the request of Daniel. The history is preserved
      for posterity with the email convention of ">" One big change from the
      original patch aside from a bunch of cropping is I've created an
      i915_vma_unbind() function. That is because we always have the VMA
      anyway, and doing an extra lookup is useful. There is a caveat, we
      retain an i915_gem_object_ggtt_unbind, for the global cases which might
      not talk in VMAs.
      
      > drm/i915: plumb VM into object operations
      >
      > This patch was formerly known as:
      > "drm/i915: Create VMAs (part 3) - plumbing"
      >
      > This patch adds a VM argument, bind/unbind, and the object
      > offset/size/color getters/setters. It preserves the old ggtt helper
      > functions because things still need, and will continue to need them.
      >
      > Some code will still need to be ported over after this.
      >
      > v2: Fix purge to pick an object and unbind all vmas
      > This was doable because of the global bound list change.
      >
      > v3: With the commit to actually pin/unpin pages in place, there is no
      > longer a need to check if unbind succeeded before calling put_pages().
      > Make put_pages only BUG() after checking pin count.
      >
      > v4: Rebased on top of the new hangcheck work by Mika
      > plumbed eb_destroy also
      > Many checkpatch related fixes
      >
      > v5: Very large rebase
      >
      > v6:
      > Change BUG_ON to WARN_ON (Daniel)
      > Rename vm to ggtt in preallocate stolen, since it is always ggtt when
      > dealing with stolen memory. (Daniel)
      > list_for_each will short-circuit already (Daniel)
      > remove superflous space (Daniel)
      > Use per object list of vmas (Daniel)
      > Make obj_bound_any() use obj_bound for each vm (Ben)
      > s/bind_to_gtt/bind_to_vm/ (Ben)
      >
      > Fixed up the inactive shrinker. As Daniel noticed the code could
      > potentially count the same object multiple times. While it's not
      > possible in the current case, since 1 object can only ever be bound into
      > 1 address space thus far - we may as well try to get something more
      > future proof in place now. With a prep patch before this to switch over
      > to using the bound list + inactive check, we're now able to carry that
      > forward for every address space an object is bound into.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      [danvet: Rebase on top of the loss of "drm/i915: Cleanup more of VMA
      in destroy".]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      07fe0b12
  26. 06 8月, 2013 1 次提交
    • B
      drm/i915: Make proper functions for VMs · a70a3148
      Ben Widawsky 提交于
      Earlier in the conversion sequence we attempted to quickly wedge in the
      transitional interface as static inlines.
      
      Now that we're sure these interfaces are sane, for easier debug and to
      decrease code size (since many of these functions may be called quite a
      bit), make them real functions
      
      While at it, kill off the set_color interface. We'll always have the
      VMA, or easily get to it.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a70a3148
  27. 18 7月, 2013 3 次提交
    • B
      drm/i915: Create VMAs · 2f633156
      Ben Widawsky 提交于
      Formerly: "drm/i915: Create VMAs (part 1)"
      
      In a previous patch, the notion of a VM was introduced. A VMA describes
      an area of part of the VM address space. A VMA is similar to the concept
      in the linux mm. However, instead of representing regular memory, a VMA
      is backed by a GEM BO. There may be many VMAs for a given object, one
      for each VM the object is to be used in. This may occur through flink,
      dma-buf, or a number of other transient states.
      
      Currently the code depends on only 1 VMA per object, for the global GTT
      (and aliasing PPGTT). The following patches will address this and make
      the rest of the infrastructure more suited
      
      v2: s/i915_obj/i915_gem_obj (Chris)
      
      v3: Only move an object to the now global unbound list if there are no
      more VMAs for the object which are bound into a VM (ie. the list is
      empty).
      
      v4: killed obj->gtt_space
      some reworks due to rebase
      
      v5: Free vma on error path (Imre)
      
      v6: Another missed vma free in i915_gem_object_bind_to_gtt error path
      (Imre)
      Fixed vma freeing in stolen preallocation (Imre)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      [danvet: Squash in fixup from Ben to not deref a non-existing vma in
      set_cache_level, reported by Chris.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2f633156
    • B
      drm/i915: Move active/inactive lists to new mm · 5cef07e1
      Ben Widawsky 提交于
      Shamelessly manipulated out of Daniel :-)
      "When moving the lists around explain that the active/inactive stuff is
      used by eviction when we run out of address space, so needs to be
      per-vma and per-address space. Bound/unbound otoh is used by the
      shrinker which only cares about the amount of memory used and not one
      bit about in which address space this memory is all used in. Of course
      to actual kick out an object we need to unbind it from every address
      space, but for that we have the per-object list of vmas."
      
      v2: Leave the bound list as a global one. (Chris, indirectly)
      
      v3: Rebased with no i915_gtt_vm. In most places I added a new *vm local,
      since it will eventually be replaces by a vm argument.
      Put comment back inline, since it no longer makes sense to do otherwise.
      
      v4: Rebased on hangcheck/error state movement
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5cef07e1
    • B
      drm/i915: Put the mm in the parent address space · 93bd8649
      Ben Widawsky 提交于
      Every address space should support object allocation. It therefore makes
      sense to have the allocator be part of the "superclass" which GGTT and
      PPGTT will derive.
      
      Since our maximum address space size is only 2GB we're not yet able to
      avoid doing allocation/eviction; but we'd hope one day this becomes
      almost irrelvant.
      
      v2: Rebased
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      93bd8649