1. 16 3月, 2017 12 次提交
    • M
      drm/i915: Extend vlv/chv residency resolution · 47c21d9a
      Mika Kuoppala 提交于
      Vlv and chv residency counters are 40 bits in width.
      With a control bit, we can choose between upper or lower
      32 bit window into this counter.
      
      Lets toggle this bit on and off on and read both parts.
      As a result we can push the wrap from 13 seconds to 54
      minutes.
      
      v2: commit msg, loop readability, goto elimination (Chris)
      v3: bug ref, divide outside runtime pm lock (Chris)
      
      References: https://bugs.freedesktop.org/show_bug.cgi?id=94852Reported-by: NLen Brown <len.brown@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      47c21d9a
    • M
      drm/i915: Return residency as microseconds · c5a0ad11
      Mika Kuoppala 提交于
      Change the granularity from milliseconds to microseconds
      when returning rc6 residencies. This is in preparation
      for increased resolution on some platforms.
      
      v2: use 64bit div macro (Chris)
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      c5a0ad11
    • M
      drm/i915: Move residency calculation into intel_pm.c · 135bafa5
      Mika Kuoppala 提交于
      Plan is to make generic residency calculation utility
      function for usage outside of sysfs. As a first step
      move residency calculation into intel_pm.c
      Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      135bafa5
    • C
      drm/i915/userptr: Reinvent GGTT self-faulting protection · 15c344f4
      Chris Wilson 提交于
      lockdep doesn't like us taking the mm->mmap_sem inside the get_pages
      callback for a couple of reasons. The straightforward deadlock:
      
      [13755.434059] =============================================
      [13755.434061] [ INFO: possible recursive locking detected ]
      [13755.434064] 4.11.0-rc1-CI-CI_DRM_297+ #1 Tainted: G     U
      [13755.434066] ---------------------------------------------
      [13755.434068] gem_userptr_bli/8398 is trying to acquire lock:
      [13755.434070]  (&mm->mmap_sem){++++++}, at: [<ffffffffa00c988a>] i915_gem_userptr_get_pages+0x5a/0x2e0 [i915]
      [13755.434096]
                     but task is already holding lock:
      [13755.434098]  (&mm->mmap_sem){++++++}, at: [<ffffffff8104d485>] __do_page_fault+0x105/0x560
      [13755.434105]
                     other info that might help us debug this:
      [13755.434108]  Possible unsafe locking scenario:
      
      [13755.434110]        CPU0
      [13755.434111]        ----
      [13755.434112]   lock(&mm->mmap_sem);
      [13755.434115]   lock(&mm->mmap_sem);
      [13755.434117]
                      *** DEADLOCK ***
      
      [13755.434121]  May be due to missing lock nesting notation
      
      [13755.434126] 2 locks held by gem_userptr_bli/8398:
      [13755.434128]  #0:  (&mm->mmap_sem){++++++}, at: [<ffffffff8104d485>] __do_page_fault+0x105/0x560
      [13755.434135]  #1:  (&obj->mm.lock){+.+.+.}, at: [<ffffffffa00b887d>] __i915_gem_object_get_pages+0x1d/0x70 [i915]
      [13755.434156]
                     stack backtrace:
      [13755.434161] CPU: 3 PID: 8398 Comm: gem_userptr_bli Tainted: G     U          4.11.0-rc1-CI-CI_DRM_297+ #1
      [13755.434165] Hardware name: GIGABYTE GB-BKi7(H)A-7500/MFLP7AP-00, BIOS F4 02/20/2017
      [13755.434169] Call Trace:
      [13755.434174]  dump_stack+0x67/0x92
      [13755.434178]  __lock_acquire+0x133a/0x1b50
      [13755.434182]  lock_acquire+0xc9/0x220
      [13755.434200]  ? i915_gem_userptr_get_pages+0x5a/0x2e0 [i915]
      [13755.434204]  down_read+0x42/0x70
      [13755.434221]  ? i915_gem_userptr_get_pages+0x5a/0x2e0 [i915]
      [13755.434238]  i915_gem_userptr_get_pages+0x5a/0x2e0 [i915]
      [13755.434255]  ____i915_gem_object_get_pages+0x25/0x60 [i915]
      [13755.434272]  __i915_gem_object_get_pages+0x59/0x70 [i915]
      [13755.434288]  i915_gem_fault+0x397/0x6a0 [i915]
      [13755.434304]  ? i915_gem_fault+0x1a1/0x6a0 [i915]
      [13755.434308]  ? __lock_acquire+0x449/0x1b50
      [13755.434311]  ? __lock_acquire+0x449/0x1b50
      [13755.434315]  ? vm_mmap_pgoff+0xa9/0xd0
      [13755.434318]  __do_fault+0x19/0x70
      [13755.434321]  __handle_mm_fault+0x863/0xe50
      [13755.434325]  handle_mm_fault+0x17f/0x370
      [13755.434329]  ? handle_mm_fault+0x40/0x370
      [13755.434332]  __do_page_fault+0x279/0x560
      [13755.434336]  do_page_fault+0xc/0x10
      [13755.434339]  page_fault+0x22/0x30
      [13755.434342] RIP: 0033:0x7f5ab91b5880
      [13755.434345] RSP: 002b:00007fff62922218 EFLAGS: 00010216
      [13755.434348] RAX: 0000000000b74500 RBX: 00007f5ab7f81000 RCX: 0000000000000000
      [13755.434352] RDX: 0000000000100000 RSI: 00007f5ab7f81000 RDI: 00007f5aba61c000
      [13755.434355] RBP: 00007f5aba61c000 R08: 0000000000000007 R09: 0000000100000000
      [13755.434359] R10: 000000000000037d R11: 00007f5ab91b5840 R12: 0000000000000001
      [13755.434362] R13: 0000000000000005 R14: 0000000000000001 R15: 0000000000000000
      
      and cyclic deadlocks:
      
      [ 2566.458979] ======================================================
      [ 2566.459054] [ INFO: possible circular locking dependency detected ]
      [ 2566.459127] 4.11.0-rc1+ #26 Not tainted
      [ 2566.459194] -------------------------------------------------------
      [ 2566.459266] gem_streaming_w/759 is trying to acquire lock:
      [ 2566.459334]  (&obj->mm.lock){+.+.+.}, at: [<ffffffffa034bc80>] i915_gem_object_pin_pages+0x0/0xc0 [i915]
      [ 2566.459605]
      [ 2566.459605] but task is already holding lock:
      [ 2566.459699]  (&mm->mmap_sem){++++++}, at: [<ffffffff8106fd11>] __do_page_fault+0x121/0x500
      [ 2566.459814]
      [ 2566.459814] which lock already depends on the new lock.
      [ 2566.459814]
      [ 2566.459934]
      [ 2566.459934] the existing dependency chain (in reverse order) is:
      [ 2566.460030]
      [ 2566.460030] -> #1 (&mm->mmap_sem){++++++}:
      [ 2566.460139]        lock_acquire+0xfe/0x220
      [ 2566.460214]        down_read+0x4e/0x90
      [ 2566.460444]        i915_gem_userptr_get_pages+0x6e/0x340 [i915]
      [ 2566.460669]        ____i915_gem_object_get_pages+0x8b/0xd0 [i915]
      [ 2566.460900]        __i915_gem_object_get_pages+0x6a/0x80 [i915]
      [ 2566.461132]        __i915_vma_do_pin+0x7fa/0x930 [i915]
      [ 2566.461352]        eb_add_vma+0x67b/0x830 [i915]
      [ 2566.461572]        eb_lookup_vmas+0xafe/0x1010 [i915]
      [ 2566.461792]        i915_gem_do_execbuffer+0x715/0x2870 [i915]
      [ 2566.462012]        i915_gem_execbuffer2+0x106/0x2b0 [i915]
      [ 2566.462152]        drm_ioctl+0x36c/0x670 [drm]
      [ 2566.462236]        do_vfs_ioctl+0x12c/0xa60
      [ 2566.462317]        SyS_ioctl+0x41/0x70
      [ 2566.462399]        entry_SYSCALL_64_fastpath+0x1c/0xb1
      [ 2566.462477]
      [ 2566.462477] -> #0 (&obj->mm.lock){+.+.+.}:
      [ 2566.462587]        __lock_acquire+0x1602/0x1790
      [ 2566.462661]        lock_acquire+0xfe/0x220
      [ 2566.462893]        i915_gem_object_pin_pages+0x4c/0xc0 [i915]
      [ 2566.463116]        i915_gem_fault+0x2c2/0x8c0 [i915]
      [ 2566.463197]        __do_fault+0x42/0x130
      [ 2566.463276]        __handle_mm_fault+0x92c/0x1280
      [ 2566.463356]        handle_mm_fault+0x1e2/0x440
      [ 2566.463443]        __do_page_fault+0x1c4/0x500
      [ 2566.463529]        do_page_fault+0xc/0x10
      [ 2566.463613]        page_fault+0x1f/0x30
      [ 2566.463693]
      [ 2566.463693] other info that might help us debug this:
      [ 2566.463693]
      [ 2566.463820]  Possible unsafe locking scenario:
      [ 2566.463820]
      [ 2566.463918]        CPU0                    CPU1
      [ 2566.463988]        ----                    ----
      [ 2566.464068]   lock(&mm->mmap_sem);
      [ 2566.464143]                                lock(&obj->mm.lock);
      [ 2566.464226]                                lock(&mm->mmap_sem);
      [ 2566.464304]   lock(&obj->mm.lock);
      [ 2566.464378]
      [ 2566.464378]  *** DEADLOCK ***
      [ 2566.464378]
      [ 2566.464504] 1 lock held by gem_streaming_w/759:
      [ 2566.464576]  #0:  (&mm->mmap_sem){++++++}, at: [<ffffffff8106fd11>] __do_page_fault+0x121/0x500
      [ 2566.464699]
      [ 2566.464699] stack backtrace:
      [ 2566.464801] CPU: 0 PID: 759 Comm: gem_streaming_w Not tainted 4.11.0-rc1+ #26
      [ 2566.464881] Hardware name: GIGABYTE GB-BXBT-1900/MZBAYAB-00, BIOS F8 03/02/2016
      [ 2566.464983] Call Trace:
      [ 2566.465061]  dump_stack+0x68/0x9f
      [ 2566.465144]  print_circular_bug+0x20b/0x260
      [ 2566.465234]  __lock_acquire+0x1602/0x1790
      [ 2566.465323]  ? debug_check_no_locks_freed+0x1a0/0x1a0
      [ 2566.465564]  ? i915_gem_object_wait+0x238/0x650 [i915]
      [ 2566.465657]  ? debug_lockdep_rcu_enabled.part.4+0x1a/0x30
      [ 2566.465749]  lock_acquire+0xfe/0x220
      [ 2566.465985]  ? i915_sg_trim+0x1b0/0x1b0 [i915]
      [ 2566.466223]  i915_gem_object_pin_pages+0x4c/0xc0 [i915]
      [ 2566.466461]  ? i915_sg_trim+0x1b0/0x1b0 [i915]
      [ 2566.466699]  i915_gem_fault+0x2c2/0x8c0 [i915]
      [ 2566.466939]  ? i915_gem_pwrite_ioctl+0xce0/0xce0 [i915]
      [ 2566.467030]  ? __lock_acquire+0x642/0x1790
      [ 2566.467122]  ? __lock_acquire+0x642/0x1790
      [ 2566.467209]  ? debug_lockdep_rcu_enabled+0x35/0x40
      [ 2566.467299]  ? get_unmapped_area+0x1b4/0x1d0
      [ 2566.467387]  __do_fault+0x42/0x130
      [ 2566.467474]  __handle_mm_fault+0x92c/0x1280
      [ 2566.467564]  ? __pmd_alloc+0x1e0/0x1e0
      [ 2566.467651]  ? vm_mmap_pgoff+0x160/0x190
      [ 2566.467740]  ? handle_mm_fault+0x111/0x440
      [ 2566.467827]  handle_mm_fault+0x1e2/0x440
      [ 2566.467914]  ? handle_mm_fault+0x5d/0x440
      [ 2566.468002]  __do_page_fault+0x1c4/0x500
      [ 2566.468090]  do_page_fault+0xc/0x10
      [ 2566.468180]  page_fault+0x1f/0x30
      [ 2566.468263] RIP: 0033:0x557895ced32a
      [ 2566.468337] RSP: 002b:00007fffd6dd8a10 EFLAGS: 00010202
      [ 2566.468419] RAX: 00007f659a4db000 RBX: 0000000000000003 RCX: 00007f659ad032da
      [ 2566.468501] RDX: 0000000000000000 RSI: 0000000000100000 RDI: 0000000000000000
      [ 2566.468586] RBP: 0000000000000007 R08: 0000000000000003 R09: 0000000100000000
      [ 2566.468667] R10: 0000000000000001 R11: 0000000000000246 R12: 0000557895ceda60
      [ 2566.468749] R13: 0000000000000001 R14: 00007fffd6dd8ac0 R15: 00007f659a4db000
      
      By checking the status of the gup worker (serialized by the
      obj->mm.lock) we can determine whether it is still active, has failed or
      has succeeded. If the worker is still active (or failed), we know that
      it cannot be bound and so we can skip taking struct_mutex (risking
      potential recursion). As we check the worker status, we mark it to
      discard any partial results, forcing us to restart on the next
      get_pages.
      Reported-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Fixes: 1c8782dd ("drm/i915/userptr: Disallow wrapping GTT into a userptr")
      Testcase: igt/gem_userptr_blits/map-fixed-invalidate-gup
      Testcase: igt/gem_userptr_blits/dmabuf-sync
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Michał Winiarski <michal.winiarski@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315140150.19432-1-chris@chris-wilson.co.ukReviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      15c344f4
    • M
      drm/i915: Make intel_uc_sanitize_options() more robust · d4a70a10
      Michal Wajdeczko 提交于
      After negative guc fw selection we could leave guc
      submission flag still turned on. Reorder some checks
      to cover this case. While here, fix info message and
      return early if there is no Guc.
      Signed-off-by: NMichal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: NArkadiusz Hiler <arkadiusz.hiler@intel.com>
      [tursulin: fixup bad alignment]
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315133741.150420-1-michal.wajdeczko@intel.com
      d4a70a10
    • A
      drm/i915/uc: Rename intel_uc_fw.fw to .type · 6833b82e
      Arkadiusz Hiler 提交于
      This field is used to determine which kind of firmware the struct
      describes (GuC/HuC) - the name does not reflect.
      
      The enum used here have "type" in the name, so let's go with that.
      
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Oscar Mateo <oscar.mateo@intel.com>
      Signed-off-by: NArkadiusz Hiler <arkadiusz.hiler@intel.com>
      Reviewed-by: NMichal Wajdeczko <michal.wajdeczko@intel.com>
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315133415.15343-1-arkadiusz.hiler@intel.com
      6833b82e
    • C
      drm/i915/breadcrumbs: Tweak commentary · a6b0a141
      Chris Wilson 提交于
      Tvrtko spotted a stale reference to b->lock (now b->rb_lock) so review
      the comments and try to improve them in passing.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315222259.1469-1-chris@chris-wilson.co.ukReviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      a6b0a141
    • C
      drm/i915: Only attempt to signal the request once from the interrupt handler · db93991b
      Chris Wilson 提交于
      Check that request has not been signaled before acquiring a reference to
      the request for signaling later in the interrupt handler.
      
      The loading of the cacheline (for request->fence.flags) should be "free"
      when followed by the locked increment of the request->fence.refcount
      (which then sets the cacheline to exclusive mode), i.e. the cost of
      test_bit prior to an atomic_inc should be negligible. This should
      benefit us when we have a pile of bare breadcrumbs (interrupted execbuf)
      where we may get interrupts faster than we can get rid of the
      intel_wait, or if the device is too slow to run the bottom-half between
      interrupts.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315210726.12095-5-chris@chris-wilson.co.uk
      db93991b
    • C
      drm/i915/breadcrumbs: Assert that we do not shortcut the current bottom-half · 908a6cbf
      Chris Wilson 提交于
      We need to ensure that we always serialize updates to the bottom-half
      using the breadcrumbs.irq_lock so that we don't race with a concurrent
      interrupt handler. This is most important just prior to leaving the
      waiter (when the intel_wait will be overwritten), so make sure we are
      not the current bottom-half when skipping the irq locks.
      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: http://patchwork.freedesktop.org/patch/msgid/20170315210726.12095-4-chris@chris-wilson.co.uk
      908a6cbf
    • C
      drm/i915/breadcrumbs: Disable interrupt bottom-half first on idling · a5cae7b8
      Chris Wilson 提交于
      Before walking the rbtree of waiters (marking them as complete and waking
      them), decouple the interrupt handler. This prevents a race between the
      missed waiter waking up and removing its intel_wait (which skips
      checking the lock) and the interrupt handler dereferencing the
      intel_wait. (Though we do not expect to encounter waiters during idle!)
      
      Fixes: e1c0c91b ("drm/i915: Wake up all waiters before idling")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315210726.12095-3-chris@chris-wilson.co.uk
      a5cae7b8
    • C
      drm/i915/breadcrumbs: Update bottom-half before marking as complete · 429732e8
      Chris Wilson 提交于
      When adding a new request to the breadcrumb rbtree, we mark all those
      requests inside the rbtree that are already completed as complete. This
      wakes those waiters up and allows them to skip the spinlock before
      returning to userspace. If one of those is the current bottom-half and
      allocated its intel_wait on the stack, it may then overwrite the
      b->irq_wait upon exiting i915_wait_request() just as the interrupt handler
      dereferences it.
      
      Fixes: 56299fb7 ("drm/i915: Signal first fence from irq handler if complete")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315210726.12095-2-chris@chris-wilson.co.uk
      429732e8
    • C
      drm/i915/breadcrumbs: Use booleans for intel_breadcrumbs_busy() · 4bd66391
      Chris Wilson 提交于
      Since commit 9b6586ae ("drm/i915: Keep a global seqno per-engine")
      converted intel_breadcrumbs_busy() to reporting a single boolean, we
      need only compute a boolean internally (and not needlessly compute the
      flag).
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315210726.12095-1-chris@chris-wilson.co.uk
      4bd66391
  2. 15 3月, 2017 12 次提交
  3. 14 3月, 2017 12 次提交
    • C
      drm/i915: Avoid rcu_barrier() from reclaim paths (shrinker) · bd784b7c
      Chris Wilson 提交于
      The rcu_barrier() takes the cpu_hotplug mutex which itself is not
      reclaim-safe, and so rcu_barrier() is illegal from inside the shrinker.
      
      [  309.661373] =========================================================
      [  309.661376] [ INFO: possible irq lock inversion dependency detected ]
      [  309.661380] 4.11.0-rc1-CI-CI_DRM_2333+ #1 Tainted: G        W
      [  309.661383] ---------------------------------------------------------
      [  309.661386] gem_exec_gttfil/6435 just changed the state of lock:
      [  309.661389]  (rcu_preempt_state.barrier_mutex){+.+.-.}, at: [<ffffffff81100731>] _rcu_barrier+0x31/0x160
      [  309.661399] but this lock took another, RECLAIM_FS-unsafe lock in the past:
      [  309.661402]  (cpu_hotplug.lock){+.+.+.}
      [  309.661404]
      
                     and interrupts could create inverse lock ordering between them.
      
      [  309.661410]
                     other info that might help us debug this:
      [  309.661414]  Possible interrupt unsafe locking scenario:
      
      [  309.661417]        CPU0                    CPU1
      [  309.661419]        ----                    ----
      [  309.661421]   lock(cpu_hotplug.lock);
      [  309.661425]                                local_irq_disable();
      [  309.661432]                                lock(rcu_preempt_state.barrier_mutex);
      [  309.661441]                                lock(cpu_hotplug.lock);
      [  309.661446]   <Interrupt>
      [  309.661448]     lock(rcu_preempt_state.barrier_mutex);
      [  309.661453]
                      *** DEADLOCK ***
      
      [  309.661460] 4 locks held by gem_exec_gttfil/6435:
      [  309.661464]  #0:  (sb_writers#10){.+.+.+}, at: [<ffffffff8120d83d>] vfs_write+0x17d/0x1f0
      [  309.661475]  #1:  (debugfs_srcu){......}, at: [<ffffffff81320491>] debugfs_use_file_start+0x41/0xa0
      [  309.661486]  #2:  (&attr->mutex){+.+.+.}, at: [<ffffffff8123a3e7>] simple_attr_write+0x37/0xe0
      [  309.661495]  #3:  (&dev->struct_mutex){+.+.+.}, at: [<ffffffffa0091b4a>] i915_drop_caches_set+0x3a/0x150 [i915]
      [  309.661540]
                     the shortest dependencies between 2nd lock and 1st lock:
      [  309.661547]  -> (cpu_hotplug.lock){+.+.+.} ops: 829 {
      [  309.661553]     HARDIRQ-ON-W at:
      [  309.661560]                       __lock_acquire+0x5e5/0x1b50
      [  309.661565]                       lock_acquire+0xc9/0x220
      [  309.661572]                       __mutex_lock+0x6e/0x990
      [  309.661576]                       mutex_lock_nested+0x16/0x20
      [  309.661583]                       get_online_cpus+0x61/0x80
      [  309.661590]                       kmem_cache_create+0x25/0x1d0
      [  309.661596]                       debug_objects_mem_init+0x30/0x249
      [  309.661602]                       start_kernel+0x341/0x3fe
      [  309.661607]                       x86_64_start_reservations+0x2a/0x2c
      [  309.661612]                       x86_64_start_kernel+0x173/0x186
      [  309.661619]                       verify_cpu+0x0/0xfc
      [  309.661622]     SOFTIRQ-ON-W at:
      [  309.661627]                       __lock_acquire+0x611/0x1b50
      [  309.661632]                       lock_acquire+0xc9/0x220
      [  309.661636]                       __mutex_lock+0x6e/0x990
      [  309.661641]                       mutex_lock_nested+0x16/0x20
      [  309.661646]                       get_online_cpus+0x61/0x80
      [  309.661650]                       kmem_cache_create+0x25/0x1d0
      [  309.661655]                       debug_objects_mem_init+0x30/0x249
      [  309.661660]                       start_kernel+0x341/0x3fe
      [  309.661664]                       x86_64_start_reservations+0x2a/0x2c
      [  309.661669]                       x86_64_start_kernel+0x173/0x186
      [  309.661674]                       verify_cpu+0x0/0xfc
      [  309.661677]     RECLAIM_FS-ON-W at:
      [  309.661682]                          mark_held_locks+0x6f/0xa0
      [  309.661687]                          lockdep_trace_alloc+0xb3/0x100
      [  309.661693]                          kmem_cache_alloc_trace+0x31/0x2e0
      [  309.661699]                          __smpboot_create_thread.part.1+0x27/0xe0
      [  309.661704]                          smpboot_create_threads+0x61/0x90
      [  309.661709]                          cpuhp_invoke_callback+0x9c/0x8a0
      [  309.661713]                          cpuhp_up_callbacks+0x31/0xb0
      [  309.661718]                          _cpu_up+0x7a/0xc0
      [  309.661723]                          do_cpu_up+0x5f/0x80
      [  309.661727]                          cpu_up+0xe/0x10
      [  309.661734]                          smp_init+0x71/0xb3
      [  309.661738]                          kernel_init_freeable+0x94/0x19e
      [  309.661743]                          kernel_init+0x9/0xf0
      [  309.661748]                          ret_from_fork+0x2e/0x40
      [  309.661752]     INITIAL USE at:
      [  309.661757]                      __lock_acquire+0x234/0x1b50
      [  309.661761]                      lock_acquire+0xc9/0x220
      [  309.661766]                      __mutex_lock+0x6e/0x990
      [  309.661771]                      mutex_lock_nested+0x16/0x20
      [  309.661775]                      get_online_cpus+0x61/0x80
      [  309.661780]                      __cpuhp_setup_state+0x44/0x170
      [  309.661785]                      page_alloc_init+0x23/0x3a
      [  309.661790]                      start_kernel+0x124/0x3fe
      [  309.661794]                      x86_64_start_reservations+0x2a/0x2c
      [  309.661799]                      x86_64_start_kernel+0x173/0x186
      [  309.661804]                      verify_cpu+0x0/0xfc
      [  309.661807]   }
      [  309.661813]   ... key      at: [<ffffffff81e37690>] cpu_hotplug+0xb0/0x100
      [  309.661817]   ... acquired at:
      [  309.661821]    lock_acquire+0xc9/0x220
      [  309.661825]    __mutex_lock+0x6e/0x990
      [  309.661829]    mutex_lock_nested+0x16/0x20
      [  309.661833]    get_online_cpus+0x61/0x80
      [  309.661837]    _rcu_barrier+0x9f/0x160
      [  309.661841]    rcu_barrier+0x10/0x20
      [  309.661847]    netdev_run_todo+0x5f/0x310
      [  309.661852]    rtnl_unlock+0x9/0x10
      [  309.661856]    default_device_exit_batch+0x133/0x150
      [  309.661862]    ops_exit_list.isra.0+0x4d/0x60
      [  309.661866]    cleanup_net+0x1d8/0x2c0
      [  309.661872]    process_one_work+0x1f4/0x6d0
      [  309.661876]    worker_thread+0x49/0x4a0
      [  309.661881]    kthread+0x107/0x140
      [  309.661884]    ret_from_fork+0x2e/0x40
      
      [  309.661890] -> (rcu_preempt_state.barrier_mutex){+.+.-.} ops: 179 {
      [  309.661896]    HARDIRQ-ON-W at:
      [  309.661901]                     __lock_acquire+0x5e5/0x1b50
      [  309.661905]                     lock_acquire+0xc9/0x220
      [  309.661910]                     __mutex_lock+0x6e/0x990
      [  309.661914]                     mutex_lock_nested+0x16/0x20
      [  309.661919]                     _rcu_barrier+0x31/0x160
      [  309.661923]                     rcu_barrier+0x10/0x20
      [  309.661928]                     netdev_run_todo+0x5f/0x310
      [  309.661932]                     rtnl_unlock+0x9/0x10
      [  309.661936]                     default_device_exit_batch+0x133/0x150
      [  309.661941]                     ops_exit_list.isra.0+0x4d/0x60
      [  309.661946]                     cleanup_net+0x1d8/0x2c0
      [  309.661951]                     process_one_work+0x1f4/0x6d0
      [  309.661955]                     worker_thread+0x49/0x4a0
      [  309.661960]                     kthread+0x107/0x140
      [  309.661964]                     ret_from_fork+0x2e/0x40
      [  309.661968]    SOFTIRQ-ON-W at:
      [  309.661972]                     __lock_acquire+0x611/0x1b50
      [  309.661977]                     lock_acquire+0xc9/0x220
      [  309.661981]                     __mutex_lock+0x6e/0x990
      [  309.661986]                     mutex_lock_nested+0x16/0x20
      [  309.661990]                     _rcu_barrier+0x31/0x160
      [  309.661995]                     rcu_barrier+0x10/0x20
      [  309.661999]                     netdev_run_todo+0x5f/0x310
      [  309.662003]                     rtnl_unlock+0x9/0x10
      [  309.662008]                     default_device_exit_batch+0x133/0x150
      [  309.662013]                     ops_exit_list.isra.0+0x4d/0x60
      [  309.662017]                     cleanup_net+0x1d8/0x2c0
      [  309.662022]                     process_one_work+0x1f4/0x6d0
      [  309.662027]                     worker_thread+0x49/0x4a0
      [  309.662031]                     kthread+0x107/0x140
      [  309.662035]                     ret_from_fork+0x2e/0x40
      [  309.662039]    IN-RECLAIM_FS-W at:
      [  309.662043]                        __lock_acquire+0x638/0x1b50
      [  309.662048]                        lock_acquire+0xc9/0x220
      [  309.662053]                        __mutex_lock+0x6e/0x990
      [  309.662058]                        mutex_lock_nested+0x16/0x20
      [  309.662062]                        _rcu_barrier+0x31/0x160
      [  309.662067]                        rcu_barrier+0x10/0x20
      [  309.662089]                        i915_gem_shrink_all+0x33/0x40 [i915]
      [  309.662109]                        i915_drop_caches_set+0x141/0x150 [i915]
      [  309.662114]                        simple_attr_write+0xc7/0xe0
      [  309.662119]                        full_proxy_write+0x4f/0x70
      [  309.662124]                        __vfs_write+0x23/0x120
      [  309.662128]                        vfs_write+0xc6/0x1f0
      [  309.662133]                        SyS_write+0x44/0xb0
      [  309.662138]                        entry_SYSCALL_64_fastpath+0x1c/0xb1
      [  309.662142]    INITIAL USE at:
      [  309.662147]                    __lock_acquire+0x234/0x1b50
      [  309.662151]                    lock_acquire+0xc9/0x220
      [  309.662156]                    __mutex_lock+0x6e/0x990
      [  309.662160]                    mutex_lock_nested+0x16/0x20
      [  309.662165]                    _rcu_barrier+0x31/0x160
      [  309.662169]                    rcu_barrier+0x10/0x20
      [  309.662174]                    netdev_run_todo+0x5f/0x310
      [  309.662178]                    rtnl_unlock+0x9/0x10
      [  309.662183]                    default_device_exit_batch+0x133/0x150
      [  309.662188]                    ops_exit_list.isra.0+0x4d/0x60
      [  309.662192]                    cleanup_net+0x1d8/0x2c0
      [  309.662197]                    process_one_work+0x1f4/0x6d0
      [  309.662202]                    worker_thread+0x49/0x4a0
      [  309.662206]                    kthread+0x107/0x140
      [  309.662210]                    ret_from_fork+0x2e/0x40
      [  309.662214]  }
      [  309.662220]  ... key      at: [<ffffffff81e4e1c8>] rcu_preempt_state+0x508/0x780
      [  309.662225]  ... acquired at:
      [  309.662229]    check_usage_forwards+0x12b/0x130
      [  309.662233]    mark_lock+0x360/0x6f0
      [  309.662237]    __lock_acquire+0x638/0x1b50
      [  309.662241]    lock_acquire+0xc9/0x220
      [  309.662245]    __mutex_lock+0x6e/0x990
      [  309.662249]    mutex_lock_nested+0x16/0x20
      [  309.662253]    _rcu_barrier+0x31/0x160
      [  309.662257]    rcu_barrier+0x10/0x20
      [  309.662279]    i915_gem_shrink_all+0x33/0x40 [i915]
      [  309.662298]    i915_drop_caches_set+0x141/0x150 [i915]
      [  309.662303]    simple_attr_write+0xc7/0xe0
      [  309.662307]    full_proxy_write+0x4f/0x70
      [  309.662311]    __vfs_write+0x23/0x120
      [  309.662315]    vfs_write+0xc6/0x1f0
      [  309.662319]    SyS_write+0x44/0xb0
      [  309.662323]    entry_SYSCALL_64_fastpath+0x1c/0xb1
      
      [  309.662329]
                     stack backtrace:
      [  309.662335] CPU: 1 PID: 6435 Comm: gem_exec_gttfil Tainted: G        W       4.11.0-rc1-CI-CI_DRM_2333+ #1
      [  309.662342] Hardware name: Hewlett-Packard HP Compaq 8100 Elite SFF PC/304Ah, BIOS 786H1 v01.13 07/14/2011
      [  309.662348] Call Trace:
      [  309.662354]  dump_stack+0x67/0x92
      [  309.662359]  print_irq_inversion_bug.part.19+0x1a4/0x1b0
      [  309.662365]  check_usage_forwards+0x12b/0x130
      [  309.662369]  mark_lock+0x360/0x6f0
      [  309.662374]  ? print_shortest_lock_dependencies+0x1a0/0x1a0
      [  309.662379]  __lock_acquire+0x638/0x1b50
      [  309.662383]  ? __mutex_unlock_slowpath+0x3e/0x2e0
      [  309.662388]  ? trace_hardirqs_on+0xd/0x10
      [  309.662392]  ? _rcu_barrier+0x31/0x160
      [  309.662396]  lock_acquire+0xc9/0x220
      [  309.662400]  ? _rcu_barrier+0x31/0x160
      [  309.662404]  ? _rcu_barrier+0x31/0x160
      [  309.662409]  __mutex_lock+0x6e/0x990
      [  309.662412]  ? _rcu_barrier+0x31/0x160
      [  309.662416]  ? _rcu_barrier+0x31/0x160
      [  309.662421]  ? synchronize_rcu_expedited+0x35/0xb0
      [  309.662426]  ? _raw_spin_unlock_irqrestore+0x52/0x60
      [  309.662434]  mutex_lock_nested+0x16/0x20
      [  309.662438]  _rcu_barrier+0x31/0x160
      [  309.662442]  rcu_barrier+0x10/0x20
      [  309.662464]  i915_gem_shrink_all+0x33/0x40 [i915]
      [  309.662484]  i915_drop_caches_set+0x141/0x150 [i915]
      [  309.662489]  simple_attr_write+0xc7/0xe0
      [  309.662494]  full_proxy_write+0x4f/0x70
      [  309.662498]  __vfs_write+0x23/0x120
      [  309.662503]  ? rcu_read_lock_sched_held+0x75/0x80
      [  309.662507]  ? rcu_sync_lockdep_assert+0x2a/0x50
      [  309.662512]  ? __sb_start_write+0x102/0x210
      [  309.662516]  ? vfs_write+0x17d/0x1f0
      [  309.662520]  vfs_write+0xc6/0x1f0
      [  309.662524]  ? trace_hardirqs_on_caller+0xe7/0x200
      [  309.662529]  SyS_write+0x44/0xb0
      [  309.662533]  entry_SYSCALL_64_fastpath+0x1c/0xb1
      [  309.662537] RIP: 0033:0x7f507eac24a0
      [  309.662541] RSP: 002b:00007fffda8720e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      [  309.662548] RAX: ffffffffffffffda RBX: ffffffff81482bd3 RCX: 00007f507eac24a0
      [  309.662552] RDX: 0000000000000005 RSI: 00007fffda8720f0 RDI: 0000000000000005
      [  309.662557] RBP: ffffc9000048bf88 R08: 0000000000000000 R09: 000000000000002c
      [  309.662561] R10: 0000000000000014 R11: 0000000000000246 R12: 00007fffda872230
      [  309.662566] R13: 00007fffda872228 R14: 0000000000000201 R15: 00007fffda8720f0
      [  309.662572]  ? __this_cpu_preempt_check+0x13/0x20
      
      Fixes: 0eafec6d ("drm/i915: Enable lockless lookup of request tracking via RCU")
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100192Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: <stable@vger.kernel.org> # v4.9+
      Link: http://patchwork.freedesktop.org/patch/msgid/20170314115019.18127-1-chris@chris-wilson.co.ukReviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bd784b7c
    • A
      drm/i915/glk: Improve rounding caused by pre-CSC gamma tables · 3465dbdd
      Ander Conselvan de Oliveira 提交于
      The 33rd entry in the pre-CSC gamma table in Geminilake can represent a
      value of 1.0 as 17 bits fixed point with one integer bit. However, the
      table was generated such that the value of 1.0 would be 0.ffff with
      all the intervals scaled accordingly. For instance, 0.5 mapped to
      0.7fff instead of 0.8000.
      
      For a reason that is not clear to the author, the rounding seems to be
      different when a cursor plane is used, leading to some seemingly random
      failures of the kms_cursor_crc igt tests. The differences weren't
      perceptible at 8bpc with images captured by a Chamelium device, but did
      cause CRC mismatches.
      Signed-off-by: NAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170310101835.29845-1-ander.conselvan.de.oliveira@intel.com
      3465dbdd
    • D
      drm/i915: Merge pre/postclose hooks · 7d2ec881
      Daniel Vetter 提交于
      There's really not a reason afaics that we can't just clean up
      everything at the end, in the terminal postclose hook: Since this is
      closing a file descriptor we know no one else can have a reference or
      a thread doing something with that drm_file except the close code.
      Ordering shouldn't matter, as long as we don't kfree before we clean
      stuff up.
      
      In the past this was more relevant when drivers still had to track and
      clean up pending drm events, but that's all done by the core now.
      Reviewed-by: NSean Paul <seanpaul@chromium.org>
      Reviewed-by: NLiviu Dudau <Liviu.Dudau@arm.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170308141257.12119-13-daniel.vetter@ffwll.ch
      7d2ec881
    • V
      Revert "drm/i915: Ignore panel type from OpRegion on SKL" · ca0241a5
      Ville Syrjälä 提交于
      This reverts commit bb10d4ec.
      
      Since commit c8ebfad7 ("drm/i915: Ignore OpRegion panel type except
      on select machines") we ignore the OpRegion panel type except for
      specific machines (handled via a DMI match), so having SKL explicitly
      excluded from using the OpRegion panel type is redundant. So let's
      remove the SKL check.
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170308143334.21216-1-ville.syrjala@linux.intel.comReviewed-by: NJani Nikula <jani.nikula@intel.com>
      ca0241a5
    • D
      drm/i915: annote drop_caches debugfs interface with lockdep · 05df49e7
      Daniel Vetter 提交于
      The trouble we have is that we can't really test all the shrinker
      recursion stuff exhaustively in BAT because any kind of thrashing
      stress test just takes too long.
      
      But that leaves a really big gap open, since shrinker recursions are
      one of the most annoying bugs. Now lockdep already has support for
      checking allocation deadlocks:
      
      - Direct reclaim paths are marked up with
        lockdep_set_current_reclaim_state() and
        lockdep_clear_current_reclaim_state().
      
      - Any allocation paths are marked with lockdep_trace_alloc().
      
      If we simply mark up our debugfs with the reclaim annotations, any
      code and locks taken in there will automatically complete the picture
      with any allocation paths we already have, as long as we have a simple
      testcase in BAT which throws out a few objects using this interface.
      Not stress test or thrashing needed at all.
      
      v2: Need to EXPORT_SYMBOL_GPL to make it compile as a module.
      
      v3: Fixup rebase fail (spotted by Chris).
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170312205340.16202-1-daniel.vetter@ffwll.chSigned-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      05df49e7
    • J
      drm/i915/vbt: split out defaults that are set when there is no VBT · bb1d1329
      Jani Nikula 提交于
      The main thing are the DDI ports. If there's a VBT that says there are
      no outputs, we should trust that, and not have semi-random
      defaults. Unfortunately, the defaults have resulted in some Chromebooks
      without VBT to rely on this behaviour, so we split out the defaults for
      the missing VBT case.
      Reviewed-by: NManasi Navare <manasi.d.navare@intel.com>
      Cc: Manasi Navare <manasi.d.navare@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/95c26079ff640d43f53b944f17e9fc356b36daec.1489152288.git.jani.nikula@intel.com
      bb1d1329
    • V
      drm/i915: Optimize VLV/CHV display FIFO updates · 44e921d4
      Ville Syrjälä 提交于
      Use I915_{READ,WRITE}_FW() for updating the DSPARB registers on
      VLV/CHV. This is less expesive as we can grab the uncore.lock across
      the entire sequence of reads and writes instead of each register
      access grabbing it.
      
      This also allows us to eliminate the dsparb lock entirely as the
      uncore.lock now effectively protects the contents of the DSPARB
      registers.
      
      v2: Add a note that interrupts are already disabled (Chris)
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170309154434.29303-6-ville.syrjala@linux.intel.comReviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      44e921d4
    • V
      drm/i915: Use I915_READ_FW for plane updates · dd584fc0
      Ville Syrjälä 提交于
      Optimize the plane register accesses a little bit by grabbing
      the uncore lock manually across the entire pile of accesses and
      using I915_READ_FW().
      
      This helps keep the pipe update vblank evade critical section
      below our 100 usec deadline, particularly with lockdep enabled.
      And in general we want to keep that critical section as short
      as possible as it's executed with interrupts disabled.
      
      Not all plane updates currently happen from within the vblank evade
      critical section, so we must use the irqsave/irqrestore variants
      of the spinlock functions in the plane hooks.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170309154434.29303-5-ville.syrjala@linux.intel.comReviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      dd584fc0
    • V
      drm/i915: Organize plane register writes into tighter bunches · 78587de2
      Ville Syrjälä 提交于
      Pull all the plane register writes closer together to avoid having
      a lot of unrelated stuff in between them. This will make things more
      clear once we'll grab the uncore lock around the entire bunch. Also
      in the future we might even consider moving more of the register
      value computation out from the plane update hooks. This should make
      that easier to do.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170309154434.29303-4-ville.syrjala@linux.intel.comReviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      78587de2
    • V
      drm/i915: s/__raw_i915_read32/I915_READ_FW/ in the SKL+ scanline read w/a · 707bdd3f
      Ville Syrjälä 提交于
      Replace __raw_i915_read32() with I915_READ_FW() in the workaround for
      the SKL+ scanline counter hardware fail. The two are the same thing
      but everyone else uses I915_READ_FW() so let's follow suit.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170309154434.29303-3-ville.syrjala@linux.intel.comReviewed-by: NMika Kahola <mika.kahola@intel.com>
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      707bdd3f
    • V
      drm/i915: Use I915_READ_FW in i915_get_vblank_counter() · 694e409d
      Ville Syrjälä 提交于
      Optimize the multi-register read in i915_get_vblank_counter() a little
      bit by grabbing the uncore lock manually and using I915_READ_FW().
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170309154434.29303-2-ville.syrjala@linux.intel.comReviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      694e409d
    • V
      drm/i915: Reject HDMI 12bpc if the sink doesn't indicate support · c750bdd3
      Ville Syrjälä 提交于
      Check that the sink really declared 12bpc support before we enable it.
      This should not actually never happen since it's mandatory for HDMI
      sinks to support 12bpc if they support any deep color modes. But
      reality disagrees with the theory and there are actually sinks in
      the wild that violate the spec.
      
      v2: Fix the output_types check
          Update commit message to state that these things are in fact real
      
      Cc: stable@vger.kernel.org
      Cc: Nicholas Sielicki <nicholas.sielicki@gmail.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99250Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170213175818.24958-1-ville.syrjala@linux.intel.comReviewed-by: NShashank Sharma <shashank.sharma@intel.com>
      c750bdd3
  4. 13 3月, 2017 4 次提交