1. Jun 05, 2020
  2. Jun 04, 2020
  3. Jun 03, 2020
  4. Jun 02, 2020
  5. Jun 01, 2020
    • Ville Syrjälä's avatar
      drm/i915: Fix global state use-after-frees with a refcount · f8c86ffa
      Ville Syrjälä authored
      While the current locking/serialization of the global state
      suffices for protecting the obj->state access and the actual
      hardware reprogramming, we do have a problem with accessing
      the old/new states during nonblocking commits.
      
      The state computation and swap will be protected by the crtc
      locks, but the commit_tails can finish out of order, thus also
      causing the atomic states to be cleaned up out of order. This
      would mean the commit that started first but finished last has
      had its new state freed as the no-longer-needed old state by the
      other commit.
      
      To fix this let's just refcount the states. obj->state amounts
      to one reference, and the intel_atomic_state holds extra references
      to both its new and old global obj states.
      
      Fixes: 0ef1905e
      
       ("drm/i915: Introduce better global state handling")
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200527200245.13184-1-ville.syrjala@linux.intel.com
      
      
      Reviewed-by: default avatarStanislav Lisovskiy <stanislav.lisovskiy@intel.com>
      f8c86ffa
    • Chris Wilson's avatar
      drm/i915: Relinquish forcewake immediately after manual grouping · 03c10f47
      Chris Wilson authored
      
      
      Our forcewake utilisation is split into categories: automatic and
      manual. Around bare register reads, we look up the right forcewake
      domain and automatically acquire and release [upon a timer] the
      forcewake domain. For other access, where we know we require the
      forcewake across a group of register reads, we manually acquire the
      forcewake domain and release it at the end. Again, this currently arms
      the domain timer for a later release.
      
      However, looking at some energy utilisation profiles, we have tried to
      avoid using forcewake [and rely on the natural wake up to post register
      updates] due to that even keep the fw active for a brief period
      contributes to a significant power draw [i.e. when the gpu is sleeping
      with rc6 at high clocks]. But as it turns out, not posting the writes
      immediately also has unintended consequences, such as not reducing the
      clocks and so conserving power while busy.
      
      As a compromise, let us only arm the domain timer for automatic
      forcewake usage around bare register access, but immediately release the
      forcewake when manually acquired by intel_uncore_forcewake_get/_put.
      
      The corollary to this is that we may instead have to take forcewake more
      often, and so incur a latency penalty in doing so. For Sandybridge this
      was significant, and even on the latest machines, taking forcewake at
      interrupt frequency is a huge impact. [So we don't do that anymore!
      Hopefully, this will spare us from still needing the mitigation of the
      timer for steady state execution.]
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200601072446.19548-13-chris@chris-wilson.co.uk
      03c10f47