1
0
Fork 0
alistair23-linux/drivers/gpu/drm
Chris Wilson b8ff180281 drm: Handle unexpected holes in color-eviction
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: 3fa489dabe ("drm: Apply tight eviction scanning to color_adjust")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.11+
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180219113543.8010-1-chris@chris-wilson.co.uk
2018-02-20 08:28:28 +00:00
..
amd drm/amdgpu: Fix deadlock on runtime suspend 2018-02-16 22:40:23 +01:00
arc
arm Merge branch 'for-upstream/mali-dp' of git://linux-arm.org/linux-ld into drm-fixes 2017-12-01 09:15:31 +10:00
armada drm/armada: fix YUV planar format framebuffer offsets 2017-12-08 12:16:22 +00:00
ast main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
atmel-hlcdc main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
bochs main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
bridge drm/bridge: analogix dp: Fix runtime PM state in get_modes() callback 2017-12-07 20:12:39 +05:30
cirrus drm/cirrus: Load lut in crtc_commit 2018-01-31 13:14:33 +01:00
etnaviv main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
exynos drm/exynos: remove unnecessary function declaration 2017-12-07 10:34:40 +09:00
fsl-dcu fixes/cleanups for rc1, non-desktop flags for VR 2017-11-23 21:04:56 -10:00
gma500 main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
hisilicon drm/hisilicon: Ensure LDI regs are properly configured. 2017-11-01 10:36:50 +08:00
i2c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
i810
i915 drm/i915: Don't adjust priority on an already signaled fence 2018-01-11 11:42:53 +02:00
imx drm/imx: always call wait_for_flip_done in commit_tail 2017-11-30 15:47:40 +01:00
lib License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mediatek main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
meson drm/meson: Use drm_gem_fb_create() 2017-10-01 17:01:39 +02:00
mga
mgag200 main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
msm treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
mxsfb drm/mxsfb: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb() 2017-10-01 17:02:20 +02:00
nouveau drm/nouveau: Fix deadlock on runtime suspend 2018-02-16 22:32:26 +01:00
omapdrm omapdrm/dss/hdmi4_cec: fix interrupt handling 2018-01-02 14:20:10 +02:00
panel main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
pl111 main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
qxl qxl: alloc & use shadow for dumb buffers 2017-10-23 08:23:11 +02:00
r128 r128: switch compat ioctls to drm_ioctl_kernel() 2017-09-29 13:42:35 -04:00
radeon drm/radeon: Fix deadlock on runtime suspend 2018-02-16 22:37:27 +01:00
rcar-du main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
rockchip Linux 4.15-rc1 2017-11-27 10:54:33 +01:00
savage
selftests License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
shmobile main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
sis
sti main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
stm drm/stm: ltdc: remove bridge from driver internal structure 2017-10-10 11:32:48 +02:00
sun4i drm/sun4i: hdmi: Add missing rate halving check in sun4i_tmds_determine_rate 2018-01-11 13:25:43 +01:00
tdfx
tegra drm/tegra: sor: Fix hang on Tegra124 eDP 2018-01-10 13:04:58 +01:00
tilcdc fixes/cleanups for rc1, non-desktop flags for VR 2017-11-23 21:04:56 -10:00
tinydrm drm/tinydrm: Remove explicit .best_encoder assignment 2017-10-13 17:34:51 +02:00
ttm drm/ttm: check the return value of kzalloc 2018-01-02 14:54:05 -05:00
tve200 drm/tve200: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb() 2017-10-01 17:04:36 +02:00
udl Merge tag 'drm-misc-next-2017-10-20' of git://anongit.freedesktop.org/drm/drm-misc into drm-next 2017-10-24 16:51:05 +10:00
vc4 drm/vc4: Fix NULL pointer dereference in vc4_save_hang_state() 2018-01-18 12:17:03 -08:00
vgem treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
via treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
virtio main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
vmwgfx drm/vmwgfx: fix memory corruption with legacy/sou connectors 2018-01-17 16:27:45 +01:00
zte main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
Kconfig Merge branch 'drm-next-4.15' of git://people.freedesktop.org/~agd5f/linux into drm-next 2017-09-28 08:37:02 +10:00
Makefile main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
ati_pcigart.c
drm_agpsupport.c drm/agpsupport: Remove extra blank line 2017-09-20 09:54:19 -07:00
drm_atomic.c drm: Reorganize drm_pending_event to support future event types [v2] 2017-10-21 07:23:40 +10:00
drm_atomic_helper.c drm/atomic: Fix memleak on ERESTARTSYS during non-blocking commits 2018-02-01 11:14:06 +01:00
drm_auth.c drm: Check mode object lease status in all master ioctl paths [v4] 2017-10-25 16:31:30 +10:00
drm_blend.c
drm_bridge.c
drm_bufs.c
drm_cache.c
drm_color_mgmt.c drm: Pass struct drm_file * to __drm_mode_object_find [v2] 2017-10-12 10:03:04 +10:00
drm_connector.c drm: rework delayed connector cleanup in connector_iter 2017-12-13 22:59:00 +01:00
drm_context.c
drm_crtc.c drm: Pass struct drm_file * to __drm_mode_object_find [v2] 2017-10-12 10:03:04 +10:00
drm_crtc_helper.c drm: Replace kzalloc with kcalloc 2017-10-13 15:49:03 -04:00
drm_crtc_helper_internal.h
drm_crtc_internal.h drm: rework delayed connector cleanup in connector_iter 2017-12-13 22:59:00 +01:00
drm_debugfs.c
drm_debugfs_crc.c
drm_dma.c
drm_dp_aux_dev.c Pass mode to wait_on_atomic_t() action funcs and provide default actions 2017-11-13 15:38:16 +00:00
drm_dp_dual_mode_helper.c drm: Add retries for lspcon mode detection 2017-10-13 12:13:54 +03:00
drm_dp_helper.c drm/dp: WARN about invalid/unknown link rates and bw codes 2017-10-11 18:41:44 +03:00
drm_dp_mst_topology.c
drm_drv.c drm: Add new LEASE debug level 2017-10-25 16:31:29 +10:00
drm_dumb_buffers.c
drm_edid.c drm/edid: Add 6 bpc quirk for CPT panel in Asus UX303LA 2018-02-19 16:43:50 +01:00
drm_edid_load.c drm: add backwards compatibility support for drm_kms_helper.edid_firmware 2017-09-19 18:11:45 +03:00
drm_encoder.c drm: Check mode object lease status in all master ioctl paths [v4] 2017-10-25 16:31:30 +10:00
drm_encoder_slave.c
drm_fb_cma_helper.c drm/fb-cma-helper: Remove unused functions 2017-10-01 17:05:39 +02:00
drm_fb_helper.c drm/fb_helper: Disable all crtc's when initial setup fails. 2017-11-29 15:37:31 +01:00
drm_file.c
drm_flip_work.c
drm_fourcc.c
drm_framebuffer.c drm/mode_object: fix documentation for object lookups. 2017-11-10 13:50:47 +10:00
drm_gem.c drm: fix typo in drm_gem_get_pages() comment 2017-10-04 18:04:28 +02:00
drm_gem_cma_helper.c drm/gem-cma-helper: Change the level of the allocation failure message 2017-10-16 15:19:57 +02:00
drm_gem_framebuffer_helper.c drm/gem-fb-helper: Improve documentation 2017-10-08 15:02:51 +02:00
drm_global.c
drm_hashtab.c
drm_info.c
drm_internal.h drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v3] 2017-10-23 11:15:03 +10:00
drm_ioc32.c
drm_ioctl.c drm: Add four ioctls for managing drm mode object leases [v7] 2017-10-25 16:31:30 +10:00
drm_irq.c
drm_kms_helper_common.c drm: add backwards compatibility support for drm_kms_helper.edid_firmware 2017-09-19 18:11:45 +03:00
drm_lease.c drm: move lease init after validation in drm_lease_create 2017-12-21 09:49:40 +01:00
drm_legacy.h
drm_lock.c
drm_memory.c
drm_mipi_dsi.c
drm_mm.c drm: Handle unexpected holes in color-eviction 2018-02-20 08:28:28 +00:00
drm_mode_config.c drm: rework delayed connector cleanup in connector_iter 2017-12-13 22:59:00 +01:00
drm_mode_object.c drm/mode_object: fix documentation for object lookups. 2017-11-10 13:50:47 +10:00
drm_modes.c
drm_modeset_helper.c
drm_modeset_lock.c drm: Require __GFP_NOFAIL for the legacy drm_modeset_lock_all 2017-10-31 17:36:46 +01:00
drm_of.c drm/drm_of: Move drm_of_panel_bridge_remove_function into header. 2017-10-13 16:59:36 +02:00
drm_panel.c
drm_pci.c drm/core: clean up references to drm_dev_unref() 2017-09-27 10:53:12 +02:00
drm_plane.c drm/plane: Make framebuffer refcounting the responsibility of setplane_internal callers 2017-12-20 14:49:06 +01:00
drm_plane_helper.c drm: Replace kzalloc with kcalloc 2017-10-13 15:49:03 -04:00
drm_prime.c drm/core: clean up references to drm_dev_unref() 2017-09-27 10:53:12 +02:00
drm_print.c
drm_probe_helper.c drm: Allow determining if current task is output poll worker 2018-02-16 22:30:06 +01:00
drm_property.c drm: Pass struct drm_file * to __drm_mode_object_find [v2] 2017-10-12 10:03:04 +10:00
drm_rect.c
drm_scatter.c
drm_scdc_helper.c Merge tag 'drm-misc-next-2017-09-20' of git://anongit.freedesktop.org/git/drm-misc into drm-next 2017-09-28 05:46:15 +10:00
drm_simple_kms_helper.c
drm_syncobj.c drm/syncobj: Stop reusing the same struct file for all syncobj -> fd 2017-12-22 14:14:39 +10:00
drm_sysfs.c
drm_trace.h main drm pull request for v4.15 2017-11-15 20:42:10 -08:00
drm_trace_points.c
drm_vblank.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
drm_vm.c
drm_vma_manager.c