1. 08 Mar, 2017 11 commits
    • Chris Wilson's avatar
      drm/i915: Avoiding recursing on ww_mutex inside shrinker · 03d1cac6
      Chris Wilson authored
      We have to avoid taking ww_mutex inside the shrinker as we use it as a
      plain mutex type and so need to avoid recursive deadlocks:
      
      [  602.771969] =================================
      [  602.771970] [ INFO: inconsistent lock state ]
      [  602.771973] 4.10.0gpudebug+ #122 Not tainted
      [  602.771974] ---------------------------------
      [  602.771975] inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage.
      [  602.771978] kswapd0/40 [HC0[0]:SC0[0]:HE1:SE1] takes:
      [  602.771979]  (reservation_ww_class_mutex){+.+.?.}, at: [<ffffffffa054680a>] i915_gem_object_wait+0x39a/0x410 [i915]
      [  602.772020] {RECLAIM_FS-ON-W} state was registered at:
      [  602.772024]   mark_held_locks+0x76/0x90
      [  602.772026]   lockdep_trace_alloc+0xb8/0xc0
      [  602.772028]   __kmalloc_track_caller+0x5d/0x130
      [  602.772031]   krealloc+0x89/0xb0
      [  602.772033]   reservation_object_reserve_shared+0xaf/0xd0
      [  602.772055]   i915_gem_do_execbuffer.isra.35+0x1413/0x18b0 [i915]
      [  602.772075]   i915_gem_execbuffer2+0x10e/0x1d0 [i915]
      [  602.772078]   drm_ioctl+0x291/0x480
      [  602.772079]   do_vfs_ioctl+0x695/0x6f0
      [  602.772081]   SyS_ioctl+0x3c/0x70
      [  602.772084]   entry_SYSCALL_64_fastpath+0x18/0xad
      [  602.772085] irq event stamp: 5197423
      [  602.772088] hardirqs last  enabled at (5197423): [<ffffffff8116751d>] kfree+0xdd/0x170
      [  602.772091] hardirqs last disabled at (5197422): [<ffffffff811674f9>] kfree+0xb9/0x170
      [  602.772095] softirqs last  enabled at (5190992): [<ffffffff8107bfe1>] __do_softirq+0x221/0x280
      [  602.772097] softirqs last disabled at (5190575): [<ffffffff8107c294>] irq_exit+0x64/0xc0
      [  602.772099]
                     other info that might help us debug this:
      [  602.772100]  Possible unsafe locking scenario:
      
      [  602.772101]        CPU0
      [  602.772101]        ----
      [  602.772102]   lock(reservation_ww_class_mutex);
      [  602.772104]   <Interrupt>
      [  602.772105]     lock(reservation_ww_class_mutex);
      [  602.772107]
                      *** DEADLOCK ***
      
      [  602.772109] 2 locks held by kswapd0/40:
      [  602.772110]  #0:  (shrinker_rwsem){++++..}, at: [<ffffffff811337b5>] shrink_slab.constprop.62+0x35/0x280
      [  602.772116]  #1:  (&dev->struct_mutex){+.+.+.}, at: [<ffffffffa0553957>] i915_gem_shrinker_lock+0x27/0x60 [i915]
      [  602.772141]
                     stack backtrace:
      [  602.772144] CPU: 2 PID: 40 Comm: kswapd0 Not tainted 4.10.0gpudebug+ #122
      [  602.772145] Hardware name: LENOVO 42433ZG/42433ZG, BIOS 8AET64WW (1.44 ) 07/26/2013
      [  602.772147] Call Trace:
      [  602.772151]  dump_stack+0x68/0xa1
      [  602.772153]  print_usage_bug+0x1d4/0x1f0
      [  602.772155]  mark_lock+0x390/0x530
      [  602.772157]  ? print_irq_inversion_bug+0x200/0x200
      [  602.772159]  __lock_acquire+0x405/0x1260
      [  602.772181]  ? i915_gem_object_wait+0x39a/0x410 [i915]
      [  602.772183]  lock_acquire+0x60/0x80
      [  602.772205]  ? i915_gem_object_wait+0x39a/0x410 [i915]
      [  602.772207]  mutex_lock_nested+0x69/0x760
      [  602.772229]  ? i915_gem_object_wait+0x39a/0x410 [i915]
      [  602.772231]  ? kfree+0xdd/0x170
      [  602.772253]  ? i915_gem_object_wait+0x163/0x410 [i915]
      [  602.772255]  ? trace_hardirqs_on_caller+0x18d/0x1c0
      [  602.772256]  ? trace_hardirqs_on+0xd/0x10
      [  602.772278]  i915_gem_object_wait+0x39a/0x410 [i915]
      [  602.772300]  i915_gem_object_unbind+0x5e/0x130 [i915]
      [  602.772323]  i915_gem_shrink+0x22d/0x3d0 [i915]
      [  602.772347]  i915_gem_shrinker_scan+0x3f/0x80 [i915]
      [  602.772349]  shrink_slab.constprop.62+0x1ad/0x280
      [  602.772352]  shrink_node+0x52/0x80
      [  602.772355]  kswapd+0x427/0x5c0
      [  602.772358]  kthread+0x122/0x130
      [  602.772360]  ? try_to_free_pages+0x270/0x270
      [  602.772362]  ? kthread_stop+0x70/0x70
      [  602.772365]  ret_from_fork+0x2e/0x40
      
      v2: Add commentary about the pruning being opportunistic
      Reported-by: default avatarJan Nordholz <jckn@gmx.net>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99977#c10
      Fixes: e54ca977 ("drm/i915: Remove completed fences after a wait")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Matthew Auld <matthew.auld@intel.com>
      Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170308132629.7987-1-chris@chris-wilson.co.uk
      03d1cac6
    • Ville Syrjälä's avatar
      drm/i915: Use DRM_DEBUG_KMS() for framebuffer failure debug messages · 144cc143
      Ville Syrjälä authored
      DRM_UT_CORE generates way too much noise usually, so having the
      framebuffer init failures use DRM_UT_CORE is a pain when trying to
      find out the reason why you failed in creating a framebuffer.
      Let's use DRM_UT_KMS for these debug messages instead.
      
      v2: s/at less than/at most/ in the debug message (Imre)
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170307194210.13400-6-ville.syrjala@linux.intel.com
      144cc143
    • Ville Syrjälä's avatar
      drm/i915: Pass the correct plane index to _intel_compute_tile_offset() · 3ca46c0a
      Ville Syrjälä authored
      intel_fill_fb_info() should pass the correct plane index to
      _intel_compute_tile_offset() once we start to care about the AUX
      surface.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170307194210.13400-5-ville.syrjala@linux.intel.com
      3ca46c0a
    • Ville Syrjälä's avatar
      drm/i915: Avoid div-by-zero when computing aux_stride w/o an aux plane · 1b500535
      Ville Syrjälä authored
      To make life easier let's allow skl_plane_stride() to be called for the
      AUX surface even when there is no AUX surface. Avoids special cases in
      the callers.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170307194210.13400-4-ville.syrjala@linux.intel.com
      1b500535
    • Ville Syrjälä's avatar
      drm/i915: Move nv12 chroma plane handling into intel_surf_alignment() · b90c1ee1
      Ville Syrjälä authored
      Let's try to keep the alignment requirements in one place, and so
      towards that end let's move the AUX_DIST alignment handling into
      intel_surf_alignment() alongside the main surface alignment stuff.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170307194210.13400-3-ville.syrjala@linux.intel.com
      b90c1ee1
    • Ville Syrjälä's avatar
      drm/i915: Plumb drm_framebuffer into more places · d88c4afd
      Ville Syrjälä authored
      Now that framebuffers can be used even before calling
      drm_framebuffer_init() we can start to plumb them into more places,
      instead of passing individual pieces for fb metadata.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170307194210.13400-2-ville.syrjala@linux.intel.com
      d88c4afd
    • Bing Niu's avatar
      drm/i915: suppress atomic commit error message under gvt-g env · a94f2b92
      Bing Niu authored
      under virtualization enviroment, it is possible guest update pipe
      registers across vblank intervals due to overhead of mmio traps or vm
      schedule out. However, it is safe since those pipe update happen in
      virual registers and will not be committed to hardware. suppress that
      atomic commit error message under virtualization case to avoid
      confusing user.
      
      v2: per ville's comment: return early and against Maarten's patch
      v3: coding style clean
      Signed-off-by: default avatarBing Niu <bing.niu@intel.com>
      Acked-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1489004043-15449-1-git-send-email-bing.niu@intel.comSigned-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      a94f2b92
    • Ville Syrjälä's avatar
      drm/i915: Nuke debug messages from the pipe update critical section · c3f8ad57
      Ville Syrjälä authored
      printks are slow so we should not be doing them from the vblank evade
      critical section. These could explain why we sometimes seem to
      blow past our 100 usec deadline.
      
      The problem has been there ever since commit bfd16b2a ("drm/i915:
      Make updating pipe without modeset atomic.") but it may not have
      been readily visible until commit e1edbd44 ("drm/i915: Complain
      if we take too long under vblank evasion.") increased our chances
      of noticing it.
      
      Cc: stable@vger.kernel.org
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Fixes: bfd16b2a ("drm/i915: Make updating pipe without modeset atomic.")
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170307205419.19447-1-ville.syrjala@linux.intel.comReviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      c3f8ad57
    • Daniel Vetter's avatar
      Merge remote-tracking branch 'airlied/drm-next' into drm-intel-next-queued · 7ffe939d
      Daniel Vetter authored
      Backmerge drm-next to get at all the good stuff in drm-misc. We need
      that because:
      
      - drm_connector_list_iter conversion for i915 needs the core patches.
      - Maarten's patches to use the new atomic state iterators also need
        the core patches.
      - We need the new link status property to complete the DP retraining
        work, merging through 2 branches wasn't a good idea and we had to
        partially backtrack.
      - Chris needs reservation_object_trylock and we want to roll out
        kref_read everywhere.
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      7ffe939d
    • Dave Airlie's avatar
      Merge branch 'linux-4.12' of git://github.com/skeggsb/linux into drm-next · 6796b129
      Dave Airlie authored
      - Re-architecture of the code to handle proprietary fw, more abstracted
      to support the multitude of differences that NVIDIA introduce
      - Support in the said code for GP10x ACR and GR fw, giving acceleration
      support \o/
      - Fix for GTX 970 GPUs that are in an odd MMU configuration
      
      * 'linux-4.12' of git://github.com/skeggsb/linux: (60 commits)
        drm/nouveau/fb/gf100-: rework ram detection
        drm/nouveau/fb/gm200: split ram implementation from gm107
        drm/nouveau/fb/gf108: split implementation from gf100
        drm/nouveau/fb/gf100-: modify constructors to allow more customisation
        drm/nouveau/kms/nv50: use drm core i2c-over-aux algorithm
        drm/nouveau/i2c/g94-: return REPLY_M value on reads
        drm/nouveau/i2c: modify aux interface to return length actually transferred
        drm/nouveau/gp10x: enable secboot and GR
        drm/nouveau/gr/gp102: initial support
        drm/nouveau/falcon: support for gp10x msgqueue
        drm/nouveau/secboot: add gp102/gp104/gp106/gp107 support
        drm/nouveau/secboot: put HS code loading code into own file
        drm/nouveau/secboot: support for r375 ACR
        drm/nouveau/secboot: support for r367 ACR
        drm/nouveau/secboot: support for r364 ACR
        drm/nouveau/secboot: workaround bug when starting SEC2 firmware
        drm/nouveau/secboot: support standard NVIDIA HS binaries
        drm/nouveau/secboot: support for unload blob bootloader
        drm/nouveau/secboot: let callers interpret return value of blobs
        drm/nouveau/secboot: support for different load and unload falcons
        ...
      6796b129
    • Dave Airlie's avatar
      Merge tag 'drm-intel-next-2017-03-06' of git://anongit.freedesktop.org/git/drm-intel into drm-next · 2e161017
      Dave Airlie authored
      4 weeks worth of stuff since I was traveling&lazy:
      
      - lspcon improvements (Imre)
      - proper atomic state for cdclk handling (Ville)
      - gpu reset improvements (Chris)
      - lots and lots of polish around fences, requests, waiting and
        everything related all over (both gem and modeset code), from Chris
      - atomic by default on gen5+ minus byt/bsw (Maarten did the patch to
        flip the default, really this is a massive joint team effort)
      - moar power domains, now 64bit (Ander)
      - big pile of in-kernel unit tests for various gem subsystems (Chris),
        including simple mock objects for i915 device and and the ggtt
        manager.
      - i915_gpu_info in debugfs, for taking a snapshot of the current gpu
        state. Same thing as i915_error_state, but useful if the kernel didn't
        notice something is stick. From Chris.
      - bxt dsi fixes (Umar Shankar)
      - bxt w/a updates (Jani)
      - no more struct_mutex for gem object unreference (Chris)
      - some execlist refactoring (Tvrtko)
      - color manager support for glk (Ander)
      - improve the power-well sync code to better take over from the
        firmware (Imre)
      - gem tracepoint polish (Tvrtko)
      - lots of glk fixes all around (Ander)
      - ctx switch improvements (Chris)
      - glk dsi support&fixes (Deepak M)
      - dsi fixes for vlv and clanups, lots of them (Hans de Goede)
      - switch to i915.ko types in lots of our internal modeset code (Ander)
      - byt/bsw atomic wm update code, yay (Ville)
      
      * tag 'drm-intel-next-2017-03-06' of git://anongit.freedesktop.org/git/drm-intel: (432 commits)
        drm/i915: Update DRIVER_DATE to 20170306
        drm/i915: Don't use enums for hardware engine id
        drm/i915: Split breadcrumbs spinlock into two
        drm/i915: Refactor wakeup of the next breadcrumb waiter
        drm/i915: Take reference for signaling the request from hardirq
        drm/i915: Add FIFO underrun tracepoints
        drm/i915: Add cxsr toggle tracepoint
        drm/i915: Add VLV/CHV watermark/FIFO programming tracepoints
        drm/i915: Add plane update/disable tracepoints
        drm/i915: Kill level 0 wm hack for VLV/CHV
        drm/i915: Workaround VLV/CHV sprite1->sprite0 enable underrun
        drm/i915: Sanitize VLV/CHV watermarks properly
        drm/i915: Only use update_wm_{pre,post} for pre-ilk platforms
        drm/i915: Nuke crtc->wm.cxsr_allowed
        drm/i915: Compute proper intermediate wms for vlv/cvh
        drm/i915: Skip useless watermark/FIFO related work on VLV/CHV when not needed
        drm/i915: Compute vlv/chv wms the atomic way
        drm/i915: Compute VLV/CHV FIFO sizes based on the PM2 watermarks
        drm/i915: Plop vlv/chv fifo sizes into crtc state
        drm/i915: Plop vlv wm state into crtc_state
        ...
      2e161017
  2. 07 Mar, 2017 29 commits