1. 08 9月, 2010 4 次提交
    • D
      drm/i915: move flushing list processing to i915_gem_flush · 8bff917c
      Daniel Vetter 提交于
      Now that we can move objects to the active list without already having
      emitted a request, move the flushing list handling into i915_gem_flush.
      This makes more sense and allows to drop a few i915_add_request calls
      that are not strictly necessary.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      8bff917c
    • D
      drm/i915: allow lazy emitting of requests · e35a41de
      Daniel Vetter 提交于
      Sometimes (like when flushing in preparation of batchbuffer execution)
      we know that we'll emit a request but haven't yet done so. Allow this
      case by simply taking the next seqno by default. Ensure that a request
      is eventually emitted before waiting for an request by issuing it
      in i915_wait_request iff this is not yet done.
      
      Also replace one open-coded version of i915_gem_object_wait_rendering,
      to prevent future code-diversion.
      
      Chris Wilson asked me to explain and clarify what this patch does and why.
      Here it goes:
      
      Old way of moving objects onto the active list and associating them with a
      reques:
      
      1. i915_add_request + store the returned seqno somewhere
      2. i915_gem_object_move_to_active (with the stored seqno as parameter)
      
      For the current users, this is all fine. But I'd like to associate objects
      (and fence regs) with the batchbuffer request deep down in the execbuf
      call-chain. I thought about three ways of implementing this.
      
      a) Don't care, just emit request when we need a new seqno. When heavily
      pipelining fence reg changes, this would have caused tons of superflous
      request (and corresponding irqs).
      
      b) Thread all changed fences, objects, whatever through the execbuf-maze,
      so that when we emit a request, we can store the new seqno at all the right
      places.
      
      c) Kill that seqno-threading-around business by simply storing the next
      seqno, i.e. allow 2. to be done before 1. in the above sequence.
      
      I've decided to implement c) (in this patch). The following patches are
      just fall-out that resulted from this small conceptual change.
      
      * We can handle the flushing list processing where we actually emit a flush
        (i915_gem_flush and i915_retire_commands) instead of in i915_add_request.
        The code makes IMHO more sense this way (and i915_add_request looses the
        flush_domains parameter, obviously).
      
      * We can avoid emitting unnecessary requests. IMHO there's no point in
        emitting more than one request per batchbuffer (with or without an
        corresponding irq).
      
      * By enforcing 2. before 1. ordering in the above sequence the seqno
        argument of i915_gem_object_move_to_active is redundant and can be
        dropped.
      
      v2: Now i915_wait_request issues request if it is not yet emitted.
      Also introduce i915_gem_next_request_seqno(dev) just in case we ever
      need to do some prep work before using a new seqno.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      [ickle: Keep i915_gem_object_set_to_display_plane() uninterruptible.]
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      e35a41de
    • D
      drm/i915: unload: fix retire_work races · 75ef9da2
      Daniel Vetter 提交于
      ums-gem code correctly cancels the retire work (at lastclose time),
      kms does not do so. Fix this by canceling the work right after ideling
      the gpu.
      
      While staring at the code I noticed that the work function is not
      static. Fix this, too.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      75ef9da2
    • D
      drm/i915: unload: fix error_work races · bc0c7f14
      Daniel Vetter 提交于
      This is the first patch to clean up module unload races due to
      outstanding timers/work. Preparatory step: Thou shalt not destroy
      the workqueue when new work might still get enqued.
      
      Now error_work gets queued by the hangcheck timer and only (atomically)
      reads the chip wedged status. So cancel it right after the hangcheck
      timer is killed. But the hangcheck is armed by interrupts, so move
      everything after irqs are disabled.
      
      Also change a del_timer to a del_timer_sync in the ums gem code, the
      hangcheck timer is self-rearming.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      bc0c7f14
  2. 07 9月, 2010 3 次提交
  3. 22 8月, 2010 1 次提交
  4. 10 8月, 2010 11 次提交
  5. 05 8月, 2010 1 次提交
  6. 02 8月, 2010 7 次提交
    • C
      drm/i915: Unreference object not handle on creation · 86f100b1
      Chris Wilson 提交于
      When creating an object, we create the handle by which it is known to
      the process and which own the reference to the object. That reference to
      the new handle is what we want to transfer to the process, not the lost
      reference to the object; so free the local object reference *not* the
      process's handle reference.
      
      This brings i915_gem_object_create_ioctl() into line with
      drm_gem_open_ioctl()
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      86f100b1
    • C
      drm/i915: Attempt to uncouple object after catastrophic failure in unbind · 8dc1775d
      Chris Wilson 提交于
      If we fail to flush outstanding GPU writes but return the memory to the
      system, we risk corrupting memory should the GPU recovery and complete
      those writes. On the other hand, if we bail early and free the object
      then we have a definite use-after-free and real memory corruption.
      Choose the lesser of two evils, since in order to recover from the hung
      GPU we need to completely reset it, those pending writes should
      never happen.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      8dc1775d
    • C
      drm/i915: Repeat unbinding during free if interrupted (v6) · be72615b
      Chris Wilson 提交于
      If during the freeing of an object the unbind is interrupted by a system
      call, which is quite possible if we have outstanding GPU writes that
      must be flushed, the unbind is silently aborted. This still leaves the
      AGP region and backing pages allocated, and perhaps more importantly,
      the object remains upon the various lists exposing us to memory
      corruption.
      
      I think this is the cause behind the use-after-free, such as
      
        Bug 15664 - Graphics hang and kernel backtrace when starting Azureus
                    with Compiz enabled
        https://bugzilla.kernel.org/show_bug.cgi?id=15664
      
      v2: Daniel Vetter reminded me that kernel space programming is never easy.
      We cannot simply spin to clear the pending signal and so must deferred
      the freeing of the object until later.
      v3: Run from the top level retire requests.
      v4: Tested with P(return -ERESTARTSYS)=.5 from i915_gem_do_wait_request()
      v5: Rebase against Eric's for-linus tree.
      v6: Refactor, split and add a comment about avoiding unbounded recursion.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      be72615b
    • C
      drm/i915: Refactor i915_gem_retire_requests() · b09a1fec
      Chris Wilson 提交于
      Combine the iteration over active render rings into a common function.
      This is in preparation for reusing the idle function to also retire
      deferred free requests.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      b09a1fec
    • C
    • C
      drm/i915: Propagate error from drm_install_irq() during EnterVT · 5f35308b
      Chris Wilson 提交于
      Simple fix for error propagation along the old UMS path.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      5f35308b
    • C
      drm/i915: Explosion following OOM in do_execbuffer. · 43b27f40
      Chris Wilson 提交于
      Oops, when merging the extra details following an OOM, I missed that
      driver_private is now NULL and the correct way to convert from the
      drm_gem_object into the drm_i915_gem_object is to use to_intel_bo().
      
      BUG: unable to handle kernel NULL pointer dereference at 00000069
      IP: [<c11a4a02>] i915_gem_do_execbuffer+0x71f/0xbb6
      *pde = 00000000
      Oops: 0000 [#1] SMP
      last sysfs file: /sys/devices/virtual/vc/vcsa3/uevent
      
      Pid: 10993, comm: X Not tainted 2.6.35-rc2+ #67 /
      EIP: 0060:[<c11a4a02>] EFLAGS: 00213202 CPU: 0
      EIP is at i915_gem_do_execbuffer+0x71f/0xbb6
      EAX: f647e8a8 EBX: 00000000 ECX: 00000003 EDX: 00000000
      ESI: 00424000 EDI: 00000000 EBP: f6508e48 ESP: f6508dd4
       DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      Process X (pid: 10993, ti=f6508000 task=f6432880 task.ti=f6508000)
      Stack:
       f6508de0 f7130000 00000001 00000000 00000000 f647e8a8 00000000 f64f8480
      <0> f7974414 00000000 00000006 00000000 00000000 f6578000 00000008 00000006
      <0> f6797880 00400000 00000000 ffffffe4 f7974400 000000d0 000000d0 000001c0
      Call Trace:
       [<c11a4f3a>] ? i915_gem_execbuffer2+0xa1/0xe7
       [<c118ab96>] ? drm_ioctl+0x22c/0x2fa
       [<c11a4e99>] ? i915_gem_execbuffer2+0x0/0xe7
       [<c107e88c>] ? do_sync_read+0x8f/0xca
       [<c1088cbd>] ? vfs_ioctl+0x2c/0x96
       [<c118a96a>] ? drm_ioctl+0x0/0x2fa
       [<c10891f4>] ? do_vfs_ioctl+0x429/0x45a
       [<c107e5c9>] ? fsnotify_access+0x54/0x5f
       [<c107ee1c>] ? vfs_read+0x9a/0xae
       [<c1089258>] ? sys_ioctl+0x33/0x4d
       [<c1002610>] ? sysenter_do_call+0x12/0x26
      Code: d0 89 4d c4 31 c9 89 45 d8 eb 44 8b 45 cc 8b 14 88 8b 42 50 89 45
      bc 8b 45 a0 8b 52 38 89 55 d0 31 d2 f6 40 20 01 74 0d 8b 55 bc <f6> 42
      69 30 0f 95 c2 0f b6 d2 8b 45 d0 c7 45 d4 00 00 00 00 89
      EIP: [<c11a4a02>] i915_gem_do_execbuffer+0x71f/0xbb6 SS:ESP 0068:f6508dd4
      CR2: 0000000000000069
      ---[ end trace 3f1d514b34d39381 ]---
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      43b27f40
  7. 20 7月, 2010 1 次提交
  8. 19 7月, 2010 2 次提交
    • D
      mm: add context argument to shrinker callback · 7f8275d0
      Dave Chinner 提交于
      The current shrinker implementation requires the registered callback
      to have global state to work from. This makes it difficult to shrink
      caches that are not global (e.g. per-filesystem caches). Pass the shrinker
      structure to the callback so that users can embed the shrinker structure
      in the context the shrinker needs to operate on and get back to it in the
      callback via container_of().
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      7f8275d0
    • L
      drm/i915: add 'reclaimable' to i915 self-reclaimable page allocations · cd9f040d
      Linus Torvalds 提交于
      The hibernate issues that got fixed in commit 985b823b ("drm/i915:
      fix hibernation since i915 self-reclaim fixes") turn out to have been
      incomplete.  Vefa Bicakci tested lots of hibernate cycles, and without
      the __GFP_RECLAIMABLE flag the system eventually fails to resume.
      
      With the flag added, Vefa can apparently hibernate forever (or until he
      gets bored running his automated scripts, whichever comes first).
      
      The reclaimable flag was there originally, and was one of the flags that
      were dropped (unintentionally) by commit 4bdadb97 ("drm/i915:
      Selectively enable self-reclaim") that introduced all these problems,
      but I didn't want to just blindly add back all the flags in commit
      985b823b, and it looked like __GFP_RECLAIM wasn't necessary.  It
      clearly was.
      
      I still suspect that there is some subtle reason we're missing that
      causes the problems, but __GFP_RECLAIMABLE is certainly not wrong to use
      in this context, and is what the code historically used.  And we have no
      idea what the causes the corruption without it.
      Reported-and-tested-by: NM. Vefa Bicakci <bicave@superonline.com>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
      Cc: stable@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cd9f040d
  9. 07 7月, 2010 1 次提交
  10. 06 7月, 2010 1 次提交
    • C
      drm/i915: Explosion following OOM in do_execbuffer. · 6f772d7e
      Chris Wilson 提交于
      Oops, when merging the extra details following an OOM, I missed that
      driver_private is now NULL and the correct way to convert from the
      drm_gem_object into the drm_i915_gem_object is to use to_intel_bo().
      
      BUG: unable to handle kernel NULL pointer dereference at 00000069
      IP: [<c11a4a02>] i915_gem_do_execbuffer+0x71f/0xbb6
      *pde = 00000000
      Oops: 0000 [#1] SMP
      last sysfs file: /sys/devices/virtual/vc/vcsa3/uevent
      
      Pid: 10993, comm: X Not tainted 2.6.35-rc2+ #67 /
      EIP: 0060:[<c11a4a02>] EFLAGS: 00213202 CPU: 0
      EIP is at i915_gem_do_execbuffer+0x71f/0xbb6
      EAX: f647e8a8 EBX: 00000000 ECX: 00000003 EDX: 00000000
      ESI: 00424000 EDI: 00000000 EBP: f6508e48 ESP: f6508dd4
       DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      Process X (pid: 10993, ti=f6508000 task=f6432880 task.ti=f6508000)
      Stack:
       f6508de0 f7130000 00000001 00000000 00000000 f647e8a8 00000000 f64f8480
      <0> f7974414 00000000 00000006 00000000 00000000 f6578000 00000008 00000006
      <0> f6797880 00400000 00000000 ffffffe4 f7974400 000000d0 000000d0 000001c0
      Call Trace:
       [<c11a4f3a>] ? i915_gem_execbuffer2+0xa1/0xe7
       [<c118ab96>] ? drm_ioctl+0x22c/0x2fa
       [<c11a4e99>] ? i915_gem_execbuffer2+0x0/0xe7
       [<c107e88c>] ? do_sync_read+0x8f/0xca
       [<c1088cbd>] ? vfs_ioctl+0x2c/0x96
       [<c118a96a>] ? drm_ioctl+0x0/0x2fa
       [<c10891f4>] ? do_vfs_ioctl+0x429/0x45a
       [<c107e5c9>] ? fsnotify_access+0x54/0x5f
       [<c107ee1c>] ? vfs_read+0x9a/0xae
       [<c1089258>] ? sys_ioctl+0x33/0x4d
       [<c1002610>] ? sysenter_do_call+0x12/0x26
      Code: d0 89 4d c4 31 c9 89 45 d8 eb 44 8b 45 cc 8b 14 88 8b 42 50 89 45
      bc 8b 45 a0 8b 52 38 89 55 d0 31 d2 f6 40 20 01 74 0d 8b 55 bc <f6> 42
      69 30 0f 95 c2 0f b6 d2 8b 45 d0 c7 45 d4 00 00 00 00 89
      EIP: [<c11a4a02>] i915_gem_do_execbuffer+0x71f/0xbb6 SS:ESP 0068:f6508dd4
      CR2: 0000000000000069
      ---[ end trace 3f1d514b34d39381 ]---
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      6f772d7e
  11. 02 7月, 2010 1 次提交
  12. 29 5月, 2010 7 次提交