1. 28 5月, 2019 1 次提交
  2. 08 5月, 2019 1 次提交
  3. 01 5月, 2019 1 次提交
  4. 27 4月, 2019 1 次提交
  5. 26 4月, 2019 3 次提交
    • C
      drm/i915: Enable render context support for gen4 (Broadwater to Cantiga) · 9ce9bdb0
      Chris Wilson 提交于
      Broadwater and the rest of gen4  do support being able to saving and
      reloading context specific registers between contexts, providing isolation
      of the basic GPU state (as programmable by userspace). This allows
      userspace to assume that the GPU retains their state from one batch to the
      next, minimising the amount of state it needs to reload and manually save
      across batches.
      
      v2: CONSTANT_BUFFER woes
      
      Running through piglit turned up an interesting issue, a GPU hang inside
      the context load. The context image includes the CONSTANT_BUFFER command
      that loads an address into a on-gpu buffer, and the context load was
      executing that immediately. However, since it was reading from the GTT
      there is no guarantee that the GTT retains the same configuration as
      when the context was saved, resulting in stray reads and a GPU hang.
      
      Having tried issuing a CONSTANT_BUFFER (to disable the command) from the
      ring before saving the context to no avail, we resort to patching out
      the instruction inside the context image before loading.
      
      This does impose that gen4 always reissues CONSTANT_BUFFER commands on
      each batch, but due to the use of a shared GTT that was and will remain
      a requirement.
      
      v3: ECOSKPD to the rescue
      
      Ville found the magic bit in the ECOSKPD to disable saving and restoring
      the CONSTANT_BUFFER from the context image, thereby completely avoiding
      the GPU hangs from chasing invalid pointers. This appears to be the
      default behaviour for gen5, and so we just need to tweak gen4 to match.
      
      v4: Fix spelling of ECOSKPD and discover it already exists
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Reviewed-by: NKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190419172720.5462-1-chris@chris-wilson.co.uk
      9ce9bdb0
    • C
      drm/i915: Enable render context support for Ironlake (gen5) · 1215d28e
      Chris Wilson 提交于
      Ironlake does support being able to saving and reloading context specific
      registers between contexts, providing isolation of the basic GPU state
      (as programmable by userspace). This allows userspace to assume that the
      GPU retains their state from one batch to the next, minimising the
      amount of state it needs to reload, or manually save and restore.
      
      v2: Fix off-by-one in reading CXT_SIZE, and add a comment that the
      CXT_SIZE and context-layout do not match in bspec, but the difference is
      irrelevant as we overallocate the full page anyway (Ville).
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190419111749.3910-2-chris@chris-wilson.co.uk
      1215d28e
    • C
      drm/i915/ringbuffer: EMIT_INVALIDATE *before* switch context · 928f8f42
      Chris Wilson 提交于
      Despite what I think the prm recommends, commit f2253bd9
      ("drm/i915/ringbuffer: EMIT_INVALIDATE after switch context") turned out
      to be a huge mistake when enabling Ironlake contexts as the GPU would
      hang on either a MI_FLUSH or PIPE_CONTROL immediately following the
      MI_SET_CONTEXT of an active mesa context (more vanilla contexts, e.g.
      simple rendercopies with igt, do not suffer).
      
      Ville found the following clue,
      
        "[DevCTG+]: For the invalidate operation of the pipe control, the
         following pointers are affected. The
         invalidate operation affects the restore of these packets. If the pipe
         control invalidate operation is completed
         before the context save, the indirect pointers will not be restored from
         memory.
         1. Pipeline State Pointer
         2. Media State Pointer
         3. Constant Buffer Packet"
      
      which suggests by us emitting the INVALIDATE prior to the MI_SET_CONTEXT,
      we prevent the context-restore from chasing the dangling pointers within
      the image, and explains why this likely prevents the GPU hang.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190419111749.3910-1-chris@chris-wilson.co.uk
      928f8f42
  6. 25 4月, 2019 4 次提交
    • C
      drm/i915: Invert the GEM wakeref hierarchy · 79ffac85
      Chris Wilson 提交于
      In the current scheme, on submitting a request we take a single global
      GEM wakeref, which trickles down to wake up all GT power domains. This
      is undesirable as we would like to be able to localise our power
      management to the available power domains and to remove the global GEM
      operations from the heart of the driver. (The intent there is to push
      global GEM decisions to the boundary as used by the GEM user interface.)
      
      Now during request construction, each request is responsible via its
      logical context to acquire a wakeref on each power domain it intends to
      utilize. Currently, each request takes a wakeref on the engine(s) and
      the engines themselves take a chipset wakeref. This gives us a
      transition on each engine which we can extend if we want to insert more
      powermangement control (such as soft rc6). The global GEM operations
      that currently require a struct_mutex are reduced to listening to pm
      events from the chipset GT wakeref. As we reduce the struct_mutex
      requirement, these listeners should evaporate.
      
      Perhaps the biggest immediate change is that this removes the
      struct_mutex requirement around GT power management, allowing us greater
      flexibility in request construction. Another important knock-on effect,
      is that by tracking engine usage, we can insert a switch back to the
      kernel context on that engine immediately, avoiding any extra delay or
      inserting global synchronisation barriers. This makes tracking when an
      engine and its associated contexts are idle much easier -- important for
      when we forgo our assumed execution ordering and need idle barriers to
      unpin used contexts. In the process, it means we remove a large chunk of
      code whose only purpose was to switch back to the kernel context.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190424200717.1686-5-chris@chris-wilson.co.uk
      79ffac85
    • C
      drm/i915: Pass intel_context to i915_request_create() · 2ccdf6a1
      Chris Wilson 提交于
      Start acquiring the logical intel_context and using that as our primary
      means for request allocation. This is the initial step to allow us to
      avoid requiring struct_mutex for request allocation along the
      perma-pinned kernel context, but it also provides a foundation for
      breaking up the complex request allocation to handle different scenarios
      inside execbuf.
      
      For the purpose of emitting a request from inside retirement (see the
      next patch for engine power management), we also need to lift control
      over the timeline mutex to the caller.
      
      v2: Note that the request carries the active reference upon construction.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190424200717.1686-4-chris@chris-wilson.co.uk
      2ccdf6a1
    • C
      drm/i915: Introduce context->enter() and context->exit() · 6eee33e8
      Chris Wilson 提交于
      We wish to start segregating the power management into different control
      domains, both with respect to the hardware and the user interface. The
      first step is that at the lowest level flow of requests, we want to
      process a context event (and not a global GEM operation). In this patch,
      we introduce the context callbacks that in future patches will be
      redirected to per-engine interfaces leading to global operations as
      required.
      
      The intent is that this will be guarded by the timeline->mutex, except
      that retiring has not quite finished transitioning over from being
      guarded by struct_mutex. So at the moment it is protected by
      struct_mutex with a reminded to switch.
      
      v2: Rename default handlers to intel_context_enter_engine.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190424200717.1686-3-chris@chris-wilson.co.uk
      6eee33e8
    • C
      drm/i915: Move GraphicsTechnology files under gt/ · 112ed2d3
      Chris Wilson 提交于
      Start partitioning off the code that talks to the hardware (GT) from the
      uapi layers and move the device facing code under gt/
      
      One casualty is s/intel_ringbuffer.h/intel_engine.h/ with the plan to
      subdivide that header and body further (and split out the submission
      code from the ringbuffer and logical context handling). This patch aims
      to be simple motion so git can fixup inflight patches with little mess.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Acked-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Acked-by: NJani Nikula <jani.nikula@intel.com>
      Acked-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190424174839.7141-1-chris@chris-wilson.co.uk
      112ed2d3
  7. 19 4月, 2019 2 次提交
  8. 17 4月, 2019 1 次提交
    • P
      drm/i915: add GEN2_ prefix to the I{E, I, M, S}R registers · 9d9523d8
      Paulo Zanoni 提交于
      This discussion started because we use token pasting in the
      GEN{2,3}_IRQ_INIT and GEN{2,3}_IRQ_RESET macros, so gen2-4 passes an
      empty argument to those macros, making the code a little weird. The
      original proposal was to just add a comment as the empty argument, but
      Ville suggested we just add a prefix to the registers, and that indeed
      sounds like a more elegant solution.
      
      Now doing this is kinda against our rules for register naming since we
      only add gens or platform names as register prefixes when the given
      gen/platform changes a register that already existed before. On the
      other hand, we have so many instances of IIR/IMR in comments that
      adding a prefix would make the users of these register more easily
      findable, in addition to make our token pasting macros actually
      readable. So IMHO opening an exception here is worth it.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190410235344.31199-4-paulo.r.zanoni@intel.com
      9d9523d8
  9. 11 4月, 2019 1 次提交
  10. 30 3月, 2019 1 次提交
  11. 27 3月, 2019 3 次提交
  12. 22 3月, 2019 1 次提交
    • C
      drm/i915: Flush pages on acquisition · a679f58d
      Chris Wilson 提交于
      When we return pages to the system, we ensure that they are marked as
      being in the CPU domain since any external access is uncontrolled and we
      must assume the worst. This means that we need to always flush the pages
      on acquisition if we need to use them on the GPU, and from the beginning
      have used set-domain. Set-domain is overkill for the purpose as it is a
      general synchronisation barrier, but our intent is to only flush the
      pages being swapped in. If we move that flush into the pages acquisition
      phase, we know then that when we have obj->mm.pages, they are coherent
      with the GPU and need only maintain that status without resorting to
      heavy handed use of set-domain.
      
      The principle knock-on effect for userspace is through mmap-gtt
      pagefaulting. Our uAPI has always implied that the GTT mmap was async
      (especially as when any pagefault occurs is unpredicatable to userspace)
      and so userspace had to apply explicit domain control itself
      (set-domain). However, swapping is transparent to the kernel, and so on
      first fault we need to acquire the pages and make them coherent for
      access through the GTT. Our use of set-domain here leaks into the uABI
      that the first pagefault was synchronous. This is unintentional and
      baring a few igt should be unoticed, nevertheless we bump the uABI
      version for mmap-gtt to reflect the change in behaviour.
      
      Another implication of the change is that gem_create() is presumed to
      create an object that is coherent with the CPU and is in the CPU write
      domain, so a set-domain(CPU) following a gem_create() would be a minor
      operation that merely checked whether we could allocate all pages for
      the object. On applying this change, a set-domain(CPU) causes a clflush
      as we acquire the pages. This will have a small impact on mesa as we move
      the clflush here on !llc from execbuf time to create, but that should
      have minimal performance impact as the same clflush exists but is now
      done early and because of the clflush issue, userspace recycles bo and
      so should resist allocating fresh objects.
      
      Internally, the presumption that objects are created in the CPU
      write-domain and remain so through writes to obj->mm.mapping is more
      prevalent than I expected; but easy enough to catch and apply a manual
      flush.
      
      For the future, we should push the page flush from the central
      set_pages() into the callers so that we can more finely control when it
      is applied, but for now doing it one location is easier to validate, at
      the cost of sometimes flushing when there is no need.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Matthew Auld <matthew.william.auld@gmail.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Antonio Argenziano <antonio.argenziano@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: NMatthew Auld <matthew.william.auld@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190321161908.8007-1-chris@chris-wilson.co.uk
      a679f58d
  13. 21 3月, 2019 2 次提交
  14. 19 3月, 2019 4 次提交
  15. 12 3月, 2019 1 次提交
  16. 08 3月, 2019 6 次提交
  17. 06 3月, 2019 1 次提交
  18. 26 2月, 2019 3 次提交
  19. 08 2月, 2019 1 次提交
    • C
      drm/i915: Hack and slash, throttle execbuffer hogs · d6f328bf
      Chris Wilson 提交于
      Apply backpressure to hogs that emit requests faster than the GPU can
      process them by waiting for their ring to be less than half-full before
      proceeding with taking the struct_mutex.
      
      This is a gross hack to apply throttling backpressure, the long term
      goal is to remove the struct_mutex contention so that each client
      naturally waits, preferably in an asynchronous, nonblocking fashion
      (pipelined operations for the win), for their own resources and never
      blocks another client within the driver at least. (Realtime priority
      goals would extend to ensuring that resource contention favours high
      priority clients as well.)
      
      This patch only limits excessive request production and does not attempt
      to throttle clients that block waiting for eviction (either global GTT or
      system memory) or any other global resources, see above for the long term
      goal.
      
      No microbenchmarks are harmed (to the best of my knowledge).
      
      Testcase: igt/gem_exec_schedule/pi-ringfull-*
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: John Harrison <John.C.Harrison@Intel.com>
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190207071829.5574-1-chris@chris-wilson.co.uk
      d6f328bf
  20. 30 1月, 2019 2 次提交
    • C
      drm/i915: Replace global breadcrumbs with per-context interrupt tracking · 52c0fdb2
      Chris Wilson 提交于
      A few years ago, see commit 688e6c72 ("drm/i915: Slaughter the
      thundering i915_wait_request herd"), the issue of handling multiple
      clients waiting in parallel was brought to our attention. The
      requirement was that every client should be woken immediately upon its
      request being signaled, without incurring any cpu overhead.
      
      To handle certain fragility of our hw meant that we could not do a
      simple check inside the irq handler (some generations required almost
      unbounded delays before we could be sure of seqno coherency) and so
      request completion checking required delegation.
      
      Before commit 688e6c72, the solution was simple. Every client
      waiting on a request would be woken on every interrupt and each would do
      a heavyweight check to see if their request was complete. Commit
      688e6c72 introduced an rbtree so that only the earliest waiter on
      the global timeline would woken, and would wake the next and so on.
      (Along with various complications to handle requests being reordered
      along the global timeline, and also a requirement for kthread to provide
      a delegate for fence signaling that had no process context.)
      
      The global rbtree depends on knowing the execution timeline (and global
      seqno). Without knowing that order, we must instead check all contexts
      queued to the HW to see which may have advanced. We trim that list by
      only checking queued contexts that are being waited on, but still we
      keep a list of all active contexts and their active signalers that we
      inspect from inside the irq handler. By moving the waiters onto the fence
      signal list, we can combine the client wakeup with the dma_fence
      signaling (a dramatic reduction in complexity, but does require the HW
      being coherent, the seqno must be visible from the cpu before the
      interrupt is raised - we keep a timer backup just in case).
      
      Having previously fixed all the issues with irq-seqno serialisation (by
      inserting delays onto the GPU after each request instead of random delays
      on the CPU after each interrupt), we can rely on the seqno state to
      perfom direct wakeups from the interrupt handler. This allows us to
      preserve our single context switch behaviour of the current routine,
      with the only downside that we lose the RT priority sorting of wakeups.
      In general, direct wakeup latency of multiple clients is about the same
      (about 10% better in most cases) with a reduction in total CPU time spent
      in the waiter (about 20-50% depending on gen). Average herd behaviour is
      improved, but at the cost of not delegating wakeups on task_prio.
      
      v2: Capture fence signaling state for error state and add comments to
      warm even the most cold of hearts.
      v3: Check if the request is still active before busywaiting
      v4: Reduce the amount of pointer misdirection with list_for_each_safe
      and using a local i915_request variable inside the loops
      v5: Add a missing pluralisation to a purely informative selftest message.
      
      References: 688e6c72 ("drm/i915: Slaughter the thundering i915_wait_request herd")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190129205230.19056-2-chris@chris-wilson.co.uk
      52c0fdb2
    • C
      drm/i915: Identify active requests · 85474441
      Chris Wilson 提交于
      To allow requests to forgo a common execution timeline, one question we
      need to be able to answer is "is this request running?". To track
      whether a request has started on HW, we can emit a breadcrumb at the
      beginning of the request and check its timeline's HWSP to see if the
      breadcrumb has advanced past the start of this request. (This is in
      contrast to the global timeline where we need only ask if we are on the
      global timeline and if the timeline has advanced past the end of the
      previous request.)
      
      There is still confusion from a preempted request, which has already
      started but relinquished the HW to a high priority request. For the
      common case, this discrepancy should be negligible. However, for
      identification of hung requests, knowing which one was running at the
      time of the hang will be much more important.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190129185452.20989-2-chris@chris-wilson.co.uk
      85474441