1. 30 Nov, 2020 4 commits
  2. 28 Nov, 2020 1 commit
  3. 27 Nov, 2020 2 commits
  4. 26 Nov, 2020 6 commits
    • Chris Wilson's avatar
      drm/i915/gt: Move the breadcrumb to the signaler if completed upon cancel · 85cc2917
      Chris Wilson authored
      If while we are cancelling the breadcrumb signaling, we find that the
      request is already completed, move it to the irq signaler and let it be
      signaled.
      
      v2: Tweak reference counting so that we only acquire a new reference on
      adding to a signal list, as opposed to a hidden i915_request_put of the
      caller's reference.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201126140407.31952-5-chris@chris-wilson.co.uk
      85cc2917
    • Chris Wilson's avatar
      drm/i915/gt: Split the breadcrumb spinlock between global and contexts · c744d503
      Chris Wilson authored
      As we funnel more and more contexts into the breadcrumbs on an engine,
      the hold time of b->irq_lock grows. As we may then contend with the
      b->irq_lock during request submission, this increases the burden upon
      the engine->active.lock and so directly impacts both our execution
      latency and client latency. If we split the b->irq_lock by introducing a
      per-context spinlock to manage the signalers within a context, we then
      only need the b->irq_lock for enabling/disabling the interrupt and can
      avoid taking the lock for walking the list of contexts within the signal
      worker. Even with the current setup, this greatly reduces the number of
      times we have to take and fight for b->irq_lock.
      
      Furthermore, this closes the race between enabling the signaling context
      while it is in the process of being signaled and removed:
      
      <4>[  416.208555] list_add corruption. prev->next should be next (ffff8881951d5910), but was dead000000000100. (prev=ffff8882781bb870).
      <4>[  416.208573] WARNING: CPU: 7 PID: 0 at lib/list_debug.c:28 __list_add_valid+0x4d/0x70
      <4>[  416.208575] Modules linked in: i915(+) vgem snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio mei_hdcp x86_pkg_temp_thermal coretemp ax88179_178a usbnet mii crct10dif_pclmul snd_intel_dspcfg crc32_pclmul snd_hda_codec snd_hwdep ghash_clmulni_intel snd_hda_core e1000e snd_pcm ptp pps_core mei_me mei prime_numbers intel_lpss_pci [last unloaded: i915]
      <4>[  416.208611] CPU: 7 PID: 0 Comm: swapper/7 Tainted: G     U            5.8.0-CI-CI_DRM_8852+ #1
      <4>[  416.208614] Hardware name: Intel Corporation Ice Lake Client Platform/IceLake Y LPDDR4x T4 RVP TLC, BIOS ICLSFWR1.R00.3212.A00.1905212112 05/21/2019
      <4>[  416.208627] RIP: 0010:__list_add_valid+0x4d/0x70
      <4>[  416.208631] Code: c3 48 89 d1 48 c7 c7 60 18 33 82 48 89 c2 e8 ea e0 b6 ff 0f 0b 31 c0 c3 48 89 c1 4c 89 c6 48 c7 c7 b0 18 33 82 e8 d3 e0 b6 ff <0f> 0b 31 c0 c3 48 89 f2 4c 89 c1 48 89 fe 48 c7 c7 00 19 33 82 e8
      <4>[  416.208633] RSP: 0018:ffffc90000280e18 EFLAGS: 00010086
      <4>[  416.208636] RAX: 0000000000000000 RBX: ffff888250a44880 RCX: 0000000000000105
      <4>[  416.208639] RDX: 0000000000000105 RSI: ffffffff82320c5b RDI: 00000000ffffffff
      <4>[  416.208641] RBP: ffff8882781bb870 R08: 0000000000000000 R09: 0000000000000001
      <4>[  416.208643] R10: 00000000054d2957 R11: 000000006abbd991 R12: ffff8881951d58c8
      <4>[  416.208646] R13: ffff888286073880 R14: ffff888286073848 R15: ffff8881951d5910
      <4>[  416.208669] FS:  0000000000000000(0000) GS:ffff88829c180000(0000) knlGS:0000000000000000
      <4>[  416.208671] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      <4>[  416.208673] CR2: 0000556231326c48 CR3: 0000000005610001 CR4: 0000000000760ee0
      <4>[  416.208675] PKRU: 55555554
      <4>[  416.208677] Call Trace:
      <4>[  416.208679]  <IRQ>
      <4>[  416.208751]  i915_request_enable_breadcrumb+0x278/0x400 [i915]
      <4>[  416.208839]  __i915_request_submit+0xca/0x2a0 [i915]
      <4>[  416.208892]  __execlists_submission_tasklet+0x480/0x1830 [i915]
      <4>[  416.208942]  execlists_submission_tasklet+0xc4/0x130 [i915]
      <4>[  416.208947]  tasklet_action_common.isra.17+0x6c/0x1c0
      <4>[  416.208954]  __do_softirq+0xdf/0x498
      <4>[  416.208960]  ? handle_fasteoi_irq+0x150/0x150
      <4>[  416.208964]  asm_call_on_stack+0xf/0x20
      <4>[  416.208966]  </IRQ>
      <4>[  416.208969]  do_softirq_own_stack+0xa1/0xc0
      <4>[  416.208972]  irq_exit_rcu+0xb5/0xc0
      <4>[  416.208976]  common_interrupt+0xf7/0x260
      <4>[  416.208980]  asm_common_interrupt+0x1e/0x40
      <4>[  416.208985] RIP: 0010:cpuidle_enter_state+0xb6/0x410
      <4>[  416.208987] Code: 00 31 ff e8 9c 3e 89 ff 80 7c 24 0b 00 74 12 9c 58 f6 c4 02 0f 85 31 03 00 00 31 ff e8 e3 6c 90 ff e8 fe a4 94 ff fb 45 85 ed <0f> 88 c7 02 00 00 49 63 c5 4c 2b 24 24 48 8d 14 40 48 8d 14 90 48
      <4>[  416.208989] RSP: 0018:ffffc90000143e70 EFLAGS: 00000206
      <4>[  416.208991] RAX: 0000000000000007 RBX: ffffe8ffffda8070 RCX: 0000000000000000
      <4>[  416.208993] RDX: 0000000000000000 RSI: ffffffff8238b4ee RDI: ffffffff8233184f
      <4>[  416.208995] RBP: ffffffff826b4e00 R08: 0000000000000000 R09: 0000000000000000
      <4>[  416.208997] R10: 0000000000000001 R11: 0000000000000000 R12: 00000060e7f24a8f
      <4>[  416.208998] R13: 0000000000000003 R14: 0000000000000003 R15: 0000000000000003
      <4>[  416.209012]  cpuidle_enter+0x24/0x40
      <4>[  416.209016]  do_idle+0x22f/0x2d0
      <4>[  416.209022]  cpu_startup_entry+0x14/0x20
      <4>[  416.209025]  start_secondary+0x158/0x1a0
      <4>[  416.209030]  secondary_startup_64+0xa4/0xb0
      <4>[  416.209039] irq event stamp: 10186977
      <4>[  416.209042] hardirqs last  enabled at (10186976): [<ffffffff810b9363>] tasklet_action_common.isra.17+0xe3/0x1c0
      <4>[  416.209044] hardirqs last disabled at (10186977): [<ffffffff81a5e5ed>] _raw_spin_lock_irqsave+0xd/0x50
      <4>[  416.209047] softirqs last  enabled at (10186968): [<ffffffff810b9a1a>] irq_enter_rcu+0x6a/0x70
      <4>[  416.209049] softirqs last disabled at (10186969): [<ffffffff81c00f4f>] asm_call_on_stack+0xf/0x20
      
      <4>[  416.209317] list_del corruption, ffff8882781bb870->next is LIST_POISON1 (dead000000000100)
      <4>[  416.209317] WARNING: CPU: 7 PID: 46 at lib/list_debug.c:47 __list_del_entry_valid+0x4e/0x90
      <4>[  416.209317] Modules linked in: i915(+) vgem snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio mei_hdcp x86_pkg_temp_thermal coretemp ax88179_178a usbnet mii crct10dif_pclmul snd_intel_dspcfg crc32_pclmul snd_hda_codec snd_hwdep ghash_clmulni_intel snd_hda_core e1000e snd_pcm ptp pps_core mei_me mei prime_numbers intel_lpss_pci [last unloaded: i915]
      <4>[  416.209317] CPU: 7 PID: 46 Comm: ksoftirqd/7 Tainted: G     U  W         5.8.0-CI-CI_DRM_8852+ #1
      <4>[  416.209317] Hardware name: Intel Corporation Ice Lake Client Platform/IceLake Y LPDDR4x T4 RVP TLC, BIOS ICLSFWR1.R00.3212.A00.1905212112 05/21/2019
      <4>[  416.209317] RIP: 0010:__list_del_entry_valid+0x4e/0x90
      <4>[  416.209317] Code: 2e 48 8b 32 48 39 fe 75 3a 48 8b 50 08 48 39 f2 75 48 b8 01 00 00 00 c3 48 89 fe 48 89 c2 48 c7 c7 38 19 33 82 e8 62 e0 b6 ff <0f> 0b 31 c0 c3 48 89 fe 48 c7 c7 70 19 33 82 e8 4e e0 b6 ff 0f 0b
      <4>[  416.209317] RSP: 0018:ffffc90000280de8 EFLAGS: 00010086
      <4>[  416.209317] RAX: 0000000000000000 RBX: ffff8882781bb848 RCX: 0000000000010104
      <4>[  416.209317] RDX: 0000000000010104 RSI: ffffffff8238b4ee RDI: 00000000ffffffff
      <4>[  416.209317] RBP: ffff8882781bb880 R08: 0000000000000000 R09: 0000000000000001
      <4>[  416.209317] R10: 000000009fb6666e R11: 00000000feca9427 R12: ffffc90000280e18
      <4>[  416.209317] R13: ffff8881951d5930 R14: dead0000000000d8 R15: ffff8882781bb880
      <4>[  416.209317] FS:  0000000000000000(0000) GS:ffff88829c180000(0000) knlGS:0000000000000000
      <4>[  416.209317] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      <4>[  416.209317] CR2: 0000556231326c48 CR3: 0000000005610001 CR4: 0000000000760ee0
      <4>[  416.209317] PKRU: 55555554
      <4>[  416.209317] Call Trace:
      <4>[  416.209317]  <IRQ>
      <4>[  416.209317]  remove_signaling_context.isra.13+0xd/0x70 [i915]
      <4>[  416.209513]  signal_irq_work+0x1f7/0x4b0 [i915]
      
      This is caused by virtual engines where although we take the breadcrumb
      lock on each of the active engines, they may be different engines on
      different requests, It turns out that the b->irq_lock was not a
      sufficient proxy for the engine->active.lock in the case of more than
      one request, so introduce an explicit lock around ce->signals.
      
      v2: ce->signal_lock is acquired with only RCU protection and so must be
      treated carefully and not cleared during reallocation. We also then need
      to confirm that the ce we lock is the same as we found in the breadcrumb
      list.
      
      Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2276
      Fixes: c18636f7 ("drm/i915: Remove requirement for holding i915_request.lock for breadcrumbs")
      Fixes: 2854d866 ("drm/i915/gt: Replace intel_engine_transfer_stale_breadcrumbs")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201126140407.31952-4-chris@chris-wilson.co.uk
      c744d503
    • Chris Wilson's avatar
      drm/i915/gt: Protect context lifetime with RCU · 14d1eaf0
      Chris Wilson authored
      Allow a brief period for continued access to a dead intel_context by
      deferring the release of the struct until after an RCU grace period.
      As we are using a dedicated slab cache for the contexts, we can defer
      the release of the slab pages via RCU, with the caveat that individual
      structs may be reused from the freelist within an RCU grace period. To
      handle that, we have to avoid clearing members of the zombie struct.
      
      This is required for a later patch to handle locking around virtual
      requests in the signaler, as those requests may want to move between
      engines and be destroyed while we are holding b->irq_lock on a physical
      engine.
      
      v2: Drop mutex_reinit(), if we never mark the mutex as destroyed we
      don't need to reset the debug code, at the loss of having the mutex
      debug code spot us attempting to destroy a locked mutex.
      v3: As the intended use will remain strongly referenced counted, with
      very little inflight access across reuse, drop the ctor.
      v4: Drop the unrequired change to remove the temporary reference around
      dropping the active context, and add back some more missing ctor
      operations.
      v5: The ctor is back. Tvrtko spotted that ce->signal_lock [introduced
      later] maybe accessed under RCU and so needs special care not to be
      reinitialised.
      v6: Don't mix SLAB_TYPESAFE_BY_RCU and RCU list iteration.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201126140407.31952-3-chris@chris-wilson.co.uk
      14d1eaf0
    • Chris Wilson's avatar
      drm/i915/gt: Check for a completed last request once · a5855989
      Chris Wilson authored
      Pull the repeated check for the last active request being completed to a
      single spot, when deciding whether or not execlist preemption is
      required.
      
      In doing so, we remove the tasklet kick, introduced with the completion
      checks in commit 35f3fd81 ("drm/i915/execlists: Workaround switching
      back to a completed context"), if we find the request was completed but
      have not yet seen the corresponding CS event. This was devolving into a
      busy spin of the tasklet while we waited for the event as the delivery
      was not as instantaneous as expected. Under load this is sufficient to
      exhaust the tasklet softirq timeslice, and force ksoftirqd. Quite
      noticeable overhead for no apparent improvement in latency.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201126140407.31952-2-chris@chris-wilson.co.uk
      a5855989
    • Chris Wilson's avatar
      drm/i915/gt: Decouple completed requests on unwind · b8e2bd98
      Chris Wilson authored
      Since the introduction of preempt-to-busy, requests can complete in the
      background, even while they are not on the engine->active.requests list.
      As such, the engine->active.request list itself is not in strict
      retirement order, and we have to scan the entire list while unwinding to
      not miss any. However, if the request is completed we currently leave it
      on the list [until retirement], but we could just as simply remove it
      and stop treating it as active. We would only have to then traverse it
      once while unwinding in quick succession.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201126140407.31952-1-chris@chris-wilson.co.uk
      b8e2bd98
    • Chris Wilson's avatar
      drm/i915/gt: Program mocs:63 for cache eviction on gen9 · 977933b5
      Chris Wilson authored
      Ville noticed that the last mocs entry is used unconditionally by the HW
      when it performs cache evictions, and noted that while the value is not
      meant to be writable by the driver, we should program it to a reasonable
      value nevertheless.
      
      As it turns out, we can change the value of mocs:63 and the value we
      were programming into it would cause hard hangs in conjunction with
      atomic operations.
      
      v2: Add details from bspec about how it is used by HW
      Suggested-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2707
      Fixes: 3bbaba0c ("drm/i915: Added Programming of the MOCS")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: <stable@vger.kernel.org> # v4.3+
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201126140841.1982-1-chris@chris-wilson.co.uk
      977933b5
  5. 24 Nov, 2020 2 commits
  6. 23 Nov, 2020 4 commits
  7. 21 Nov, 2020 1 commit
  8. 20 Nov, 2020 3 commits
  9. 19 Nov, 2020 7 commits
  10. 18 Nov, 2020 1 commit
  11. 17 Nov, 2020 2 commits
  12. 16 Nov, 2020 3 commits
  13. 15 Nov, 2020 1 commit
  14. 14 Nov, 2020 1 commit
  15. 13 Nov, 2020 2 commits
    • Dave Airlie's avatar
      Merge tag 'drm-intel-gt-next-2020-11-12-1' of... · 334a1683
      Dave Airlie authored
      Merge tag 'drm-intel-gt-next-2020-11-12-1' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
      
      Cross-subsystem Changes:
      - DMA mapped scatterlist fixes in i915 to unblock merging of
        https://lkml.org/lkml/2020/9/27/70 (Tvrtko, Tom)
      
      Driver Changes:
      
      - Fix for user reported issue #2381 (Graphical output stops with "switching to inteldrmfb from simple"):
        Mark ininitial fb obj as WT on eLLC machines to avoid rcu lockup during fbdev init (Ville, Chris)
      - Fix for Tigerlake (and earlier) to avoid spurious empty CSB events leading to hang (Chris, Bruce)
      - Delay execlist processing for Tigerlake to avoid hang (Chris)
      - Fix for Tigerlake RCS engine health check through heartbeat (Chris)
      - Fix for Tigerlake reserved MOCS entries (Ayaz, Chris)
      - Fix Media power gate sequence on Tigerlake (Rodrigo)
      - Enable eLLC caching of display buffers for SKL+ (Ville)
      - Support parsing of oversize batches on Gen9 (Matt, Chris)
      - Exclude low pages (128KiB) of stolen from use to avoid thrashing during reset (Chris)
      - Flush engines before Tigerlake breadcrumbs (Chris)
      
      - Use the local HWSP offset during submission (Chris)
      - Flush coherency domains on first set-domain-ioctl (Chris, Zbigniew)
      - Use the active reference on the vma while capturing to avoid use-after-free (Chris)
      - Fix MOCS PTE setting for gen9+ (Ville)
      - Avoid NULL dereference on IPS driver callback while unbinding i915 (Chris)
      - Avoid NULL dereference from PT/PD stash allocation error (Matt)
      - Hold request reference for canceling an active context (Chris)
      - Avoid infinite loop on x86-32 when mapping a lot of objects (Chris)
      - Disallow WC mappings when processor doesn't support them (Chris)
      - Return correct error in i915_gem_object_copy_blt() error path (Dan)
      - Return correct error in intel_context_create_request() error path (Maarten)
      - Tune down GuC communication enabled/disabled messages to debug (Jani)
      - Fix rebased commit "Remove i915_request.lock requirement for execution callbacks" (Chris)
      - Cancel outstanding work after disabling heartbeats on an engine (Chris)
      - Signal cancelled requests (Chris)
      - Retire cancelled requests on unload (Chris)
      - Scrub HW state on driver remove (Chris)
      - Undo forced context restores after trivial preemptions (Chris)
      - Handle PCI unbind in PMU code (Tvrtko)
      - Fix CPU hotplug with multiple GPUs in PMU code (Trtkko)
      - Correctly set SFC capability for video engines (Venkata)
      
      - Update GuC code to use firmware v49.0.1 (John, Matthew B., Daniele, Oscar, Michel, Rodrigo, Michal)
      - Improve GuC warnings on loading failure (John)
      - Avoid ownership race in buffer pool by clearing age (Chris)
      - Use MMIO to read CSB in case of failure (Chris, Mika)
      - Show engine properties in engine state dump to indicate changes (Chris, Joonas)
      - Break up error capture compression loops with cond_resched() (Chris)
      - Reduce GPU error capture mutex hold time to avoid khungtaskd (Chris)
      - Serialise debugfs i915_gem_objects with ctx->mutex (Chris)
      - Always test execution status on closing the context and close if not persistent (Chris)
      - Avoid mixing integer types during batch copies (Chris, Jared)
      - Skip over MI_NOOP when parsing to avoid overhead (Chris)
      - Hold onto an explicit ref to i915_vma_work.pinned (Chris)
      - Perform all asynchronous waits prior to marking payload start (Chris)
      - Pull phys pread/pwrite implementations to the backend (Matt)
      
      - Improve record of hung engines in error state (Tvrtko)
      - Allow backends to override pread implementation (Matt)
      - Reinforce LRC poisoning checks to confirm context survives execution (Chris)
      - Fix memory region max size calculation (Matt)
      - Fix order when adding blocks to memory region (Matt)
      - Eliminate unused intel_virtual_engine_get_sibling func (Chris)
      - Cleanup kasan warning for on-stack (unsigned long) casting (Chris)
      - Onion unwind for scratch page allocation failure (Chris)
      - Poison stolen pages before use (Chris)
      - Selftest improvements (Chris)
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201112163407.GA20320@jlahtine-mobl.ger.corp.intel.com
      334a1683
    • Dave Airlie's avatar
      drm/Kconfig: rename keembay config · 24bdae69
      Dave Airlie authored
      This all caps looked ugly.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      24bdae69