1. 20 2月, 2018 1 次提交
    • C
      drm: Handle unexpected holes in color-eviction · b8ff1802
      Chris Wilson 提交于
      During eviction, the driver may free more than one hole in the drm_mm
      due to the side-effects in evicting the scanned nodes. However,
      drm_mm_scan_color_evict() expects that the scan result is the first
      available hole (in the mru freed hole_stack list):
      
        kernel BUG at drivers/gpu/drm/drm_mm.c:844!
        invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
        Dumping ftrace buffer:
           (ftrace buffer empty)
        Modules linked in: i915 snd_hda_codec_analog snd_hda_codec_generic coretemp snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core lpc_ich snd_pcm e1000e mei_me prime_numbers mei
        CPU: 1 PID: 1490 Comm: gem_userptr_bli Tainted: G     U           4.16.0-rc1-g740f57c54ecf-kasan_6+ #1
        Hardware name: Dell Inc. OptiPlex 755                 /0PU052, BIOS A08 02/19/2008
        RIP: 0010:drm_mm_scan_color_evict+0x2b8/0x3d0
        RSP: 0018:ffff880057a573f8 EFLAGS: 00010287
        RAX: ffff8800611f5980 RBX: ffff880057a575d0 RCX: dffffc0000000000
        RDX: 00000000029d5000 RSI: 1ffff1000af4aec1 RDI: ffff8800611f5a10
        RBP: ffff88005ab884d0 R08: ffff880057a57600 R09: 000000000afff000
        R10: 1ffff1000b5710b5 R11: 0000000000001000 R12: 1ffff1000af4ae82
        R13: ffff8800611f59b0 R14: ffff8800611f5980 R15: ffff880057a57608
        FS:  00007f2de0c2e8c0(0000) GS:ffff88006ac40000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00007f2ddde1e000 CR3: 00000000609b2000 CR4: 00000000000006e0
        Call Trace:
         ? drm_mm_scan_remove_block+0x330/0x330
         ? drm_mm_scan_remove_block+0x151/0x330
         i915_gem_evict_something+0x711/0xbd0 [i915]
         ? igt_evict_contexts+0x50/0x50 [i915]
         ? nop_clear_range+0x10/0x10 [i915]
         ? igt_evict_something+0x90/0x90 [i915]
         ? i915_gem_gtt_reserve+0x1a1/0x320 [i915]
         i915_gem_gtt_insert+0x237/0x400 [i915]
         __i915_vma_do_pin+0xc25/0x1a20 [i915]
         eb_lookup_vmas+0x1c63/0x3790 [i915]
         ? i915_gem_check_execbuffer+0x250/0x250 [i915]
         ? trace_hardirqs_on_caller+0x33f/0x590
         ? _raw_spin_unlock_irqrestore+0x39/0x60
         ? __pm_runtime_resume+0x7d/0xf0
         i915_gem_do_execbuffer+0x86a/0x2ff0 [i915]
         ? __kmalloc+0x132/0x340
         ? i915_gem_execbuffer2_ioctl+0x10f/0x760 [i915]
         ? drm_ioctl_kernel+0x12e/0x1c0
         ? drm_ioctl+0x662/0x980
         ? eb_relocate_slow+0xa90/0xa90 [i915]
         ? i915_gem_execbuffer2_ioctl+0x10f/0x760 [i915]
         ? __might_fault+0xea/0x1a0
         i915_gem_execbuffer2_ioctl+0x3cc/0x760 [i915]
         ? i915_gem_execbuffer_ioctl+0xba0/0xba0 [i915]
         ? lock_acquire+0x3c0/0x3c0
         ? i915_gem_execbuffer_ioctl+0xba0/0xba0 [i915]
         drm_ioctl_kernel+0x12e/0x1c0
         drm_ioctl+0x662/0x980
         ? i915_gem_execbuffer_ioctl+0xba0/0xba0 [i915]
         ? drm_getstats+0x20/0x20
         ? debug_check_no_obj_freed+0x2a6/0x8c0
         do_vfs_ioctl+0x170/0xe70
         ? ioctl_preallocate+0x170/0x170
         ? task_work_run+0xbe/0x160
         ? lock_acquire+0x3c0/0x3c0
         ? trace_hardirqs_on_caller+0x33f/0x590
         ? _raw_spin_unlock_irq+0x2f/0x50
         SyS_ioctl+0x36/0x70
         ? do_vfs_ioctl+0xe70/0xe70
         do_syscall_64+0x18c/0x5d0
         entry_SYSCALL_64_after_hwframe+0x26/0x9b
        RIP: 0033:0x7f2ddf13b587
        RSP: 002b:00007fff15c4f9d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f2ddf13b587
        RDX: 00007fff15c4fa20 RSI: 0000000040406469 RDI: 0000000000000003
        RBP: 00007fff15c4fa20 R08: 0000000000000000 R09: 00007f2ddf3fe120
        R10: 0000000000000073 R11: 0000000000000246 R12: 0000000040406469
        R13: 0000000000000003 R14: 00007fff15c4fa20 R15: 00000000000000c7
        Code: 00 00 00 4a c7 44 22 08 00 00 00 00 42 c7 44 22 10 00 00 00 00 48 81 c4 b8 00 00 00 5b 5d 41 5c 41 5d 41 5e 41 5f c3 0f 0b 0f 0b <0f> 0b 31 c0 eb c0 4c 89 ef e8 9a 09 41 ff e9 1e fe ff ff 4c 89
        RIP: drm_mm_scan_color_evict+0x2b8/0x3d0 RSP: ffff880057a573f8
      
      We can trivially relax this assumption by searching the hole_stack for
      the scan result and warn instead if the driver called us without any
      result.
      
      Fixes: 3fa489da ("drm: Apply tight eviction scanning to color_adjust")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: <stable@vger.kernel.org> # v4.11+
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180219113543.8010-1-chris@chris-wilson.co.uk
      b8ff1802
  2. 15 12月, 2017 1 次提交
  3. 02 11月, 2017 1 次提交
  4. 09 9月, 2017 1 次提交
  5. 06 2月, 2017 1 次提交
  6. 03 2月, 2017 1 次提交
    • C
      drm: Improve drm_mm search (and fix topdown allocation) with rbtrees · 4e64e553
      Chris Wilson 提交于
      The drm_mm range manager claimed to support top-down insertion, but it
      was neither searching for the top-most hole that could fit the
      allocation request nor fitting the request to the hole correctly.
      
      In order to search the range efficiently, we create a secondary index
      for the holes using either their size or their address. This index
      allows us to find the smallest hole or the hole at the bottom or top of
      the range efficiently, whilst keeping the hole stack to rapidly service
      evictions.
      
      v2: Search for holes both high and low. Rename flags to mode.
      v3: Discover rb_entry_safe() and use it!
      v4: Kerneldoc for enum drm_mm_insert_mode.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: "Christian König" <christian.koenig@amd.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Russell King <rmk+kernel@armlinux.org.uk>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Alexandre Courbot <gnurou@gmail.com>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Sinclair Yeh <syeh@vmware.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: Sinclair Yeh <syeh@vmware.com> # vmwgfx
      Reviewed-by: Lucas Stach <l.stach@pengutronix.de> #etnaviv
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170202210438.28702-1-chris@chris-wilson.co.uk
      4e64e553
  7. 25 1月, 2017 1 次提交
  8. 30 12月, 2016 2 次提交
  9. 28 12月, 2016 12 次提交
  10. 27 12月, 2016 8 次提交
  11. 16 12月, 2016 2 次提交
  12. 01 12月, 2016 1 次提交
    • C
      drm: Initialise drm_mm.head_node.allocated · cc98e6ce
      Chris Wilson 提交于
      commit 202b52b7 ("drm: Track drm_mm nodes with an interval tree")
      introduced a requirement that the special drm_mm.head_node was
      initialised and marked as not being allocated. It is a very special node
      that has no side but has a hole that represents the drm_mm address
      space, and holds the list of nodes. Since it is not a real node, it is
      not part of the node rbtree and we detect this as it being unallocated.
      This presumed that drm_mm_init() was initialising it to zero. It happens
      that i915 kzallocs its objects and so it was accidentally setting it,
      but for generic use we cannot make that assumption.
      
      [   22.981519] general protection fault: 0000 [#1] SMP
      [   22.981521] Modules linked in: test_drm_mm(+) ctr ccm arc4 rt2800usb rt2x00usb rt2800lib rt2x00lib crc_ccitt mac80211 cmac rfcomm bnep snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel dcdbas snd_hda_codec x86_pkg_temp_thermal intel_powerclamp btusb snd_hda_core coretemp crct10dif_pclmul cfg80211 btrtl btbcm btintel bluetooth crc32_pclmul ghash_clmulni_intel aesni_intel snd_pcm i2c_hid aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd snd_timer hid_multitouch snd joydev serio_raw lpc_ich mfd_core i2c_designware_platform i2c_designware_core 8250_dw binfmt_misc soundcore acpi_pad nls_iso8859_1 usbhid hid psmouse ahci libahci [last unloaded: test_drm_mm]
      [   22.981544] CPU: 1 PID: 2088 Comm: drm_mm Tainted: G        W       4.9.0-rc7+ #234
      [   22.981545] Hardware name: Dell Inc. XPS 13 9343/0310JH, BIOS A07 11/11/2015
      [   22.981546] task: ffff88020c971cc0 task.stack: ffffc90001728000
      [   22.981547] RIP: 0010:[<ffffffff814050f0>]  [<ffffffff814050f0>] drm_mm_interval_tree_add_node+0xa0/0xd0
      [   22.981551] RSP: 0018:ffffc9000172ba98  EFLAGS: 00010202
      [   22.981552] RAX: 0f0000c69cf63d80 RBX: ffff88020be00000 RCX: ffff88020be00000
      [   22.981553] RDX: 0000000000000fff RSI: ffffc9000172bc48 RDI: ffffffff810ac4df
      [   22.981553] RBP: ffffc9000172bb08 R08: ffffc9000172bc70 R09: 0000000000000fff
      [   22.981554] R10: ffffffff810ac4d7 R11: 4dc04d8b4cffffe5 R12: 0000000000001000
      [   22.981555] R13: ffffc9000172bbd0 R14: ffffc9000172bbe0 R15: 0000000002000000
      [   22.981556] FS:  00007f80c9fab740(0000) GS:ffff88021f480000(0000) knlGS:0000000000000000
      [   22.981557] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   22.981558] CR2: 00007f80c9fd5000 CR3: 000000020c191000 CR4: 00000000003406e0
      [   22.981559] Stack:
      [   22.981560]  ffffffff81405d09 ffff88020be00000 ffffc9000172bbe0 000000000172bb08
      [   22.981562]  ffffffffffffffff 0000000000000000 0000000000000000 0000000000000000
      [   22.981563]  0000000002000000 0000000002000000 ffffffffa02f3000 ffff88020be00000
      [   22.981565] Call Trace:
      [   22.981568]  [<ffffffff81405d09>] ? drm_mm_insert_node_generic+0x229/0x310
      [   22.981570]  [<ffffffffa02f3000>] ? 0xffffffffa02f3000
      [   22.981572]  [<ffffffffa02903c1>] __subtest_insert_range.constprop.7+0xd1/0x5b0 [test_drm_mm]
      [   22.981575]  [<ffffffff81081222>] ? default_wake_function+0x12/0x20
      [   22.981576]  [<ffffffff81096905>] ? __wake_up_common+0x55/0x90
      [   22.981578]  [<ffffffff81085f42>] ? sched_clock_cpu+0x72/0xa0
      [   22.981581]  [<ffffffff811308ad>] ? irq_work_queue+0xd/0x80
      [   22.981582]  [<ffffffff810abcc4>] ? wake_up_klogd+0x34/0x40
      [   22.981584]  [<ffffffff810ac19d>] ? console_unlock+0x4cd/0x530
      [   22.981585]  [<ffffffff810ac4d7>] ? vprintk_emit+0x2d7/0x490
      [   22.981587]  [<ffffffff810ac82f>] ? vprintk_default+0x1f/0x30
      [   22.981589]  [<ffffffff81146e1c>] ? printk+0x4d/0x4f
      [   22.981590]  [<ffffffffa02f3000>] ? 0xffffffffa02f3000
      [   22.981592]  [<ffffffffa02908b5>] subtest_insert_range+0x15/0x80 [test_drm_mm]
      [   22.981594]  [<ffffffffa02f3088>] test_drm_mm_init+0x88/0x1000 [test_drm_mm]
      [   22.981597]  [<ffffffff8100043d>] do_one_initcall+0x3d/0x150
      [   22.981600]  [<ffffffff8119dfbf>] ? kfree+0x13f/0x180
      [   22.981602]  [<ffffffff811471f2>] do_init_module+0x60/0x1f1
      [   22.981606]  [<ffffffff810db878>] load_module+0x2228/0x2790
      [   22.981608]  [<ffffffff810d8590>] ? __symbol_put+0x40/0x40
      [   22.981612]  [<ffffffff811c52b1>] ? kernel_read+0x41/0x60
      [   22.981614]  [<ffffffff810dbfb6>] SYSC_finit_module+0x96/0xd0
      [   22.981617]  [<ffffffff810dc00e>] SyS_finit_module+0xe/0x10
      [   22.981620]  [<ffffffff816e7aa4>] entry_SYSCALL_64_fastpath+0x17/0x98
      [   22.981622] Code: c7 41 30 00 00 00 00 48 89 e5 48 89 3a 48 c7 c2 20 4e 40 81 e8 b2 a1 f0 ff 5d c3 48 8d 56 78 45 31 d2 48 89 d6 eb 25 48 8b 51 58 <48> 39 50 38 73 04 48 89 50 38 4c 8b 58 28 4c 39 59 48 48 8d 50
      [   22.981651] RIP  [<ffffffff814050f0>] drm_mm_interval_tree_add_node+0xa0/0xd0
      [   22.981655]  RSP <ffffc9000172ba98>
      
      Testcase: igt/drm_mm
      Fixes: 202b52b7 ("drm: Track drm_mm nodes with an interval tree")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: David Herrmann <dh.herrmann@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.9-rc1+
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20161130205126.31106-1-chris@chris-wilson.co.uk
      cc98e6ce
  13. 24 11月, 2016 2 次提交
  14. 08 11月, 2016 2 次提交
  15. 08 8月, 2016 3 次提交
  16. 23 5月, 2016 1 次提交