1. 09 8月, 2016 2 次提交
  2. 05 8月, 2016 3 次提交
    • C
      drm/i915: Enable i915_gem_wait_for_idle() without holding struct_mutex · dcff85c8
      Chris Wilson 提交于
      The principal motivation for this was to try and eliminate the
      struct_mutex from i915_gem_suspend - but we still need to hold the mutex
      current for the i915_gem_context_lost(). (The issue there is that there
      may be an indirect lockdep cycle between cpu_hotplug (i.e. suspend) and
      struct_mutex via the stop_machine().) For the moment, enabling last
      request tracking for the engine, allows us to do busyness checking and
      waiting without requiring the struct_mutex - which is useful in its own
      right.
      
      As a side-effect of having a robust means for tracking engine busyness,
      we can replace our other busyness heuristic, that of comparing against
      the last submitted seqno. For paranoid reasons, we have a semi-ordered
      check of that seqno inside the hangchecker, which we can now improve to
      an ordered check of the engine's busyness (removing a locked xchg in the
      process).
      
      v2: Pass along "bool interruptible" as being unlocked we cannot rely on
      i915->mm.interruptible being stable or even under our control.
      v3: Replace check Ironlake i915_gpu_busy() with the common precalculated value
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1470388464-28458-6-git-send-email-chris@chris-wilson.co.uk
      dcff85c8
    • C
      drm/i915: Introduce i915_gem_active_wait_unlocked() · 2467658e
      Chris Wilson 提交于
      It is useful to be able to wait on pending rendering without grabbing
      the struct_mutex. We can do this by using the i915_gem_active_get_rcu()
      primitive to acquire a reference to the pending request without
      requiring struct_mutex, just the RCU read lock, and then call
      i915_wait_request().
      
      v2: Rebase onto new i915_gem_active_get_unlocked() semantics that take
      the RCU read lock on behalf of the caller.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1470388464-28458-1-git-send-email-chris@chris-wilson.co.uk
      2467658e
    • C
      drm/i915: Enable lockless lookup of request tracking via RCU · 0eafec6d
      Chris Wilson 提交于
      If we enable RCU for the requests (providing a grace period where we can
      inspect a "dead" request before it is freed), we can allow callers to
      carefully perform lockless lookup of an active request.
      
      However, by enabling deferred freeing of requests, we can potentially
      hog a lot of memory when dealing with tens of thousands of requests per
      second - with a quick insertion of a synchronize_rcu() inside our
      shrinker callback, that issue disappears.
      
      v2: Currently, it is our responsibility to handle reclaim i.e. to avoid
      hogging memory with the delayed slab frees. At the moment, we wait for a
      grace period in the shrinker, and block for all RCU callbacks on oom.
      Suggested alternatives focus on flushing our RCU callback when we have a
      certain number of outstanding request frees, and blocking on that flush
      after a second high watermark. (So rather than wait for the system to
      run out of memory, we stop issuing requests - both are nondeterministic.)
      
      Paul E. McKenney wrote:
      
      Another approach is synchronize_rcu() after some largish number of
      requests.  The advantage of this approach is that it throttles the
      production of callbacks at the source.  The corresponding disadvantage
      is that it slows things up.
      
      Another approach is to use call_rcu(), but if the previous call_rcu()
      is still in flight, block waiting for it.  Yet another approach is
      the get_state_synchronize_rcu() / cond_synchronize_rcu() pair.  The
      idea is to do something like this:
      
              cond_synchronize_rcu(cookie);
              cookie = get_state_synchronize_rcu();
      
      You would of course do an initial get_state_synchronize_rcu() to
      get things going.  This would not block unless there was less than
      one grace period's worth of time between invocations.  But this
      assumes a busy system, where there is almost always a grace period
      in flight.  But you can make that happen as follows:
      
              cond_synchronize_rcu(cookie);
              cookie = get_state_synchronize_rcu();
              call_rcu(&my_rcu_head, noop_function);
      
      Note that you need additional code to make sure that the old callback
      has completed before doing a new one.  Setting and clearing a flag
      with appropriate memory ordering control suffices (e.g,. smp_load_acquire()
      and smp_store_release()).
      
      v3: More comments on compiler and processor order of operations within
      the RCU lookup and discover we can use rcu_access_pointer() here instead.
      
      v4: Wrap i915_gem_active_get_rcu() to take the rcu_read_lock itself.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: "Goel, Akash" <akash.goel@intel.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1470324762-2545-25-git-send-email-chris@chris-wilson.co.uk
      0eafec6d
  3. 04 8月, 2016 8 次提交
  4. 03 8月, 2016 2 次提交
  5. 20 7月, 2016 4 次提交