linux/drivers/gpu/drm
Matthew Auld a9f4fa3a7e
drm/xe/userptr: fix EFAULT handling
Currently we treat EFAULT from hmm_range_fault() as a non-fatal error
when called from xe_vm_userptr_pin() with the idea that we want to avoid
killing the entire vm and chucking an error, under the assumption that
the user just did an unmap or something, and has no intention of
actually touching that memory from the GPU.  At this point we have
already zapped the PTEs so any access should generate a page fault, and
if the pin fails there also it will then become fatal.

However it looks like it's possible for the userptr vma to still be on
the rebind list in preempt_rebind_work_func(), if we had to retry the
pin again due to something happening in the caller before we did the
rebind step, but in the meantime needing to re-validate the userptr and
this time hitting the EFAULT.

This explains an internal user report of hitting:

[  191.738349] WARNING: CPU: 1 PID: 157 at drivers/gpu/drm/xe/xe_res_cursor.h:158 xe_pt_stage_bind.constprop.0+0x60a/0x6b0 [xe]
[  191.738551] Workqueue: xe-ordered-wq preempt_rebind_work_func [xe]
[  191.738616] RIP: 0010:xe_pt_stage_bind.constprop.0+0x60a/0x6b0 [xe]
[  191.738690] Call Trace:
[  191.738692]  <TASK>
[  191.738694]  ? show_regs+0x69/0x80
[  191.738698]  ? __warn+0x93/0x1a0
[  191.738703]  ? xe_pt_stage_bind.constprop.0+0x60a/0x6b0 [xe]
[  191.738759]  ? report_bug+0x18f/0x1a0
[  191.738764]  ? handle_bug+0x63/0xa0
[  191.738767]  ? exc_invalid_op+0x19/0x70
[  191.738770]  ? asm_exc_invalid_op+0x1b/0x20
[  191.738777]  ? xe_pt_stage_bind.constprop.0+0x60a/0x6b0 [xe]
[  191.738834]  ? ret_from_fork_asm+0x1a/0x30
[  191.738849]  bind_op_prepare+0x105/0x7b0 [xe]
[  191.738906]  ? dma_resv_reserve_fences+0x301/0x380
[  191.738912]  xe_pt_update_ops_prepare+0x28c/0x4b0 [xe]
[  191.738966]  ? kmemleak_alloc+0x4b/0x80
[  191.738973]  ops_execute+0x188/0x9d0 [xe]
[  191.739036]  xe_vm_rebind+0x4ce/0x5a0 [xe]
[  191.739098]  ? trace_hardirqs_on+0x4d/0x60
[  191.739112]  preempt_rebind_work_func+0x76f/0xd00 [xe]

Followed by NPD, when running some workload, since the sg was never
actually populated but the vma is still marked for rebind when it should
be skipped for this special EFAULT case. This is confirmed to fix the
user report.

v2 (MattB):
 - Move earlier.
v3 (MattB):
 - Update the commit message to make it clear that this indeed fixes the
   issue.

