1. 10 1月, 2014 2 次提交
    • B
      drm/i915: set ctx->initialized only after RCS · ad1d2199
      Ben Widawsky 提交于
      The initialized flag is used to specify a context has been initialized
      and it's context is safe to load, ie. the 3d state is setup properly.
      With full PPGTT, we emit the address space loads during context switch
      and this currently marks a context as initialized. With full PPGTT
      patches, if a client first emits a batch to !RCS, then later, RCS, the
      code will mistake the context as initialized and try to reload an
      uninitialized context.
      
      1. context 1 blit // context marked as initialized, but isn't
      2. context 1 render // loads random state from step 2
      
      It is really easy to hit this with a planned upcoming patch which makes
      default context reuse possible.
      
      NOTE: This should only effect full PPGTT branches, ie. current
      drm-intel-nightly.
      
      Thanks to Chris for helping me track this down.
      
      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: Simplify the failure scenario in the commit message according
      to Chris' review a bit.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ad1d2199
    • B
      drm/i915/bdw: Return -ENONENT on default ctx destroy · c2cf2416
      Ben Widawsky 提交于
      This was an accidental "ABI" change introduced during PPGTT:
      
      commit 0eea67eb
      Author: Ben Widawsky <ben@bwidawsk.net>
      Date:   Fri Dec 6 14:11:19 2013 -0800
      
          drm/i915: Create a per file_priv default context
      
      The failure test application actually tests the return type. The other
      option is to simply change the test.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c2cf2416
  2. 07 1月, 2014 1 次提交
  3. 18 12月, 2013 15 次提交
    • B
      drm/i915: Use multiple VMs -- the point of no return · 7e0d96bc
      Ben Widawsky 提交于
      As with processes which run on the CPU, the goal of multiple VMs is to
      provide process isolation. Specific to GEN, there is also the ability to
      map more objects per process (2GB each instead of 2Gb-2k total).
      
      For the most part, all the pipes have been laid, and all we need to do
      is remove asserts and actually start changing address spaces with the
      context switch. Since prior to this we've converted the setting of the
      page tables to a streamed version, this is quite easy.
      
      One important thing to point out (since it'd been hotly contested) is
      that with this patch, every context created will have it's own address
      space (provided the HW can do it).
      
      v2: Disable BDW on rebase
      
      NOTE: I tried to make this commit as small as possible. I needed one
      place where I could "turn everything on" and that is here. It could be
      split into finer commits, but I didn't really see much point.
      
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      7e0d96bc
    • B
      drm/i915: Get context early in execbuf · 41bde553
      Ben Widawsky 提交于
      We need to have the address space when reserving space for the objects.
      Since the address space and context are tied together, and reserve
      occurs before context switch (for good reason), we must lookup our
      context earlier in the process.
      
      This leaves some room for optimizations where we no longer need to use
      ctx_id in certain places. This will be addressed in a subsequent patch.
      
      Important tricky bit:
      Because slow relocations during execbuffer drop struct_mutex
      
      Perhaps it would be best to acquire the reference when we get the
      context, but I'll save that for another day (note I have written the
      patch before, and I found the changes required to be uglier than this).
      
      Note that since we currently access everything via context id, and not
      the data structure this is fine, though not desirable. The next change
      attempts to get the context only once via the context ID idr lookup, and
      as such, the following can happen:
      
      CTX-A is created, refcount = 1
      CTX-A execbuf, mutex dropped
      close IOCTL called on CTX-A, refcount = 0
      CTX-A resumes in execbuf.
      
      v2: Rebased on top of
      commit b6359918
      Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Date:   Wed Oct 30 15:44:16 2013 +0200
      
          drm/i915: add i915_get_reset_stats_ioctl
      
      v3: Rebased on top of
      commit 25b3dfc8
      Author: Mika Westerberg <mika.westerberg@linux.intel.com>
      Date:   Tue Nov 12 11:57:30 2013 +0200
      
      Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Date:   Tue Nov 26 16:14:33 2013 +0200
      
          drm/i915: check context reset stats before relocations
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      41bde553
    • B
      drm/i915: Piggy back hangstats off of contexts · c482972a
      Ben Widawsky 提交于
      To simplify the codepaths somewhat, we can simply always create a
      context. Contexts already keep hangstat information. This prevents us
      from having to differentiate at other parts in the code.
      
      There is allocation overhead, but it should not be measurable.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c482972a
    • B
      drm/i915: Create a per file_priv default context · 0eea67eb
      Ben Widawsky 提交于
      Every file will get it's own context, and we use this context instead of
      the default context. The default context still exists for future
      shrinker usage as well as reset handling.
      
      v2: Updated to address Mika's recent context guilty changes
      Some more changes around this come up in later patches as well.
      
      v3: Use a fake context to avoid allocation for the !HAS_HW_CONTEXT case.
      I've tried the alternatives. This looks the best to me.
      Removed hangstat stuff from v2 - for a separate patch
      Demote failed PPGTT set to DRM_DEBUG_DRIVER since it can now be invoked
      easily from userspace.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0eea67eb
    • B
      drm/i915: Do aliasing PPGTT init with contexts · bdf4fd7e
      Ben Widawsky 提交于
      We have a default context which suits the aliasing PPGTT well. Tie them
      together so it looks like any other context/PPGTT pair. This makes the
      code cleaner as it won't have to special case aliasing as often.
      
      The patch has one slightly tricky part in the default context creation
      function. In the future (and on aliased setup) we create a new VM for a
      context (potentially). However, if we have aliasing PPGTT, which occurs
      at this point in time for all platforms GEN6+, we can simply manage the
      refcounting to allow things to behave as normal. Now is a good time to
      recall that the aliasing_ppgtt doesn't have a real VM, it uses the GGTT
      drm_mm.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bdf4fd7e
    • B
      drm/i915: Add VM to context · c7c48dfd
      Ben Widawsky 提交于
      Pretty straightforward so far except for the bit about the refcounting.
      The PPGTT will potentially be shared amongst multiple contexts. Because
      contexts themselves have a refcounted lifecycle, the easiest way to
      manage this will be to refcount the PPGTT. To acheive this, we piggy
      back off of the existing context refcount, and will increment and
      decrement the PPGTT refcount with context creation, and destruction.
      
      To put it more clearly, if context A, and context B both use PPGTT 0, we
      can't free the PPGTT until both A, and B are destroyed.
      
      Note that because the PPGTT is permanently pinned (for now), it really
      just matters for the PPGTT destruction, as opposed to making space under
      memory pressure.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c7c48dfd
    • B
      drm/i915: Generalize default context setup · a45d0f6a
      Ben Widawsky 提交于
      The plan to to make every file descriptor have a default context. To
      accommodate this, generalize out default context setup function so it
      can be used at file open time.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a45d0f6a
    • B
      drm/i915: Split context enabling from init · 2fa48d8d
      Ben Widawsky 提交于
      We **need** to do this for exactly 1 reason, because we want to embed a
      PPGTT into the context, but we don't want to special case the default
      context.
      
      To achieve that, we must be able to initialize contexts after the GTT is
      setup (so we can allocate and pin the default context's BO), but before
      the PPGTT and rings are initialized. This is because, currently, context
      initialization requires ring usage. We don't have rings until after the
      GTT is setup. If we split the enabling part of context initialization,
      the part requiring the ringbuffer, we can untangle this, and then later
      embed the PPGTT
      
      Incidentally this allows us to also adhere to the original design of
      context init/fini in future patches: they were only ever meant to be
      called at driver load and unload.
      
      v2: Move hw_contexts_disabled test in i915_gem_context_enable() (Chris)
      
      v3: BUG_ON after checking for disabled contexts. Or else it blows up pre
      gen6 (Ben)
      
      v4: Forward port
      Modified enable for each ring, since that patch is earlier in the series
      Dropped ring arg from create_default_context so it can be used by others
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2fa48d8d
    • B
      drm/i915: Better reset handling for contexts · acce9ffa
      Ben Widawsky 提交于
      This patch adds to changes for contexts on reset:
      Sets last context to default - this will prevent the context switch
      happening after a reset. That switch is not possible because the
      rings are hung during reset and context switch requires reset. This
      behavior will need to be reworked in the future, but this is what we
      want for now.
      
      In the future, we'll also want to reset the guilty context to
      uninitialized. We should wait for ARB_Robustness related code to land
      for that.
      
      This is somewhat for paranoia.  Because we really don't know what the
      GPU was doing when it hung, or the state it was in (mid context write,
      for example), later restoring the context is a bad idea. By setting the
      flag to not initialized, the next load of that context will not restore
      the state, and thus on the subsequent switch away from the context will
      overwrite the old data.
      
      NOTE: This code needs a fixup when we actually have multiple VMs. The
      issue that can occur is inactive objects in a VM will need to be
      destroyed before the last context unref. This can now happen via the
      fake switch introduced in this patch (and it other ways in the future)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      acce9ffa
    • B
      drm/i915: Track which ring a context ran on · 0009e46c
      Ben Widawsky 提交于
      Previously we dropped the association of a context to a ring. It is
      however very important to know which ring a context ran on (we could
      have reused the other member, but I was nitpicky).
      
      This is very important when we switch address spaces, which unlike
      context objects, do change per ring.
      
      As an example, if we have:
      
              RCS   BCS
      ctx            A
      ctx      A
      ctx      B
      ctx            B
      
      Without tracking the last ring B ran on, we wouldn't know to switch the
      address space on BCS in the last row.
      
      As a result, we no longer need to track which ring a context "belongs"
      to, as it never really made much sense anyway.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0009e46c
    • B
      drm/i915: Permit contexts on all rings · 67e3d297
      Ben Widawsky 提交于
      If we want to use contexts in more abstract terms (specifically with
      PPGTT in mind), we need to allow them to be specified for any ring.
      
      Since the upcoming patches will bring about the use of multiple address
      spaces, and each ring needs to have an address space programmed (which
      we intend to do at context switch time), we can no longer only use RCS.
      
      With multiple rings having a last context, we must now unreference these
      contexts.
      
      NOTE: This commit requires an update to intel-gpu-tools to make it not
      fail.
      
      v2: Rebased with some logical conflicts.
      Squashed in the context fini refcount patch
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      67e3d297
    • B
      drm/i915: relax context alignment · b731d33d
      Ben Widawsky 提交于
      With the introduction of contexts per fd in the future, one can easily
      envision more contexts being used. We do not have an easy remedy to
      reduce the space requirements of the contexts, we can make things
      slightly better by using less stringent alignments on later hardware.
      
      Ville: Since I can almost predict you'll point this out. I can no longer
      find the docs which specify the 64k requirement on certain gen6 SKUs. If
      you'd like to change that too, be my guest.
      
      CC: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b731d33d
    • B
      drm/i915: Add a context open function · e422b888
      Ben Widawsky 提交于
      We'll be doing a bit more stuff with each file, so having our own open
      function should make things clean.
      
      This also allows us to easily add conditionals for stuff we don't want
      to do when we don't have HW contexts.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e422b888
    • B
      drm/i915: Create bind/unbind abstraction for VMAs · 6f65e29a
      Ben Widawsky 提交于
      To sum up what goes on here, we abstract the vma binding, similarly to
      the previous object binding. This helps for distinguishing legacy
      binding, versus modern binding. To keep the code churn as minimal as
      possible, I am leaving in insert_entries(). It serves as the per
      platform pte writing basically. bind_vma and insert_entries do share a
      lot of similarities, and I did have designs to combine the two, but as
      mentioned already... too much churn in an already massive patchset.
      
      What follows are the 3 commits which existed discretely in the original
      submissions. Upon rebasing on Broadwell support, it became clear that
      separation was not good, and only made for more error prone code. Below
      are the 3 commit messages with all their history.
      
      drm/i915: Add bind/unbind object functions to VMA
      drm/i915: Use the new vm [un]bind functions
      drm/i915: reduce vm->insert_entries() usage
      
      drm/i915: Add bind/unbind object functions to VMA
      
      As we plumb the code with more VM information, it has become more
      obvious that the easiest way to deal with bind and unbind is to simply
      put the function pointers in the vm, and let those choose the correct
      way to handle the page table updates. This change allows many places in
      the code to simply be vm->bind, and not have to worry about
      distinguishing PPGTT vs GGTT.
      
      Notice that this patch has no impact on functionality. I've decided to
      save the actual change until the next patch because I think it's easier
      to review that way. I'm happy to squash the two, or let Daniel do it on
      merge.
      
      v2:
      Make ggtt handle the quirky aliasing ppgtt
      Add flags to bind object to support above
      Don't ever call bind/unbind directly for PPGTT until we have real, full
      PPGTT (use NULLs to assert this)
      Make sure we rebind the ggtt if there already is a ggtt binding.  This
      happens on set cache levels.
      Use VMA for bind/unbind (Daniel, Ben)
      
      v3: Reorganize ggtt_vma_bind to be more concise and easier to read
      (Ville). Change logic in unbind to only unbind ggtt when there is a
      global mapping, and to remove a redundant check if the aliasing ppgtt
      exists.
      
      v4: Make the bind function a bit smarter about the cache levels to avoid
      unnecessary multiple remaps. "I accept it is a wart, I think unifying
      the pin_vma / bind_vma could be unified later" (Chris)
      Removed the git notes, and put version info here. (Daniel)
      
      v5: Update the comment to not suck (Chris)
      
      v6:
      Move bind/unbind to the VMA. It makes more sense in the VMA structure
      (always has, but I was previously lazy). With this change, it will allow
      us to keep a distinct insert_entries.
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      
      drm/i915: Use the new vm [un]bind functions
      
      Building on the last patch which created the new function pointers in
      the VM for bind/unbind, here we actually put those new function pointers
      to use.
      
      Split out as a separate patch to aid in review. I'm fine with squashing
      into the previous patch if people request it.
      
      v2: Updated to address the smart ggtt which can do aliasing as needed
      Make sure we bind to global gtt when mappable and fenceable. I thought
      we could get away without this initialy, but we cannot.
      
      v3: Make the global GTT binding explicitly use the ggtt VM for
      bind_vma(). While at it, use the new ggtt_vma helper (Chris)
      
      At this point the original mailing list thread diverges. ie.
      
      v4^:
      use target_obj instead of obj for gen6 relocate_entry
      vma->bind_vma() can be called safely during pin. So simply do that
      instead of the complicated conditionals.
      Don't restore PPGTT bound objects on resume path
      Bug fix in resume path for globally bound Bos
      Properly handle secure dispatch
      Rebased on vma bind/unbind conversion
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      
      drm/i915: reduce vm->insert_entries() usage
      
      FKA: drm/i915: eliminate vm->insert_entries()
      
      With bind/unbind function pointers in place, we no longer need
      insert_entries. We could, and want, to remove clear_range, however it's
      not totally easy at this point. Since it's used in a couple of place
      still that don't only deal in objects: setup, ppgtt init, and restore
      gtt mappings.
      
      v2: Don't actually remove insert_entries, just limit its usage. It will
      be useful when we introduce gen8. It will always be called from the vma
      bind/unbind.
      
      Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6f65e29a
    • B
      drm/i915: Make pin count per VMA · d7f46fc4
      Ben Widawsky 提交于
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d7f46fc4
  4. 06 12月, 2013 1 次提交
    • D
      drm/i915: Fix use-after-free in do_switch · acc240d4
      Daniel Vetter 提交于
      So apparently under ridiculous amounts of memory pressure we can get
      into trouble in do_switch when we try to move the old hw context
      backing storage object onto the active lists.
      
      With list debugging enabled that usually results in us chasing a
      poisoned pointer - which means we've hit upon a vma that has been
      removed from all lrus with list_del (and then deallocated, so it's a
      real use-after free).
      
      Ian Lister has done some great callchain chasing and noticed that we
      can reenter do_switch:
      
      i915_gem_do_execbuffer()
      
      i915_switch_context()
      
      do_switch()
         from = ring->last_context;
         i915_gem_object_pin()
      
            i915_gem_object_bind_to_gtt()
               ret = drm_mm_insert_node_in_range_generic();
               // If the above call fails then it will try i915_gem_evict_something()
               // If that fails it will call i915_gem_evict_everything() ...
      	 i915_gem_evict_everything()
      	    i915_gpu_idle()
      	       i915_switch_context(DEFAULT_CONTEXT)
      
      Like with everything else where the shrinker or eviction code can
      invalidate pointers we need to reload relevant state.
      
      Note that there's no need to recheck whether a context switch is still
      required because:
      
      - Doing a switch to the same context is harmless (besides wasting a
        bit of energy).
      
      - This can only happen with the default context. But since that one's
        pinned we'll never call down into evict_everything under normal
        circumstances. Note that there's a little driver bringup fun
        involved namely that we could recourse into do_switch for the
        initial switch. Atm we're fine since we assign the context pointer
        only after the call to do_switch at driver load or resume time. And
        in the gpu reset case we skip the entire setup sequence (which might
        be a bug on its own, but definitely not this one here).
      
      Cc'ing stable since apparently ChromeOS guys are seeing this in the
      wild (and not just on artificial stress tests), see the reference.
      
      Note that in upstream code doesn't calle evict_everything directly
      from evict_something, that's an extension in this product branch. But
      we can still hit upon this bug (and apparently we do, see the linked
      backtraces). I've noticed this while trying to construct a testcase
      for this bug and utterly failed to provoke it. It looks like we need
      to driver the system squarly into the lowmem wall and provoke the
      shrinker to evict the context object by doing the last-ditch
      evict_everything call.
      
      Aside: There's currently no means to get a badly-fragmenting hw
      context object away from a bad spot in the upstream code. We should
      fix this by at least adding some code to evict_something to handle hw
      contexts.
      
      References: https://code.google.com/p/chromium/issues/detail?id=248191Reported-by: NIan Lister <ian.lister@intel.com>
      Cc: Ian Lister <ian.lister@intel.com>
      Cc: stable@vger.kernel.org
      Cc: Ben Widawsky <benjamin.widawsky@intel.com>
      Cc: Stéphane Marchesin <marcheu@chromium.org>
      Cc: Bloomfield, Jon <jon.bloomfield@intel.com>
      Tested-by: NRafael Barbalho <rafael.barbalho@intel.com>
      Reviewed-by: NIan Lister <ian.lister@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      acc240d4
  5. 04 12月, 2013 1 次提交
  6. 26 11月, 2013 1 次提交
  7. 09 11月, 2013 1 次提交
  8. 07 11月, 2013 1 次提交
  9. 16 10月, 2013 1 次提交
  10. 01 10月, 2013 1 次提交
  11. 20 9月, 2013 2 次提交
    • B
      drm/i915: Do remaps for all contexts · 3ccfd19d
      Ben Widawsky 提交于
      On both Ivybridge and Haswell, row remapping information is saved and
      restored with context. This means, we never actually properly supported
      the l3 remapping because our sysfs interface is asynchronous (and not
      tied to any context), and the known faulty HW would be reused by the
      next context to run.
      
      Not that due to the asynchronous nature of the sysfs entry, there is no
      point modifying the registers for the existing context. Instead we set a
      flag for all contexts to load the correct remapping information on the
      next run. Interested clients can use debugfs to determine whether or not
      the row has been remapped.
      
      One could propose at this point that we just do the remapping in the
      kernel. I guess since we have to maintain the sysfs interface anyway,
      I'm not sure how useful it is, and I do like keeping the policy in
      userspace; (it wasn't my original decision to make the
      interface the way it is, so I'm not attached).
      
      v2: Force a context switch when we have a remap on the next switch.
      (Ville)
      Don't let userspace use the interface with disabled contexts.
      
      v3: Don't force a context switch, just let it nop
      Improper context slice remap initialization, 1<<1 instead of 1<<i, but I
      rewrote it to avoid a second round of confusion.
      Error print moved to error path (All Ville)
      Added a comment on why the slice remap initialization happens.
      
      CC: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      3ccfd19d
    • B
      drm/i915: Keep a list of all contexts · a33afea5
      Ben Widawsky 提交于
      I have implemented this patch before without creating a separate list
      (I'm having trouble finding the links, but the messages ids are:
      <1364942743-6041-2-git-send-email-ben@bwidawsk.net>
      <1365118914-15753-9-git-send-email-ben@bwidawsk.net>)
      
      However, the code is much simpler to just use a list and it makes the
      code from the next patch a lot more pretty.
      
      As you'll see in the next patch, the reason for this is to be able to
      specify when a context needs to get L3 remapping. More details there.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a33afea5
  12. 04 9月, 2013 2 次提交
    • D
      drm/i915: It's its! · 508842a0
      Damien Lespiau 提交于
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Acked-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      508842a0
    • C
      drm/i915: Do not add an interrupt for a context switch · c0321e2c
      Chris Wilson 提交于
      We use the request to ensure we hold a reference to the context for the
      duration that it remains in use by the ring. Each request only holds a
      reference to the current context, hence we emit a request after
      switching contexts with the final reference to the old context. However,
      the extra interrupt caused by that request is not useful (no timing
      critical function will wait for the context object), instead the overhead
      of servicing the IRQ shows up in some (lightweight) benchmarks. In order
      to keep the useful property of using the request to manage the context
      lifetime, we want to add a dummy request that is associated with the
      interrupt from the subsequent real request following the batch.
      
      The extra interrupt was added as a side-effect of using
      i915_add_request() in
      
      commit 112522f6
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Thu May 2 16:48:07 2013 +0300
      
          drm/i915: put context upon switching
      
      v2: Daniel convinced me that the request here was solely for context
      lifetime tracking and that we have the active ref to keep the object
      alive whilst the MI_SET_CONTEXT. So the only concern then is which
      context should get the blame for MI_SET_CONTEXT failing. The old scheme
      added a request for the old context so that any hang upto and including
      the switch away would mark the old context as guilty. Now any hang here
      implicates the new context. However since we have already gone through a
      complete flush with the last context in its last request, and all that
      lies in no-man's-land is an invalidate flush and the MI_SET_CONTEXT, we
      should be safe in not unduly placing blame on the new context.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ben Widawsky <ben@bwidawsk.net>
      Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c0321e2c
  13. 08 8月, 2013 1 次提交
    • 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
  14. 06 8月, 2013 2 次提交
  15. 16 7月, 2013 1 次提交
  16. 09 7月, 2013 1 次提交
    • B
      drm/i915: Getter/setter for object attributes · f343c5f6
      Ben Widawsky 提交于
      Soon we want to gut a lot of our existing assumptions how many address
      spaces an object can live in, and in doing so, embed the drm_mm_node in
      the object (and later the VMA).
      
      It's possible in the future we'll want to add more getter/setter
      methods, but for now this is enough to enable the VMAs.
      
      v2: Reworked commit message (Ben)
      Added comments to the main functions (Ben)
      sed -i "s/i915_gem_obj_set_color/i915_gem_obj_ggtt_set_color/" drivers/gpu/drm/i915/*.[ch]
      sed -i "s/i915_gem_obj_bound/i915_gem_obj_ggtt_bound/" drivers/gpu/drm/i915/*.[ch]
      sed -i "s/i915_gem_obj_size/i915_gem_obj_ggtt_size/" drivers/gpu/drm/i915/*.[ch]
      sed -i "s/i915_gem_obj_offset/i915_gem_obj_ggtt_offset/" drivers/gpu/drm/i915/*.[ch]
      (Daniel)
      
      v3: Rebased on new reserve_node patch
      Changed DRM_DEBUG_KMS to actually work (will need fixing later)
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f343c5f6
  17. 01 7月, 2013 1 次提交
    • B
      drm/i915: Fix context sizes on HSW · a0de80a0
      Ben Widawsky 提交于
      With updates to the spec, we can actually see the context layout, and
      how many dwords are allocated. That table suggests we need 70720 bytes
      per HW context. Rounded up, this is 18 pages. Looking at what lives
      after the current 4 pages we use, I can't see too much important (mostly
      it's d3d related), but there are a couple of things which look scary. I
      am hopeful this can explain some of our odd HSW failures.
      
      v2: Make the context only 17 pages. The power context space isn't used
      ever, and execlists aren't used in our driver, making the actual total
      66944 bytes.
      
      v3: Add a comment to the code. (Jesse & Paulo)
      Reported-by: N"Azad, Vinit" <vinit.azad@intel.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a0de80a0
  18. 13 6月, 2013 2 次提交
  19. 01 6月, 2013 1 次提交
    • B
      drm/i915: context debug messages · bb036413
      Ben Widawsky 提交于
      Add some debug messages to help figure out what goes wrong on context
      initialization.
      
      Later in the PPGTT series, I ended up having a lot of failures after
      reset. In many cases it was extra difficult to debug because I hadn't
      even realized that contexts failed to reinitialize after reset (again an
      artifact of some later patches).
      
      This fairly benign patch does help debug some potential issues which
      arise later.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bb036413
  20. 11 5月, 2013 1 次提交
  21. 06 5月, 2013 1 次提交