1. 16 Mar, 2017 4 commits
    • Chris Wilson's avatar
      drm/i915/userptr: Reinvent GGTT self-faulting protection · 15c344f4
      Chris Wilson authored
      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: default avatarSergey 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: default avatarChris 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: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      15c344f4
    • Michal Wajdeczko's avatar
      drm/i915: Make intel_uc_sanitize_options() more robust · d4a70a10
      Michal Wajdeczko authored
      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: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
      [tursulin: fixup bad alignment]
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315133741.150420-1-michal.wajdeczko@intel.com
      d4a70a10
    • Arkadiusz Hiler's avatar
      drm/i915/uc: Rename intel_uc_fw.fw to .type · 6833b82e
      Arkadiusz Hiler authored
      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: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
      Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315133415.15343-1-arkadiusz.hiler@intel.com
      6833b82e
    • Chris Wilson's avatar
      drm/i915/breadcrumbs: Tweak commentary · a6b0a141
      Chris Wilson authored
      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: default avatarChris 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: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      a6b0a141
  2. 15 Mar, 2017 17 commits
  3. 14 Mar, 2017 6 commits
    • Chris Wilson's avatar
      drm/i915: Avoid rcu_barrier() from reclaim paths (shrinker) · bd784b7c
      Chris Wilson authored
      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: default avatarChris 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: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      bd784b7c
    • Ander Conselvan de Oliveira's avatar
      drm/i915/glk: Improve rounding caused by pre-CSC gamma tables · 3465dbdd
      Ander Conselvan de Oliveira authored
      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: default avatarAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170310101835.29845-1-ander.conselvan.de.oliveira@intel.com
      3465dbdd
    • Daniel Vetter's avatar
      drm/i915: Merge pre/postclose hooks · 7d2ec881
      Daniel Vetter authored
      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: default avatarSean Paul <seanpaul@chromium.org>
      Reviewed-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170308141257.12119-13-daniel.vetter@ffwll.ch
      7d2ec881
    • Ville Syrjälä's avatar
      Revert "drm/i915: Ignore panel type from OpRegion on SKL" · ca0241a5
      Ville Syrjälä authored
      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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170308143334.21216-1-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      ca0241a5
    • Daniel Vetter's avatar
      drm/i915: annote drop_caches debugfs interface with lockdep · 05df49e7
      Daniel Vetter authored
      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: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170312205340.16202-1-daniel.vetter@ffwll.chSigned-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      05df49e7
    • Jani Nikula's avatar
      drm/i915/vbt: split out defaults that are set when there is no VBT · bb1d1329
      Jani Nikula authored
      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: default avatarManasi 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: default avatarJani Nikula <jani.nikula@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/95c26079ff640d43f53b944f17e9fc356b36daec.1489152288.git.jani.nikula@intel.com
      bb1d1329
  4. 13 Mar, 2017 13 commits