Skip to content
  1. Jun 01, 2021
  2. May 28, 2021
    • Aditya Swarup's avatar
      drm/i915: Add Wa_14010733141 · 5b26d57f
      Aditya Swarup authored
      
      
      The WA requires the following procedure for VDBox SFC reset:
      
      If (MFX-SFC usage is 1) {
      	1.Issue a MFX-SFC forced lock
      	2.Wait for MFX-SFC forced lock ack
      	3.Check the MFX-SFC usage bit
      	If (MFX-SFC usage bit is 1)
      		Reset VDBOX and SFC
      	else
      		Reset VDBOX
      	Release the force lock MFX-SFC
      }
      else if(HCP+SFC usage is 1) {
      	1.Issue a VE-SFC forced lock
      	2.Wait for SFC forced lock ack
      	3.Check the VE-SFC usage bit
      	If (VE-SFC usage bit is 1)
      		Reset VDBOX
      	else
      		Reset VDBOX and SFC
      	Release the force lock VE-SFC.
      }
      else
      	Reset VDBOX
      
      - Restructure: the changes to the original code flow should stay
        relatively minimal; we only need to do an extra HCP check after the
        usual VD-MFX check and, if true, switch the register/bit we're
        performing the lock on.(MattR)
      
      v2:
      - Assign unlock mask using paired_engine->mask instead of using
        BIT(paired_vecs->id). (Daniele)
      
      Bspec: 52890, 53509
      
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      Signed-off-by: default avatarAditya Swarup <aditya.swarup@intel.com>
      Co-developed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210526094852.286424-2-aditya.swarup@intel.com
      5b26d57f
  3. May 27, 2021
  4. May 25, 2021
  5. May 20, 2021
  6. May 17, 2021
  7. May 12, 2021
  8. May 11, 2021
  9. May 10, 2021
  10. May 07, 2021
  11. May 05, 2021
  12. May 04, 2021
    • Matthew Auld's avatar
      drm/i915/gem: hide new uAPI behind CONFIG_BROKEN · 0a46be95
      Matthew Auld authored
      
      
      Treat it the same as the fake local-memory stuff, where it is disabled
      for normal kernels, in case some random UMD is tempted to use this. Once
      we have all the other bits and pieces in place, like the TTM conversion,
      we can turn this on for real.
      
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jon Bloomfield <jon.bloomfield@intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Reviewed-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-9-matthew.auld@intel.com
      0a46be95
    • Matthew Auld's avatar
      drm/i915/gem: clear userspace buffers for LMEM · 0e997a36
      Matthew Auld authored
      
      
      All userspace objects must be cleared when allocating the backing store,
      before they are potentially visible to userspace.  For now use simple
      CPU based clearing to do this for device local-memory objects, note that
      in the near future this will instead use the blitter engine.
      
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jon Bloomfield <jon.bloomfield@intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Reviewed-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-8-matthew.auld@intel.com
      0e997a36
    • Matthew Auld's avatar
      drm/i915/lmem: support optional CPU clearing for special internal use · 4f869f1d
      Matthew Auld authored
      
      
      For some internal device local-memory objects it would be useful to have
      an option to CPU clear the pages upon gathering the backing store. Note
      that this might be before the blitter is useable, which is the case for
      some internal GuC objects.
      
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jon Bloomfield <jon.bloomfield@intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Acked-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-7-matthew.auld@intel.com
      4f869f1d
    • Matthew Auld's avatar
      drm/i915/uapi: implement object placement extension · 2459e56f
      Matthew Auld authored
      
      
      Add new extension to support setting an immutable-priority-list of
      potential placements, at creation time.
      
      If we use the normal gem_create or gem_create_ext without the
      extensions/placements then we still get the old behaviour with only
      placing the object in system memory.
      
      v2(Daniel & Jason):
          - Add a bunch of kernel-doc
          - Simplify design for placements extension
      
      Testcase: igt/gem_create/create-ext-placement-sanity-check
      Testcase: igt/gem_create/create-ext-placement-each
      Testcase: igt/gem_create/create-ext-placement-all
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Signed-off-by: default avatarCQ Tang <cq.tang@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Reviewed-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-6-matthew.auld@intel.com
      2459e56f
    • Matthew Auld's avatar
      drm/i915/uapi: introduce drm_i915_gem_create_ext · ebcb4029
      Matthew Auld authored
      
      
      Same old gem_create but with now with extensions support. This is needed
      to support various upcoming usecases.
      
      v2:(Chris)
          - Use separate ioctl number for gem_create_ext, instead of hijacking
            the existing gem_create ioctl, otherwise we run into the issue
            with being unable to detect if the kernel supports the new extension
            behaviour.
          - We now have gem_create_ext.flags, which should be zeroed.
          - I915_GEM_CREATE_EXT_SETPARAM value is now zero, since this is the
            index into our array of extensions.
          - Setup a "vanilla" object which we can directly apply our extensions
            to.
      v3:(Daniel & Jason)
          - drop I915_GEM_CREATE_EXT_SETPARAM. Instead just have each extension
            do one thing only, instead of generic setparam which can cover
            various use cases.
          - add some kernel-doc.
      
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Signed-off-by: default avatarCQ Tang <cq.tang@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Reviewed-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-5-matthew.auld@intel.com
      ebcb4029
    • Matthew Auld's avatar
      drm/i915: rework gem_create flow for upcoming extensions · 357814f8
      Matthew Auld authored
      
      
      With the upcoming gem_create_ext we want to be able create a "vanilla"
      object upfront and pass that directly to the extensions, before actually
      initialising the object. Functionally this should be the same expect we
      now feed the object into the lower-level region specific init_object.
      
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jon Bloomfield <jon.bloomfield@intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Reviewed-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-4-matthew.auld@intel.com
      357814f8
    • Abdiel Janulgue's avatar
      drm/i915/query: Expose memory regions through the query uAPI · 71021729
      Abdiel Janulgue authored
      
      
      Returns the available memory region areas supported by the HW.
      
      v2(Daniel & Jason):
          - Add some kernel-doc, including example usage.
          - Drop all the extra rsvd
      v3(Jason & Tvrtko)
          - add back rsvd
      
      Signed-off-by: default avatarAbdiel Janulgue <abdiel.janulgue@linux.intel.com>
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jon Bloomfield <jon.bloomfield@intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Reviewed-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-3-matthew.auld@intel.com
      71021729
    • Matthew Auld's avatar
      drm/i915: mark stolen as private · 36150bba
      Matthew Auld authored
      
      
      In the next patch we want to expose the supported regions to userspace,
      which can then be fed into the gem_create_ext placement extensions. For
      now treat stolen memory as private from userspace pov.
      
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jon Bloomfield <jon.bloomfield@intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Reviewed-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-2-matthew.auld@intel.com
      36150bba
    • Matthew Auld's avatar
      drm/doc/rfc: i915 DG1 uAPI · 2bc9c04e
      Matthew Auld authored
      
      
      Add an entry for the new uAPI needed for DG1. Also add the overall
      upstream plan, including some notes for the TTM conversion.
      
      v2(Daniel):
        - include the overall upstreaming plan
        - add a note for mmap, there are differences here for TTM vs i915
        - bunch of other suggestions from Daniel
      v3:
       (Daniel)
        - add a note for set/get caching stuff
        - add some more docs for existing query and extensions stuff
        - add an actual code example for regions query
        - bunch of other stuff
       (Jason)
        - uAPI change(!):
      	- try a simpler design with the placements extension
      	- rather than have a generic setparam which can cover multiple
      	  use cases, have each extension be responsible for one thing
      	  only
      v4:
       (Daniel)
        - add some more notes for ttm conversion
        - bunch of other stuff
       (Jason)
        - uAPI change(!):
      	- drop all the extra rsvd members for the region_query and
      	  region_info, just keep the bare minimum needed for padding
      v5:
      (Jason)
        - for the upstream plan, add a requirement that we send the uAPI bits
          again for final sign off before turning it on for real
        - document how we intend to extend the rsvd bits for the region query
      (Kenneth)
        - improve the comment for the smem+lmem mmap mode and caching
      
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
      Cc: Jon Bloomfield <jon.bloomfield@intel.com>
      Cc: Jordan Justen <jordan.l.justen@intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Kenneth Graunke <kenneth@whitecape.org>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: mesa-dev@lists.freedesktop.org
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Acked-by: default avatarDave Airlie <airlied@redhat.com>
      Acked-by: default avatarKenneth Graunke <kenneth@whitecape.org>
      Acked-by: default avatarJon Bloomfield <jon.bloomfield@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429103056.407067-1-matthew.auld@intel.com
      2bc9c04e
  13. May 01, 2021
  14. Apr 30, 2021
  15. Apr 29, 2021
    • Maarten Lankhorst's avatar
      drm/i915: Use trylock in shrinker for ggtt on bsw vt-d and bxt, v2. · bc6f80cc
      Maarten Lankhorst authored
      
      
      The stop_machine() lock may allocate memory, but is called inside
      vm->mutex, which is taken in the shrinker. This will cause a lockdep
      splat, as can be seen below:
      
      <4>[  462.585762] ======================================================
      <4>[  462.585768] WARNING: possible circular locking dependency detected
      <4>[  462.585773] 5.12.0-rc5-CI-Trybot_7644+ #1 Tainted: G     U
      <4>[  462.585779] ------------------------------------------------------
      <4>[  462.585783] i915_selftest/5540 is trying to acquire lock:
      <4>[  462.585788] ffffffff826440b0 (cpu_hotplug_lock){++++}-{0:0}, at: stop_machine+0x12/0x30
      <4>[  462.585814]
                        but task is already holding lock:
      <4>[  462.585818] ffff888125369c70 (&vm->mutex/1){+.+.}-{3:3}, at: i915_vma_pin_ww+0x38e/0xb40 [i915]
      <4>[  462.586301]
                        which lock already depends on the new lock.
      
      <4>[  462.586305]
                        the existing dependency chain (in reverse order) is:
      <4>[  462.586309]
                        -> #2 (&vm->mutex/1){+.+.}-{3:3}:
      <4>[  462.586323]        i915_gem_shrinker_taints_mutex+0x2d/0x50 [i915]
      <4>[  462.586719]        i915_address_space_init+0x12d/0x130 [i915]
      <4>[  462.587092]        ppgtt_init+0x4e/0x80 [i915]
      <4>[  462.587467]        gen8_ppgtt_create+0x3e/0x5c0 [i915]
      <4>[  462.587828]        i915_ppgtt_create+0x28/0xf0 [i915]
      <4>[  462.588203]        intel_gt_init+0x123/0x370 [i915]
      <4>[  462.588572]        i915_gem_init+0x129/0x1f0 [i915]
      <4>[  462.588971]        i915_driver_probe+0x753/0xd80 [i915]
      <4>[  462.589320]        i915_pci_probe+0x43/0x1d0 [i915]
      <4>[  462.589671]        pci_device_probe+0x9e/0x110
      <4>[  462.589680]        really_probe+0xea/0x410
      <4>[  462.589690]        driver_probe_device+0xd9/0x140
      <4>[  462.589697]        device_driver_attach+0x4a/0x50
      <4>[  462.589704]        __driver_attach+0x83/0x140
      <4>[  462.589711]        bus_for_each_dev+0x75/0xc0
      <4>[  462.589718]        bus_add_driver+0x14b/0x1f0
      <4>[  462.589724]        driver_register+0x66/0xb0
      <4>[  462.589731]        i915_init+0x70/0x87 [i915]
      <4>[  462.590053]        do_one_initcall+0x56/0x2e0
      <4>[  462.590061]        do_init_module+0x55/0x200
      <4>[  462.590068]        load_module+0x2703/0x2990
      <4>[  462.590074]        __do_sys_finit_module+0xad/0x110
      <4>[  462.590080]        do_syscall_64+0x33/0x80
      <4>[  462.590089]        entry_SYSCALL_64_after_hwframe+0x44/0xae
      <4>[  462.590096]
                        -> #1 (fs_reclaim){+.+.}-{0:0}:
      <4>[  462.590109]        fs_reclaim_acquire+0x9f/0xd0
      <4>[  462.590118]        kmem_cache_alloc_trace+0x3d/0x430
      <4>[  462.590126]        intel_cpuc_prepare+0x3b/0x1b0
      <4>[  462.590133]        cpuhp_invoke_callback+0x9e/0x890
      <4>[  462.590141]        _cpu_up+0xa4/0x130
      <4>[  462.590147]        cpu_up+0x82/0x90
      <4>[  462.590153]        bringup_nonboot_cpus+0x4a/0x60
      <4>[  462.590159]        smp_init+0x21/0x5c
      <4>[  462.590167]        kernel_init_freeable+0x8a/0x1b7
      <4>[  462.590175]        kernel_init+0x5/0xff
      <4>[  462.590181]        ret_from_fork+0x22/0x30
      <4>[  462.590187]
                        -> #0 (cpu_hotplug_lock){++++}-{0:0}:
      <4>[  462.590199]        __lock_acquire+0x1520/0x2590
      <4>[  462.590207]        lock_acquire+0xd1/0x3d0
      <4>[  462.590213]        cpus_read_lock+0x39/0xc0
      <4>[  462.590219]        stop_machine+0x12/0x30
      <4>[  462.590226]        bxt_vtd_ggtt_insert_entries__BKL+0x36/0x50 [i915]
      <4>[  462.590601]        ggtt_bind_vma+0x5d/0x80 [i915]
      <4>[  462.590970]        i915_vma_bind+0xdc/0x1c0 [i915]
      <4>[  462.591374]        i915_vma_pin_ww+0x435/0xb40 [i915]
      <4>[  462.591779]        make_obj_busy+0xcb/0x330 [i915]
      <4>[  462.592170]        igt_mmap_offset_exhaustion+0x45f/0x4c0 [i915]
      <4>[  462.592562]        __i915_subtests.cold.7+0x42/0x92 [i915]
      <4>[  462.592995]        __run_selftests.part.3+0x10d/0x172 [i915]
      <4>[  462.593428]        i915_live_selftests.cold.5+0x1f/0x47 [i915]
      <4>[  462.593860]        i915_pci_probe+0x93/0x1d0 [i915]
      <4>[  462.594210]        pci_device_probe+0x9e/0x110
      <4>[  462.594217]        really_probe+0xea/0x410
      <4>[  462.594226]        driver_probe_device+0xd9/0x140
      <4>[  462.594233]        device_driver_attach+0x4a/0x50
      <4>[  462.594240]        __driver_attach+0x83/0x140
      <4>[  462.594247]        bus_for_each_dev+0x75/0xc0
      <4>[  462.594254]        bus_add_driver+0x14b/0x1f0
      <4>[  462.594260]        driver_register+0x66/0xb0
      <4>[  462.594267]        i915_init+0x70/0x87 [i915]
      <4>[  462.594586]        do_one_initcall+0x56/0x2e0
      <4>[  462.594592]        do_init_module+0x55/0x200
      <4>[  462.594599]        load_module+0x2703/0x2990
      <4>[  462.594605]        __do_sys_finit_module+0xad/0x110
      <4>[  462.594612]        do_syscall_64+0x33/0x80
      <4>[  462.594618]        entry_SYSCALL_64_after_hwframe+0x44/0xae
      <4>[  462.594625]
                        other info that might help us debug this:
      
      <4>[  462.594629] Chain exists of:
                          cpu_hotplug_lock --> fs_reclaim --> &vm->mutex/1
      
      <4>[  462.594645]  Possible unsafe locking scenario:
      
      <4>[  462.594648]        CPU0                    CPU1
      <4>[  462.594652]        ----                    ----
      <4>[  462.594655]   lock(&vm->mutex/1);
      <4>[  462.594664]                                lock(fs_reclaim);
      <4>[  462.594671]                                lock(&vm->mutex/1);
      <4>[  462.594679]   lock(cpu_hotplug_lock);
      <4>[  462.594686]
                         *** DEADLOCK ***
      
      <4>[  462.594690] 4 locks held by i915_selftest/5540:
      <4>[  462.594696]  #0: ffff888100fbc240 (&dev->mutex){....}-{3:3}, at: device_driver_attach+0x18/0x50
      <4>[  462.594715]  #1: ffffc900006cb9a0 (reservation_ww_class_acquire){+.+.}-{0:0}, at: make_obj_busy+0x81/0x330 [i915]
      <4>[  462.595118]  #2: ffff88812a6081e8 (reservation_ww_class_mutex){+.+.}-{3:3}, at: make_obj_busy+0x21f/0x330 [i915]
      <4>[  462.595519]  #3: ffff888125369c70 (&vm->mutex/1){+.+.}-{3:3}, at: i915_vma_pin_ww+0x38e/0xb40 [i915]
      <4>[  462.595934]
                        stack backtrace:
      <4>[  462.595939] CPU: 0 PID: 5540 Comm: i915_selftest Tainted: G     U            5.12.0-rc5-CI-Trybot_7644+ #1
      <4>[  462.595947] Hardware name: GOOGLE Kefka/Kefka, BIOS MrChromebox 02/04/2018
      <4>[  462.595952] Call Trace:
      <4>[  462.595961]  dump_stack+0x7f/0xad
      <4>[  462.595974]  check_noncircular+0x12e/0x150
      <4>[  462.595982]  ? save_stack.isra.17+0x3f/0x70
      <4>[  462.595991]  ? drm_mm_insert_node_in_range+0x34a/0x5b0
      <4>[  462.596000]  ? i915_vma_pin_ww+0x9ec/0xb40 [i915]
      <4>[  462.596410]  __lock_acquire+0x1520/0x2590
      <4>[  462.596419]  ? do_init_module+0x55/0x200
      <4>[  462.596429]  lock_acquire+0xd1/0x3d0
      <4>[  462.596435]  ? stop_machine+0x12/0x30
      <4>[  462.596445]  ? gen8_ggtt_insert_entries+0xf0/0xf0 [i915]
      <4>[  462.596816]  cpus_read_lock+0x39/0xc0
      <4>[  462.596824]  ? stop_machine+0x12/0x30
      <4>[  462.596831]  stop_machine+0x12/0x30
      <4>[  462.596839]  bxt_vtd_ggtt_insert_entries__BKL+0x36/0x50 [i915]
      <4>[  462.597210]  ggtt_bind_vma+0x5d/0x80 [i915]
      <4>[  462.597580]  i915_vma_bind+0xdc/0x1c0 [i915]
      <4>[  462.597986]  i915_vma_pin_ww+0x435/0xb40 [i915]
      <4>[  462.598395]  ? make_obj_busy+0xcb/0x330 [i915]
      <4>[  462.598786]  make_obj_busy+0xcb/0x330 [i915]
      <4>[  462.599180]  ? 0xffffffff81000000
      <4>[  462.599187]  ? debug_mutex_unlock+0x50/0xa0
      <4>[  462.599198]  igt_mmap_offset_exhaustion+0x45f/0x4c0 [i915]
      <4>[  462.599592]  __i915_subtests.cold.7+0x42/0x92 [i915]
      <4>[  462.600026]  ? i915_perf_selftests+0x20/0x20 [i915]
      <4>[  462.600422]  ? __i915_nop_setup+0x10/0x10 [i915]
      <4>[  462.600820]  __run_selftests.part.3+0x10d/0x172 [i915]
      <4>[  462.601253]  i915_live_selftests.cold.5+0x1f/0x47 [i915]
      <4>[  462.601686]  i915_pci_probe+0x93/0x1d0 [i915]
      <4>[  462.602037]  ? _raw_spin_unlock_irqrestore+0x3d/0x60
      <4>[  462.602047]  pci_device_probe+0x9e/0x110
      <4>[  462.602057]  really_probe+0xea/0x410
      <4>[  462.602067]  driver_probe_device+0xd9/0x140
      <4>[  462.602075]  device_driver_attach+0x4a/0x50
      <4>[  462.602084]  __driver_attach+0x83/0x140
      <4>[  462.602091]  ? device_driver_attach+0x50/0x50
      <4>[  462.602099]  ? device_driver_attach+0x50/0x50
      <4>[  462.602107]  bus_for_each_dev+0x75/0xc0
      <4>[  462.602116]  bus_add_driver+0x14b/0x1f0
      <4>[  462.602124]  driver_register+0x66/0xb0
      <4>[  462.602133]  i915_init+0x70/0x87 [i915]
      <4>[  462.602453]  ? 0xffffffffa0606000
      <4>[  462.602458]  do_one_initcall+0x56/0x2e0
      <4>[  462.602466]  ? kmem_cache_alloc_trace+0x374/0x430
      <4>[  462.602476]  do_init_module+0x55/0x200
      <4>[  462.602484]  load_module+0x2703/0x2990
      <4>[  462.602500]  ? __do_sys_finit_module+0xad/0x110
      <4>[  462.602507]  __do_sys_finit_module+0xad/0x110
      <4>[  462.602519]  do_syscall_64+0x33/0x80
      <4>[  462.602527]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      <4>[  462.602535] RIP: 0033:0x7fab69d8d89d
      
      Changes since v1:
      - Add lockdep annotations during init, to ensure that lockdep is primed.
        This also fixes a false positive when reading /proc/lockdep_stats
        during module reload.
      
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210426102351.921874-1-maarten.lankhorst@linux.intel.com
      
      
      Reviewed-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
      bc6f80cc
    • Thomas Zimmermann's avatar
      drm/i915/gem: Remove reference to struct drm_device.pdev · ff2d0ba2
      Thomas Zimmermann authored
      
      
      References to struct drm_device.pdev should not be used any longer as
      the field will be moved into the struct's legacy section. Add a fix
      for the rsp commit.
      
      v2:
      	* fix an error in the commit description (Michael)
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Fixes: d57d4a1d
      
       ("drm/i915: Create stolen memory region from local memory")
      Cc: CQ Tang <cq.tang@intel.com>
      Cc: Matthew Auld <matthew.auld@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Cc: Xinyun Liu <xinyun.liu@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: "Thomas Hellström" <thomas.hellstrom@intel.com>
      Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: intel-gfx@lists.freedesktop.org
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210427174857.7862-1-tzimmermann@suse.de
      ff2d0ba2
    • Stéphane Marchesin's avatar
      drm/i915: Fix crash in auto_retire · ca419f40
      Stéphane Marchesin authored
      
      
      The retire logic uses the 2 lower bits of the pointer to the retire
      function to store flags. However, the auto_retire function is not
      guaranteed to be aligned to a multiple of 4, which causes crashes as
      we jump to the wrong address, for example like this:
      
      2021-04-24T18:03:53.804300Z WARNING kernel: [  516.876901] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
      2021-04-24T18:03:53.804310Z WARNING kernel: [  516.876906] CPU: 7 PID: 146 Comm: kworker/u16:6 Tainted: G     U            5.4.105-13595-g3cd84167b2df #1
      2021-04-24T18:03:53.804311Z WARNING kernel: [  516.876907] Hardware name: Google Volteer2/Volteer2, BIOS Google_Volteer2.13672.76.0 02/22/2021
      2021-04-24T18:03:53.804312Z WARNING kernel: [  516.876911] Workqueue: events_unbound active_work
      2021-04-24T18:03:53.804313Z WARNING kernel: [  516.876914] RIP: 0010:auto_retire+0x1/0x20
      2021-04-24T18:03:53.804314Z WARNING kernel: [  516.876916] Code: e8 01 f2 ff ff eb 02 31 db 48 89 d8 5b 5d c3 0f 1f 44 00 00 55 48 89 e5 f0 ff 87 c8 00 00 00 0f 88 ab 47 4a 00 31 c0 5d c3 0f <1f> 44 00 00 55 48 89 e5 f0 ff 8f c8 00 00 00 0f 88 9a 47 4a 00 74
      2021-04-24T18:03:53.804319Z WARNING kernel: [  516.876918] RSP: 0018:ffff9b4d809fbe38 EFLAGS: 00010286
      2021-04-24T18:03:53.804320Z WARNING kernel: [  516.876919] RAX: 0000000000000007 RBX: ffff927915079600 RCX: 0000000000000007
      2021-04-24T18:03:53.804320Z WARNING kernel: [  516.876921] RDX: ffff9b4d809fbe40 RSI: 0000000000000286 RDI: ffff927915079600
      2021-04-24T18:03:53.804321Z WARNING kernel: [  516.876922] RBP: ffff9b4d809fbe68 R08: 8080808080808080 R09: fefefefefefefeff
      2021-04-24T18:03:53.804321Z WARNING kernel: [  516.876924] R10: 0000000000000010 R11: ffffffff92e44bd8 R12: ffff9279150796a0
      2021-04-24T18:03:53.804322Z WARNING kernel: [  516.876925] R13: ffff92791c368180 R14: ffff927915079640 R15: 000000001c867605
      2021-04-24T18:03:53.804323Z WARNING kernel: [  516.876926] FS:  0000000000000000(0000) GS:ffff92791ffc0000(0000) knlGS:0000000000000000
      2021-04-24T18:03:53.804323Z WARNING kernel: [  516.876928] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      2021-04-24T18:03:53.804324Z WARNING kernel: [  516.876929] CR2: 0000239514955000 CR3: 00000007f82da001 CR4: 0000000000760ee0
      2021-04-24T18:03:53.804325Z WARNING kernel: [  516.876930] PKRU: 55555554
      2021-04-24T18:03:53.804325Z WARNING kernel: [  516.876931] Call Trace:
      2021-04-24T18:03:53.804326Z WARNING kernel: [  516.876935]  __active_retire+0x77/0xcf
      2021-04-24T18:03:53.804326Z WARNING kernel: [  516.876939]  process_one_work+0x1da/0x394
      2021-04-24T18:03:53.804327Z WARNING kernel: [  516.876941]  worker_thread+0x216/0x375
      2021-04-24T18:03:53.804327Z WARNING kernel: [  516.876944]  kthread+0x147/0x156
      2021-04-24T18:03:53.804335Z WARNING kernel: [  516.876946]  ? pr_cont_work+0x58/0x58
      2021-04-24T18:03:53.804335Z WARNING kernel: [  516.876948]  ? kthread_blkcg+0x2e/0x2e
      2021-04-24T18:03:53.804336Z WARNING kernel: [  516.876950]  ret_from_fork+0x1f/0x40
      2021-04-24T18:03:53.804336Z WARNING kernel: [  516.876952] Modules linked in: cdc_mbim cdc_ncm cdc_wdm xt_cgroup rfcomm cmac algif_hash algif_skcipher af_alg xt_MASQUERADE uinput snd_soc_rt5682_sdw snd_soc_rt5682 snd_soc_max98373_sdw snd_soc_max98373 snd_soc_rl6231 regmap_sdw snd_soc_sof_sdw snd_soc_hdac_hdmi snd_soc_dmic snd_hda_codec_hdmi snd_sof_pci snd_sof_intel_hda_common intel_ipu6_psys snd_sof_xtensa_dsp soundwire_intel soundwire_generic_allocation soundwire_cadence snd_sof_intel_hda snd_sof snd_soc_hdac_hda snd_soc_acpi_intel_match snd_soc_acpi snd_hda_ext_core soundwire_bus snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hwdep snd_hda_core intel_ipu6_isys videobuf2_dma_contig videobuf2_v4l2 videobuf2_common videobuf2_memops mei_hdcp intel_ipu6 ov2740 ov8856 at24 sx9310 dw9768 v4l2_fwnode cros_ec_typec intel_pmc_mux roles acpi_als typec fuse iio_trig_sysfs cros_ec_light_prox cros_ec_lid_angle cros_ec_sensors cros_ec_sensors_core industrialio_triggered_buffer cros_ec_sensors_ring kfifo_buf industrialio cros_ec_sensorhub
      2021-04-24T18:03:53.804337Z WARNING kernel: [  516.876972]  cdc_ether usbnet iwlmvm lzo_rle lzo_compress iwl7000_mac80211 iwlwifi zram cfg80211 r8152 mii btusb btrtl btintel btbcm bluetooth ecdh_generic ecc joydev
      2021-04-24T18:03:53.804337Z EMERG kernel: [  516.879169] gsmi: Log Shutdown Reason 0x03
      
      This change fixes this by aligning the function.
      
      Signed-off-by: default avatarStéphane Marchesin <marcheu@chromium.org>
      Fixes: 229007e0
      
       ("drm/i915: Wrap i915_active in a simple kreffed struct")
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210429031021.1218091-1-marcheu@chromium.org
      ca419f40
  16. Apr 27, 2021