1. 01 Feb, 2018 2 commits
    • Matthew Auld's avatar
      drm/i915/selftests: add missing gtt shrinker test · fe215c8b
      Matthew Auld authored
      Try to catch a bug we've seen in the wild where the shrinker purges the
      pd/pdp from under us while allocating our paging structures.
      
      References: https://bugs.freedesktop.org/show_bug.cgi?id=104773Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180131191453.12676-1-matthew.auld@intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180131214440.7141-2-chris@chris-wilson.co.uk
      fe215c8b
    • Chris Wilson's avatar
      drm/i915/ppgtt: Pin page directories before allocation · b715a2f0
      Chris Wilson authored
      Commit e2b763ca ("drm/i915: Remove bitmap tracking for used-pdpes")
      believed that because it did not insert its freshly allocated page
      directory into the pd tree, it was safe from the shrinker. I failed to
      heed the lesson learnt from commit dd19674b ("drm/i915: Remove bitmap
      tracking for used-ptes") that we need to pin all the levels in the tree
      before hitting the shrinker or else the shrinker may free an upper layer
      as we proceed to allocate the tree. Thus leaving dangling pointers
      everywhere and a GPF should we hit direct reclaim at just the wrong
      moment.
      
      CPU: 0 PID: 7374 Comm: chromium Tainted: P           O    4.14.13-1-ARCH #1
      Hardware name: Apple Inc. MacBookPro12,1/Mac-E43C1C25D4880AD6, BIOS MBP121.88Z.0167.B33.1706181928 06/18/2017
      task: ffff994f696c2c40 task.stack: ffffb1a789d4c000
      RIP: 0010:gen8_ppgtt_set_pde.isra.40+0x48/0x70 [i915]
      RSP: 0018:ffffb1a789d4f940 EFLAGS: 00010206
      RAX: 81c1788cc4f68138 RBX: ffff994f54db8000 RCX: ffff994f696c2c40
      RDX: 000000023bc73003 RSI: ffff994d598b6b80 RDI: ffff994f54db8000
      RBP: ffff994d598b6b80 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffb1a789d4f550 R11: ffff994eaf3c3208 R12: 0000000000000027
      R13: 0000000000005000 R14: 0000000004e8f000 R15: ffff994f54dba000
      FS:  00007f585886aa00(0000) GS:ffff994faec00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000004ac8e8 CR3: 00000002552c8004 CR4: 00000000003606f0
      Call Trace:
       gen8_ppgtt_alloc_pdp+0x178/0x320 [i915]
       gen8_ppgtt_alloc_4lvl+0x5f/0x150 [i915]
       ppgtt_bind_vma+0x30/0x70 [i915]
       i915_vma_bind+0x68/0xd0 [i915]
       __i915_vma_do_pin+0x2d6/0x3a0 [i915]
       eb_lookup_vmas+0x7a2/0xb50 [i915]
       i915_gem_do_execbuffer+0x4d7/0x10e0 [i915]
       ? sock_wfree+0x34/0x60
       ? unix_stream_read_generic+0x1f9/0x7e0
       ? import_iovec+0x37/0xd0
       ? i915_gem_execbuffer2+0x5d/0x390 [i915]
       i915_gem_execbuffer2+0x1b7/0x390 [i915]
       ? i915_gem_execbuffer+0x2d0/0x2d0 [i915]
       drm_ioctl_kernel+0x59/0xb0 [drm]
       drm_ioctl+0x2d5/0x370 [drm]
       ? i915_gem_execbuffer+0x2d0/0x2d0 [i915]
       ? __seccomp_filter+0x3b/0x260
       do_vfs_ioctl+0xa1/0x610
       ? syscall_trace_enter+0xdb/0x2b0
       SyS_ioctl+0x74/0x80
       do_syscall_64+0x55/0x110
       entry_SYSCALL64_slow_path+0x25/0x25
      RIP: 0033:0x7f584fa82d27
      RSP: 002b:00007ffee14a7828 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
      RAX: ffffffffffffffda RBX: 000003b0126a1030 RCX: 00007f584fa82d27
      RDX: 00007ffee14a7870 RSI: 0000000040406469 RDI: 0000000000000080
      RBP: 00007ffee14a7870 R08: 0000000000000002 R09: 0000000000000077
      R10: 00007f5839f2b780 R11: 0000000000000246 R12: 0000000040406469
      R13: 0000000000000080 R14: 00007f5842b00040 R15: 0000000000000000
      Code: 01 00 83 81 58 0a 00 00 01 48 2b 05 13 9d fd c9 48 c1 f8 06 48 c1 e0 0c 48 8d 04 d0 48 8b 56 08 48 03 05 0c 9d fd c9 48 83 ca 03 <48> 89 10 83 a9 58 0a 00 00 01 65 ff 0d 37 03 fb 3e 74 02 f3 c3
      RIP: gen8_ppgtt_set_pde.isra.40+0x48/0x70 [i915] RSP: ffffb1a789d4f940
      Reported-by: default avatarEric Blau <eblau@eblau.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104773
      Fixes: e2b763ca ("drm/i915: Remove bitmap tracking for used-pdpes")
      References: dd19674b ("drm/i915: Remove bitmap tracking for used-ptes")
      Testcase: igt/drv_selftest/live_gtt (igt_ppgtt_shrink_boom)
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Matthew Auld <matthew.auld@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180131214440.7141-1-chris@chris-wilson.co.ukReviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
      b715a2f0
  2. 31 Jan, 2018 12 commits
  3. 30 Jan, 2018 12 commits
  4. 29 Jan, 2018 5 commits
  5. 26 Jan, 2018 1 commit
  6. 25 Jan, 2018 3 commits
    • Chris Wilson's avatar
      drm/i915/lrc: Clear context restore/save inhibit flags for new contexts · 09b1a4e4
      Chris Wilson authored
      CTX_CONTEXT_CONTROL (CTX_SR_CTL) operates as a masked register and so
      will only apply the bits that are selected by the upper half. In the
      case of selectively enabling sr inhibit, this may mean the context keeps
      the current setting (so forgetting to save the context later, eventually
      leading to a very upset GPU!).
      
      Fixes: 517aaffe ("drm/i915/execlists: Inhibit context save/restore for the fake preempt context")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Michal Winiarski <michal.winiarski@intel.com>
      Cc: Michel Thierry <michel.thierry@intel.com>
      Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180125112443.12745-1-chris@chris-wilson.co.ukReviewed-by: default avatarMichel Thierry <michel.thierry@intel.com>
      09b1a4e4
    • Dave Airlie's avatar
      Merge tag 'drm-misc-next-fixes-2018-01-18' of... · 559f17be
      Dave Airlie authored
      Merge tag 'drm-misc-next-fixes-2018-01-18' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
      
      Fixes for 4.16:
      
      Fixes one Kconfig issue and a enable some panels to work properly.
      There is also a fix of error code return in sun4i.
      
      * tag 'drm-misc-next-fixes-2018-01-18' of git://anongit.freedesktop.org/drm/drm-misc:
        drm: Fix PANEL_ORIENTATION_QUIRKS breaking the Kconfig DRM menuconfig
        drm/panel: lvds: Handle the optional regulator case properly
        drm/sun4i: Fix error code in sun4i_tcon_bind()
      559f17be
    • Dave Airlie's avatar
      Merge branch 'drm-next-4.16' of git://people.freedesktop.org/~agd5f/linux into drm-next · 22bc72c8
      Dave Airlie authored
       A few more fixes for 4.16, nothing major.
      
      A few more fixes for 4.16.  This is on top of the pull request from
      last week.  Most notable change here is a fix to the link order for
      the now separate from amdgpu GPU scheduler to fix crashes when the
      modules are build into the kernel rather than as modules.
      
      * 'drm-next-4.16' of git://people.freedesktop.org/~agd5f/linux:
        drm: fix gpu scheduler link order
        drm/amd/display: Demote error print to debug print when ATOM impl missing
        drm/amdgpu: Avoid leaking PM domain on driver unbind (v2)
        drm/amd/amdgpu: Add Polaris version check
        drm/amdgpu: Reenable manual GPU reset from sysfs
        drm/amdgpu: disable MMHUB power gating on raven
        drm/ttm: Don't unreserve swapped BOs that were previously reserved
        drm/ttm: Don't add swapped BOs to swap-LRU list
        drm/amdgpu: only check for ECC on Vega10
        drm/amd/powerplay: Fix smu_table_entry.handle type
        drm/ttm: add VADDR_FLAG_UPDATED_COUNT to correctly update dma_page global count
        drm/radeon: fill in rb backend map on evergreen/ni.
        drm/amdgpu/gfx9: fix ngg enablement to clear gds reserved memory (v2)
        drm/ttm: only free pages rather than update global memory count together
        drm/amdgpu: fix CPU based VM updates
        drm/amdgpu: fix typo in amdgpu_vce_validate_bo
        drm/amdgpu: fix amdgpu_vm_pasid_fault_credit
        drm/ttm: check the return value of register_shrinker
        drm/radeon: fix sparse warning: Should it be static?
      22bc72c8
  7. 24 Jan, 2018 5 commits
    • Christian König's avatar
      drm: fix gpu scheduler link order · 87440329
      Christian König authored
      It should initialize before the drivers using it.
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104736Reviewed-by: default avatarMike Lothian <mike@fireburn.co.uk>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      87440329
    • Harry Wentland's avatar
      drm/amd/display: Demote error print to debug print when ATOM impl missing · 30305f58
      Harry Wentland authored
      I assumed wrongfully that all relevant functions should be implemented.
      Apparently this isn't the case. Demote the print to debug level for now.
      Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
      Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      30305f58
    • Sagar Arun Kamble's avatar
      drm/i915/guc: Fix comments style in intel_guc_log.c · 2fcf0680
      Sagar Arun Kamble authored
      Use consistent multi-line comment style as per guideline.
      
      v2: Reverted comments prefix update to kernel-doc comment. (Chris)
      Suggested-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
      Signed-off-by: default avatarSagar Arun Kamble <sagar.a.kamble@intel.com>
      Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/1516808821-3638-5-git-send-email-sagar.a.kamble@intel.com
      2fcf0680
    • Sagar Arun Kamble's avatar
      drm/i915/guc: Update name and prototype of i915_guc_log_control · 065dd5ad
      Sagar Arun Kamble authored
      i915_guc_log_control is GuC interface and GuC APIs that are not user
      facing should be named with "intel_guc" prefix hence we change name to
      intel_guc_log_control. Also changed the parameter to intel_guc struct.
      
      v2: Move log vma check to intel_guc_log_control (Michal)
          Return -ENODEV when log isn't initialized. (Chris)
      Suggested-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
      Signed-off-by: default avatarSagar Arun Kamble <sagar.a.kamble@intel.com>
      Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/1516808821-3638-4-git-send-email-sagar.a.kamble@intel.com
      065dd5ad
    • Sagar Arun Kamble's avatar
      drm/i915/guc: Fix lockdep due to log relay channel handling under struct_mutex · 70deeadd
      Sagar Arun Kamble authored
      This patch fixes lockdep issue due to circular locking dependency of
      struct_mutex, i_mutex_key, mmap_sem, relay_channels_mutex.
      For GuC log relay channel we create debugfs file that requires i_mutex_key
      lock and we are doing that under struct_mutex. So we introduced newer
      dependency as:
          &dev->struct_mutex --> &sb->s_type->i_mutex_key#3 --> &mm->mmap_sem
      However, there is dependency from mmap_sem to struct_mutex. Hence we
      separate the relay create/destroy operation from under struct_mutex.
      Also added runtime check of relay buffer status.
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      
      ======================================================
      WARNING: possible circular locking dependency detected
      4.15.0-rc6-CI-Patchwork_7614+ #1 Not tainted
      ------------------------------------------------------
      debugfs_test/1388 is trying to acquire lock:
       (&dev->struct_mutex){+.+.}, at: [<00000000d5e1d915>] i915_mutex_lock_interruptible+0x47/0x130 [i915]
      
      but task is already holding lock:
       (&mm->mmap_sem){++++}, at: [<0000000029a9c131>] __do_page_fault+0x106/0x560
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #3 (&mm->mmap_sem){++++}:
             _copy_to_user+0x1e/0x70
             filldir+0x8c/0xf0
             dcache_readdir+0xeb/0x160
             iterate_dir+0xdc/0x140
             SyS_getdents+0xa0/0x130
             entry_SYSCALL_64_fastpath+0x1c/0x89
      
      -> #2 (&sb->s_type->i_mutex_key#3){++++}:
             start_creating+0x59/0x110
             __debugfs_create_file+0x2e/0xe0
             relay_create_buf_file+0x62/0x80
             relay_late_setup_files+0x84/0x250
             guc_log_late_setup+0x4f/0x110 [i915]
             i915_guc_log_register+0x32/0x40 [i915]
             i915_driver_load+0x7b6/0x1720 [i915]
             i915_pci_probe+0x2e/0x90 [i915]
             pci_device_probe+0x9c/0x120
             driver_probe_device+0x2a3/0x480
             __driver_attach+0xd9/0xe0
             bus_for_each_dev+0x57/0x90
             bus_add_driver+0x168/0x260
             driver_register+0x52/0xc0
             do_one_initcall+0x39/0x150
             do_init_module+0x56/0x1ef
             load_module+0x231c/0x2d70
             SyS_finit_module+0xa5/0xe0
             entry_SYSCALL_64_fastpath+0x1c/0x89
      
      -> #1 (relay_channels_mutex){+.+.}:
             relay_open+0x12c/0x2b0
             intel_guc_log_runtime_create+0xab/0x230 [i915]
             intel_guc_init+0x81/0x120 [i915]
             intel_uc_init+0x29/0xa0 [i915]
             i915_gem_init+0x182/0x530 [i915]
             i915_driver_load+0xaa9/0x1720 [i915]
             i915_pci_probe+0x2e/0x90 [i915]
             pci_device_probe+0x9c/0x120
             driver_probe_device+0x2a3/0x480
             __driver_attach+0xd9/0xe0
             bus_for_each_dev+0x57/0x90
             bus_add_driver+0x168/0x260
             driver_register+0x52/0xc0
             do_one_initcall+0x39/0x150
             do_init_module+0x56/0x1ef
             load_module+0x231c/0x2d70
             SyS_finit_module+0xa5/0xe0
             entry_SYSCALL_64_fastpath+0x1c/0x89
      
      -> #0 (&dev->struct_mutex){+.+.}:
             __mutex_lock+0x81/0x9b0
             i915_mutex_lock_interruptible+0x47/0x130 [i915]
             i915_gem_fault+0x201/0x790 [i915]
             __do_fault+0x15/0x70
             __handle_mm_fault+0x677/0xdc0
             handle_mm_fault+0x14f/0x2f0
             __do_page_fault+0x2d1/0x560
             page_fault+0x4c/0x60
      
      other info that might help us debug this:
      
      Chain exists of:
        &dev->struct_mutex --> &sb->s_type->i_mutex_key#3 --> &mm->mmap_sem
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(&mm->mmap_sem);
                                     lock(&sb->s_type->i_mutex_key#3);
                                     lock(&mm->mmap_sem);
        lock(&dev->struct_mutex);
      
       *** DEADLOCK ***
      
      1 lock held by debugfs_test/1388:
       #0:  (&mm->mmap_sem){++++}, at: [<0000000029a9c131>] __do_page_fault+0x106/0x560
      
      stack backtrace:
      CPU: 2 PID: 1388 Comm: debugfs_test Not tainted 4.15.0-rc6-CI-Patchwork_7614+ #1
      Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./J4205-ITX, BIOS P1.10 09/29/2016
      Call Trace:
       dump_stack+0x5f/0x86
       print_circular_bug.isra.18+0x1d0/0x2c0
       __lock_acquire+0x14ae/0x1b60
       ? lock_acquire+0xaf/0x200
       lock_acquire+0xaf/0x200
       ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
       __mutex_lock+0x81/0x9b0
       ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
       ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
       ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
       i915_mutex_lock_interruptible+0x47/0x130 [i915]
       ? __pm_runtime_resume+0x4f/0x80
       i915_gem_fault+0x201/0x790 [i915]
       __do_fault+0x15/0x70
       ? _raw_spin_unlock+0x29/0x40
       __handle_mm_fault+0x677/0xdc0
       handle_mm_fault+0x14f/0x2f0
       __do_page_fault+0x2d1/0x560
       ? page_fault+0x36/0x60
       page_fault+0x4c/0x60
      
      v2: Added lock protection to guc->log.runtime.relay_chan (Chris)
          Fixed locking inside guc_flush_logs uncovered by new lockdep.
      
      v3: Locking guc_read_update_log_buffer entirely with relay_lock. (Chris)
          Prepared intel_guc_init_early. Moved relay_lock inside relay_create
          relay_destroy, relay_file_create, guc_read_update_log_buffer. (Michal)
          Removed struct_mutex lock around guc_log_flush and removed usage
          of guc_log_has_relay() from runtime_create path as it needs
          struct_mutex lock.
      
      v4: Handle NULL relay sub buffer pointer earlier in read_update_log_buffer
          (Chris). Fixed comment suffix **/. (Michal)
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104693
      Testcase: igt/debugfs_test/read_all_entries # with enable_guc=1 and guc_log_level=1
      Signed-off-by: default avatarSagar Arun Kamble <sagar.a.kamble@intel.com>
      Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Marta Lofstedt <marta.lofstedt@intel.com>
      Cc: Michal Winiarski <michal.winiarski@intel.com>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/1516808821-3638-3-git-send-email-sagar.a.kamble@intel.com
      70deeadd