Fixes: 521db22a1d ("drm/xe: Invalidate userptr VMA on page pin fault")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: <stable@vger.kernel.org> # v6.10+
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250221143840.167150-5-matthew.auld@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
(cherry picked from commit 6b93cb9891)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2025-02-24 15:39:27 -05:00
..
amd drm/amdgpu: avoid buffer overflow attach in smu_sys_set_pp_table() 2025-02-12 19:47:15 -05:00
arm Merge remote-tracking branch 'drm-misc/drm-misc-next-fixes' into drm-misc-fixes 2025-02-06 09:59:35 +01:00
armada drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
aspeed drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
ast Merge remote-tracking branch 'drm-misc/drm-misc-next-fixes' into drm-misc-fixes 2025-02-06 09:59:35 +01:00
atmel-hlcdc drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
bridge Linux 6.13 2025-01-23 14:42:21 +01:00
ci drm/ci: remove update-xfails.py 2024-11-05 10:50:55 -03:00
clients drm/log: select CONFIG_FONT_SUPPORT 2024-12-12 18:26:32 +01:00
display drm: Fix DSC BPP increment decoding 2025-02-13 10:20:30 +02:00
etnaviv - cleanups 2025-01-10 10:55:06 +10:00
exynos ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata 2025-01-04 08:47:10 +02:00
fsl-dcu drm/fsl-dcu: Include <linux/of.h> 2024-12-13 15:20:40 +01:00
gma500 drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
gud drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
hisilicon drm/hisilicon/hibmc: select CONFIG_DRM_DISPLAY_DP_HELPER 2025-02-09 03:56:34 +02:00
hyperv drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
i2c ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata 2025-01-04 08:47:10 +02:00
i915 drm/i915/dp: Fix disabling the transcoder function in 128b/132b mode 2025-02-19 14:42:31 -05:00
imagination drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
imx drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
ingenic drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
kmb drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
lib drm/lib: Include <linux/prandom.h> instead of <linux/random.h> 2024-10-03 18:19:38 +02:00
lima drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
logicvc drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
loongson drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
mcde drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
mediatek Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
meson drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
mgag200 drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
msm Merge tag 'drm-msm-fixes-2025-02-20' of https://gitlab.freedesktop.org/drm/msm into drm-fixes 2025-02-21 10:50:29 +10:00
mxsfb drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
nouveau An reset signal polarity fix for the jd9365da-h3 panel, a folio handling 2025-02-21 09:16:35 +10:00
omapdrm drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
panel drm: panel: jd9365da-h3: fix reset signal polarity 2025-02-13 17:46:51 +01:00
panfrost drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
panthor drm/panthor: avoid garbage value in panthor_ioctl_dev_query() 2025-02-07 17:31:59 +01:00
pl111 drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
qxl drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
radeon drm/radeon: use eld_mutex to protect access to connector->eld 2024-12-16 18:02:08 +02:00
renesas drm/rcar-du: Add support for r8a779h0 2024-12-17 15:13:04 +02:00
rockchip drm/rockchip: vop2: Support 32x8 superblock afbc 2025-01-05 17:00:06 +01:00
scheduler drm/sched: Fix drm_sched_fini() docu generation 2024-12-19 16:03:56 +01:00
solomon drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
sprd drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
sti ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata 2025-01-04 08:47:10 +02:00
stm drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
sun4i drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
tegra drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
tests drm/tests: hdmi: Fix recursive locking 2025-02-06 14:07:56 +01:00
tidss drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
tilcdc drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
tiny Merge remote-tracking branch 'drm-misc/drm-misc-next-fixes' into drm-misc-fixes 2025-02-06 09:59:35 +01:00
ttm DMEM cgroup pull request 2025-01-11 07:20:29 +10:00
tve200 drm-misc-next for 6.14: 2024-12-13 08:48:09 +10:00
udl drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
v3d drm/v3d: Assign job pointer to NULL before signaling the fence 2025-01-23 16:15:01 -03:00
vboxvideo drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
vc4 drm/vc4: hdmi: use drm_atomic_helper_connector_hdmi_hotplug() 2025-01-04 08:47:11 +02:00
vgem drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
virtio drm/virtio: Fix UAF in virtgpu_dma_buf_free_obj() 2025-01-19 15:12:28 +03:00
vkms drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
vmwgfx Linux 6.13 2025-01-23 14:42:21 +01:00
xe drm/xe/userptr: fix EFAULT handling 2025-02-24 15:39:27 -05:00
xen drm: remove driver date from struct drm_driver and all drivers 2024-12-05 12:35:42 +02:00
xlnx Merge remote-tracking branch 'drm-misc/drm-misc-next-fixes' into drm-misc-fixes 2025-02-06 09:59:35 +01:00
drm_atomic_helper.c drm/panic: Fix uninitialized spinlock acquisition with CONFIG_DRM_PANIC=n 2024-09-16 19:03:29 -04:00
drm_atomic_state_helper.c
drm_atomic_uapi.c drm: Consistently use struct drm_mode_rect for FB_DAMAGE_CLIPS 2024-09-25 12:35:05 +02:00
drm_atomic.c drm/atomic: add interlaced and ycbcr_420 flags to connector's state dump 2024-10-24 22:42:25 +03:00
drm_auth.c
drm_blend.c
drm_bridge.c drm/bridge: Prioritize supported_formats over ycbcr_420_allowed 2025-01-13 11:18:20 +02:00
drm_buddy.c drm/buddy: Add start address support to trim function 2024-08-07 18:19:00 -04:00
drm_cache.c
drm_client_event.c drm/client: Make client support optional 2024-10-18 09:23:03 +02:00
drm_client_modeset.c drm/client: Handle tiled displays better 2025-01-21 11:41:05 +01:00
drm_client.c drm/client: Move client event handlers to drm_client_event.c 2024-10-18 09:23:03 +02:00
drm_color_mgmt.c minmax: add a few more MIN_T/MAX_T users 2024-07-28 13:41:14 -07:00
drm_connector.c Linux 6.13 2025-01-23 14:42:21 +01:00
drm_crtc_helper_internal.h
drm_crtc_helper.c
drm_crtc_internal.h drm/panic: Add a QR code panic screen 2024-08-23 16:55:35 +02:00
drm_crtc.c
drm_damage_helper.c
drm_debugfs_crc.c
drm_debugfs.c drm/client: Make client support optional 2024-10-18 09:23:03 +02:00
drm_displayid_internal.h
drm_displayid.c drm/edid: reduce DisplayID log spamming 2024-08-14 10:19:09 +03:00
drm_draw_internal.h drm/panic: Move drawing functions to drm_draw 2024-12-10 14:36:41 +01:00
drm_draw.c drm/panic: Move drawing functions to drm_draw 2024-12-10 14:36:41 +01:00
drm_drv.c drm/drv: Add drmm managed registration helper for dmem cgroups. 2025-01-06 17:25:35 +01:00
drm_dumb_buffers.c
drm_edid_load.c
drm_edid.c drm/connector: add mutex to protect ELD from concurrent access 2024-12-16 18:02:07 +02:00
drm_eld.c
drm_encoder_slave.c
drm_encoder.c
drm_exec.c mm: kvmalloc: align kvrealloc() with krealloc() 2024-09-01 20:25:44 -07:00
drm_fb_dma_helper.c
drm_fb_helper.c drm/modeset: Handle tiled displays in pan_display_atomic. 2025-01-21 11:39:34 +01:00
drm_fbdev_dma.c Backmerge v6.12-rc6 of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into drm-next 2024-11-04 14:25:33 +10:00
drm_fbdev_shmem.c drm/fbdev-shmem: Remove obsolete setup function 2024-09-26 09:31:28 +02:00
drm_fbdev_ttm.c drm/fbdev-ttm: Remove obsolete setup function 2024-09-26 09:31:29 +02:00
drm_file.c drm: make drm-active- stats optional 2024-12-19 16:56:17 +01:00
drm_flip_work.c
drm_format_helper.c
drm_fourcc.c drm/fbdev-helper: Move color-mode lookup into 4CC format helper 2024-09-26 08:27:49 +02:00
drm_framebuffer.c - The series "resource: A couple of cleanups" from Andy Shevchenko 2024-11-25 16:09:48 -08:00
drm_gem_atomic_helper.c
drm_gem_dma_helper.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
drm_gem_framebuffer_helper.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
drm_gem_shmem_helper.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
drm_gem_ttm_helper.c
drm_gem_vram_helper.c drm/gem-vram: Remove support for simple display pipelines 2024-09-06 14:41:38 +02:00
drm_gem.c drm/gem: Create a drm_gem_object_init_with_mnt() function 2024-09-25 08:40:20 -03:00
drm_gpuvm.c
drm_internal.h drm/client: Make client support optional 2024-10-18 09:23:03 +02:00
drm_ioc32.c
drm_ioctl.c drm: add DRM_SET_CLIENT_NAME ioctl 2024-10-08 10:00:30 +02:00
drm_kms_helper_common.c
drm_lease.c
drm_managed.c drm/managed: Simplify if condition 2024-07-03 10:11:03 +02:00
drm_mipi_dbi.c
drm_mipi_dsi.c drm/mipi-dsi: fix kernel doc on mipi_dsi_compression_mode_multi 2024-10-10 14:22:43 +02:00
drm_mm.c drm/mm: annotate drm_mm_node_scanned_block() with __maybe_unused 2024-09-04 12:15:46 +03:00
drm_mode_config.c drm/connector: Add FIXME for GETRESOURCES ioctl wrt. uninited connectors 2024-12-17 15:43:04 +02:00
drm_mode_object.c drm/tests: Add test for drm_framebuffer_free() 2024-09-11 14:17:11 +02:00
drm_modes.c Linux 6.13-rc6 2025-01-10 14:24:17 +10:00
drm_modeset_helper.c drm/client: Move suspend/resume into DRM client callbacks 2024-10-18 09:23:03 +02:00
drm_modeset_lock.c
drm_of.c gpu: drm: replace of_graph_get_next_endpoint() 2024-11-12 13:05:35 +01:00
drm_panel_backlight_quirks.c drm: panel-backlight-quirks: Add Framework 13 glossy and 2.8k panels 2024-11-21 09:28:15 -06:00
drm_panel_orientation_quirks.c drm for 6.13-rc1 2024-11-21 14:56:17 -08:00
drm_panel.c drm: Use of_property_present() for non-boolean properties 2025-01-03 11:17:09 -06:00
drm_panic_qr.rs rust: finish using custom FFI integer types 2024-12-16 21:48:45 +01:00
drm_panic.c drm/panic: Move drawing functions to drm_draw 2024-12-10 14:36:41 +01:00
drm_pci.c
drm_plane_helper.c
drm_plane.c
drm_prime.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
drm_print.c drm/print: add drm_print_hex_dump() 2024-12-10 14:08:40 +02:00
drm_privacy_screen_x86.c
drm_privacy_screen.c
drm_probe_helper.c drm/client: Move client event handlers to drm_client_event.c 2024-10-18 09:23:03 +02:00
drm_property.c
drm_rect.c drm: Fix kerneldoc for "Returns" section 2024-08-26 16:40:09 +02:00
drm_self_refresh_helper.c
drm_simple_kms_helper.c
drm_suballoc.c
drm_syncobj.c fdget(), trivial conversions 2024-11-03 01:28:06 -05:00
drm_sysfs.c
drm_trace_points.c
drm_trace.h
drm_vblank_work.c treewide: Introduce kthread_run_worker[_on_cpu]() 2025-01-08 18:15:03 +01:00
drm_vblank.c drm: Fix kerneldoc for "Returns" section 2024-08-26 16:40:09 +02:00
drm_vma_manager.c
drm_writeback.c drm/writeback: remove pointless enable_signaling implementation 2024-10-09 14:23:37 +02:00
Kconfig Merge remote-tracking branch 'drm-misc/drm-misc-next-fixes' into drm-misc-fixes 2025-02-06 09:59:35 +01:00
Makefile drm/panic: Move drawing functions to drm_draw 2024-12-10 14:36:41 +01:00