linux_dsm_epyc7002/drivers/gpu/drm/i915
Chris Wilson b01720bfcd drm/i915: Prefault before locking pages in shmem_pwrite
If the user passes in a pointer to a GGTT mmaping of the same buffer
being written to, we can hit a deadlock in acquiring the shmemfs page
(once as the write destination and then as the read source).

[<0>] io_schedule+0xd/0x30
[<0>] __lock_page+0x105/0x1b0
[<0>] find_lock_entry+0x55/0x90
[<0>] shmem_getpage_gfp+0xbb/0x800
[<0>] shmem_read_mapping_page_gfp+0x2d/0x50
[<0>] shmem_get_pages+0x158/0x5d0 [i915]
[<0>] ____i915_gem_object_get_pages+0x17/0x90 [i915]
[<0>] __i915_gem_object_get_pages+0x57/0x70 [i915]
[<0>] i915_gem_fault+0x1b4/0x5c0 [i915]
[<0>] __do_fault+0x2d/0x80
[<0>] __handle_mm_fault+0xad4/0xfb0
[<0>] handle_mm_fault+0xe6/0x1f0
[<0>] __do_page_fault+0x18f/0x3f0
[<0>] page_fault+0x1b/0x20
[<0>] copy_user_enhanced_fast_string+0x7/0x10
[<0>] _copy_from_user+0x37/0x60
[<0>] shmem_pwrite+0xf0/0x160 [i915]
[<0>] i915_gem_pwrite_ioctl+0x14e/0x520 [i915]
[<0>] drm_ioctl_kernel+0x81/0xd0
[<0>] drm_ioctl+0x1a7/0x310
[<0>] do_vfs_ioctl+0x88/0x5d0
[<0>] ksys_ioctl+0x35/0x70
[<0>] __x64_sys_ioctl+0x11/0x20
[<0>] do_syscall_64+0x39/0xe0
[<0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

We can reduce (but not eliminate!) the chance of this happening by
faulting the user_data before we take the page lock in
pagecache_write_begin(). One way to eliminate the potential recursion
here is by disabling pagefaults for the copy, and handling the fallback
to use an alternative method -- so convert to use kmap_atomic (which
should disable preemption and pagefaulting for the copy) and report
ENODEV instead of EFAULT so that our caller tries again with a different
copy mechanism -- we already check that the page should have been
faultable so a false negative should be rare.

Testcase: igt/gem_pwrite/self
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190401133909.31203-1-chris@chris-wilson.co.uk
2019-04-02 14:28:10 +01:00
..
gvt drm/i915: take a reference to uncore in the engine and use it 2019-03-26 20:20:40 +00:00
selftests drm/i915: switch intel_uncore_forcewake_for_reg to intel_uncore 2019-03-26 20:16:31 +00:00
dvo_ch7xxx.c
dvo_ch7017.c
dvo_ivch.c
dvo_ns2501.c
dvo_sil164.c
dvo_tfp410.c
dvo.h drm/i915: drop all drmP.h includes 2019-01-09 10:26:36 +02:00
i915_active_types.h drm/i915: Pull i915_gem_active into the i915_active family 2019-02-05 17:20:11 +00:00
i915_active.c drm/i915: Protect i915_active iterators from the shrinker 2019-03-08 09:52:29 -08:00
i915_active.h drm/i915: Remove has-kernel-context 2019-03-08 10:57:12 +00:00
i915_cmd_parser.c drm/i915: Store the BIT(engine->id) as the engine's mask 2019-03-05 18:19:50 +00:00
i915_debugfs.c drm/i915: Always backoff after a drm_modeset_lock() deadlock 2019-03-29 22:07:59 +00:00
i915_drv.c drm/i915: Introduce concept of a sub-platform 2019-04-01 17:15:31 +01:00
i915_drv.h drm/i915: Introduce concept of a sub-platform 2019-04-01 17:15:31 +01:00
i915_fixed.h
i915_gem_batch_pool.c
i915_gem_batch_pool.h
i915_gem_clflush.c
i915_gem_clflush.h
i915_gem_context_types.h drm/i915: Allow contexts to share a single timeline across all engines 2019-03-22 13:12:38 +00:00
i915_gem_context.c drm/i915: Avoid using ctx->file_priv during construction 2019-03-31 08:38:01 +01:00
i915_gem_context.h drm/i915: Create/destroy VM (ppGTT) for use with contexts 2019-03-22 13:12:32 +00:00
i915_gem_dmabuf.c drm/i915: Flush pages on acquisition 2019-03-21 17:28:12 +00:00
i915_gem_evict.c drm/i915: Remove has-kernel-context 2019-03-08 10:57:12 +00:00
i915_gem_execbuffer.c drm/i915: Flush pages on acquisition 2019-03-21 17:28:12 +00:00
i915_gem_fence_reg.c drm/i915: Switch to bitmap_zalloc() 2019-03-20 17:50:35 +00:00
i915_gem_fence_reg.h drm/i915: Remove GPU reset dependence on struct_mutex 2019-01-25 14:27:22 +00:00
i915_gem_gtt.c drm/i915: Create/destroy VM (ppGTT) for use with contexts 2019-03-22 13:12:32 +00:00
i915_gem_gtt.h drm/i915: Create/destroy VM (ppGTT) for use with contexts 2019-03-22 13:12:32 +00:00
i915_gem_internal.c drm/i915: Make object/vma allocation caches global 2019-02-28 11:08:02 +00:00
i915_gem_object.c drm/i915: Use i915_global_register() 2019-03-06 10:00:50 +00:00
i915_gem_object.h drm/i915: Check domains for userptr on release 2019-03-31 12:46:52 +01:00
i915_gem_render_state.c drm/i915: Flush pages on acquisition 2019-03-21 17:28:12 +00:00
i915_gem_render_state.h
i915_gem_shrinker.c drm/i915: Pull VM lists under the VM mutex. 2019-01-28 16:24:13 +00:00
i915_gem_stolen.c drm/i915: Make object/vma allocation caches global 2019-02-28 11:08:02 +00:00
i915_gem_tiling.c drm/i915: Switch to bitmap_zalloc() 2019-03-20 17:50:35 +00:00
i915_gem_userptr.c drm/i915: Check domains for userptr on release 2019-03-31 12:46:52 +01:00
i915_gem.c drm/i915: Prefault before locking pages in shmem_pwrite 2019-04-02 14:28:10 +01:00
i915_gem.h drm/i915: Always kick the execlists tasklet after reset 2019-03-15 10:58:23 +00:00
i915_gemfs.c
i915_gemfs.h
i915_globals.c drm/i915: Move over to intel_context_lookup() 2019-03-08 13:59:52 +00:00
i915_globals.h drm/i915: Move over to intel_context_lookup() 2019-03-08 13:59:52 +00:00
i915_gpu_error.c drm/i915: Introduce concept of a sub-platform 2019-04-01 17:15:31 +01:00
i915_gpu_error.h drm/i915: Stop storing ctx->user_handle 2019-03-21 15:59:29 +00:00
i915_ioc32.c drm: Split out drm_probe_helper.h 2019-01-24 13:20:42 +01:00
i915_irq.c drm/i915: Use vblank_disable_immediate on gen2 2019-03-25 08:40:20 +02:00
i915_memcpy.c
i915_mm.c
i915_oa_bdw.c
i915_oa_bdw.h
i915_oa_bxt.c
i915_oa_bxt.h
i915_oa_cflgt2.c
i915_oa_cflgt2.h
i915_oa_cflgt3.c
i915_oa_cflgt3.h
i915_oa_chv.c
i915_oa_chv.h
i915_oa_cnl.c
i915_oa_cnl.h
i915_oa_glk.c
i915_oa_glk.h
i915_oa_hsw.c
i915_oa_hsw.h
i915_oa_icl.c
i915_oa_icl.h
i915_oa_kblgt2.c
i915_oa_kblgt2.h
i915_oa_kblgt3.c
i915_oa_kblgt3.h
i915_oa_sklgt2.c
i915_oa_sklgt2.h
i915_oa_sklgt3.c
i915_oa_sklgt3.h
i915_oa_sklgt4.c
i915_oa_sklgt4.h
i915_params.c drm/i915: Enable fastboot by default on Skylake and newer 2019-01-29 10:41:58 +01:00
i915_params.h drm/i915: Enable fastboot by default on Skylake and newer 2019-01-29 10:41:58 +01:00
i915_pci.c drm/i915: Introduce concept of a sub-platform 2019-04-01 17:15:31 +01:00
i915_perf.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
i915_pmu.c Merge drm/drm-next into drm-intel-next-queued 2019-03-27 18:23:53 +02:00
i915_pmu.h Merge back earlier PM core material for v5.1. 2019-02-24 21:20:27 +01:00
i915_pvinfo.h drm/i915: Mark up vGPU support for full-ppgtt 2019-03-15 09:04:54 +00:00
i915_query.c drm/i915/query: Split out query item checks 2019-02-26 10:32:57 +00:00
i915_query.h
i915_reg.h drm/i915: Program EXT2 GC MAX registers 2019-03-29 20:28:35 +02:00
i915_request.c drm/i915: Allow contexts to share a single timeline across all engines 2019-03-22 13:12:38 +00:00
i915_request.h drm/i915: Allow contexts to share a single timeline across all engines 2019-03-22 13:12:38 +00:00
i915_reset.c drm/i915: take a reference to uncore in the engine and use it 2019-03-26 20:20:40 +00:00
i915_reset.h drm/i915: Beware temporary wedging when determining -EIO 2019-02-20 16:31:08 +00:00
i915_scheduler.c drm/i915: Reacquire priolist cache after dropping the engine lock 2019-03-08 09:52:36 -08:00
i915_scheduler.h drm/i915: Use i915_global_register() 2019-03-06 10:00:50 +00:00
i915_selftest.h drm/i915/selftests: Apply a subtest filter 2019-01-29 19:59:57 +00:00
i915_suspend.c drm/i915: Rename HAS_GMCH 2019-02-05 09:43:23 -08:00
i915_sw_fence.c drm/i915: Allow contexts to share a single timeline across all engines 2019-03-22 13:12:38 +00:00
i915_sw_fence.h drm/i915: Allow contexts to share a single timeline across all engines 2019-03-22 13:12:38 +00:00
i915_syncmap.c
i915_syncmap.h
i915_sysfs.c drm/i915: Syntatic sugar for using intel_runtime_pm 2019-01-14 16:18:25 +00:00
i915_timeline_types.h drm/i915: Stop storing the context name as the timeline name 2019-03-21 15:59:31 +00:00
i915_timeline.c drm/i915: Stop storing the context name as the timeline name 2019-03-21 15:59:31 +00:00
i915_timeline.h drm/i915: Stop storing the context name as the timeline name 2019-03-21 15:59:31 +00:00
i915_trace_points.c
i915_trace.h drm/i915: Remove i915_request.global_seqno 2019-02-26 09:55:37 +00:00
i915_user_extensions.c drm/i915: Introduce the i915_user_extension_method 2019-03-22 13:12:30 +00:00
i915_user_extensions.h drm/i915: Introduce the i915_user_extension_method 2019-03-22 13:12:30 +00:00
i915_utils.h Merge drm/drm-next into drm-intel-next-queued 2019-03-27 18:23:53 +02:00
i915_vgpu.c drm/i915: rename raw reg access functions 2019-03-26 19:15:15 +00:00
i915_vgpu.h drm/i915: Mark up vGPU support for full-ppgtt 2019-03-15 09:04:54 +00:00
i915_vma.c drm/i915: Use i915_global_register() 2019-03-06 10:00:50 +00:00
i915_vma.h drm/i915: Use i915_global_register() 2019-03-06 10:00:50 +00:00
icl_dsi.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_acpi.c drm/i915: drop all drmP.h includes 2019-01-09 10:26:36 +02:00
intel_atomic_plane.c Add support for Y21x and Y41x to drm core and i915, and P01x support to i915. 2019-03-11 13:11:37 +02:00
intel_atomic.c Add support for floating point half-width formats. 2019-03-13 14:08:05 -04:00
intel_audio.c drm next pull request for 5.1 2019-03-08 08:23:15 -08:00
intel_bios.c drm/i915/bios: iterate over child devices to initialize ddi_port_info 2019-03-25 15:16:33 +02:00
intel_bios.h
intel_breadcrumbs.c drm/i915: Acquire breadcrumb ref before cancelling 2019-03-08 09:52:48 -08:00
intel_cdclk.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_color.c drm/i915: Program EXT2 GC MAX registers 2019-03-29 20:28:35 +02:00
intel_combo_phy.c
intel_connector.c Merge drm/drm-next into drm-intel-next-queued 2019-03-27 18:23:53 +02:00
intel_context_types.h drm/i915: Hold a reference to the active HW context 2019-03-19 08:21:13 +00:00
intel_context.c drm/i915: Hold a reference to the active HW context 2019-03-19 08:21:13 +00:00
intel_context.h drm/i915: Hold a reference to the active HW context 2019-03-19 08:21:13 +00:00
intel_crt.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_csr.c drm/i915/ehl: Add Support for DMC on EHL 2019-03-22 12:51:08 -07:00
intel_ddi.c drm/i915: Update TRANS_MSA_MISC for fastsets 2019-03-27 15:30:57 +02:00
intel_device_info.c drm/i915: Introduce concept of a sub-platform 2019-04-01 17:15:31 +01:00
intel_device_info.h drm/i915: Introduce concept of a sub-platform 2019-04-01 17:15:31 +01:00
intel_display.c Merge drm/drm-next into drm-intel-next-queued 2019-03-27 18:23:53 +02:00
intel_display.h drm next pull request for 5.1 2019-03-08 08:23:15 -08:00
intel_dp_aux_backlight.c
intel_dp_link_training.c drm/i915/dp: switch to kernel types 2019-01-17 09:02:06 +02:00
intel_dp_mst.c drm/i915: Add max_bpc property for DP MST 2019-03-27 15:30:37 +02:00
intel_dp.c drm/i915: Remove the 8bpc shackles from DP MST 2019-03-27 15:29:20 +02:00
intel_dpio_phy.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_dpll_mgr.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_dpll_mgr.h drm/i915: Nuke icl_calc_dp_combo_pll_link() 2019-03-19 12:57:55 +02:00
intel_drv.h Merge drm/drm-next into drm-intel-next-queued 2019-03-27 18:23:53 +02:00
intel_dsi_dcs_backlight.c
intel_dsi_vbt.c drm/i915: Adjust DSI fixed mode handling 2019-03-22 18:41:39 +02:00
intel_dsi.c
intel_dsi.h drm/i915: Adjust DSI fixed mode handling 2019-03-22 18:41:39 +02:00
intel_dvo.c - Unwind failure on pinning the gen7 PPGTT (Chris) 2019-01-24 19:44:16 +10:00
intel_engine_cs.c drm/i915: take a reference to uncore in the engine and use it 2019-03-26 20:20:40 +00:00
intel_engine_types.h drm/i915: take a reference to uncore in the engine and use it 2019-03-26 20:20:40 +00:00
intel_fbc.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_fbdev.c Linux 5.0 2019-03-04 12:02:55 +10:00
intel_fifo_underrun.c drm/i915: Rename HAS_GMCH 2019-02-05 09:43:23 -08:00
intel_frontbuffer.c drm/i915: drop all drmP.h includes 2019-01-09 10:26:36 +02:00
intel_frontbuffer.h
intel_gpu_commands.h drm/i915: Use HW semaphores for inter-engine synchronisation on gen8+ 2019-03-01 17:45:07 +00:00
intel_guc_ads.c drm/i915: Track the pinned kernel contexts on each engine 2019-03-08 14:00:02 +00:00
intel_guc_ads.h
intel_guc_ct.c drm/i915/guc: Support for extended GuC notification messages 2019-03-24 11:31:47 +00:00
intel_guc_ct.h drm/i915/guc: Splitting CT channel open/close functions 2019-02-20 23:53:04 +00:00
intel_guc_fw.c drm/i915: use intel_uncore for all forcewake get/put 2019-03-20 21:12:31 +00:00
intel_guc_fw.h
intel_guc_fwif.h
intel_guc_log.c drm/i915/guc: Flush the residual log capture irq on disabling 2019-02-22 11:25:32 +00:00
intel_guc_log.h
intel_guc_reg.h
intel_guc_submission.c drm/i915: Switch to use HWS indices rather than addresses 2019-03-18 20:55:28 +00:00
intel_guc_submission.h
intel_guc.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_guc.h drm/i915/guc: Support for extended GuC notification messages 2019-03-24 11:31:47 +00:00
intel_gvt.c drm/i915: Enable gfx virtualization for Coffeelake platform 2019-01-10 11:38:34 +08:00
intel_gvt.h
intel_hangcheck.c drm/i915: take a reference to uncore in the engine and use it 2019-03-26 20:20:40 +00:00
intel_hdcp.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_hdmi.c Merge drm/drm-next into drm-intel-next-queued 2019-03-27 18:23:53 +02:00
intel_hotplug.c drm/i915: Rename HAS_GMCH 2019-02-05 09:43:23 -08:00
intel_huc_fw.c drm/i915: intel_wait_for_register_fw to uncore 2019-03-26 20:16:45 +00:00
intel_huc_fw.h
intel_huc.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_huc.h
intel_i2c.c drm/i915: intel_wait_for_register_fw to uncore 2019-03-26 20:16:45 +00:00
intel_lpe_audio.c drm: Split out drm_probe_helper.h 2019-01-24 13:20:42 +01:00
intel_lrc_reg.h
intel_lrc.c drm/i915: Disable semaphore on vGPU for now 2019-03-27 15:13:28 +00:00
intel_lrc.h drm/i915: take a reference to uncore in the engine and use it 2019-03-26 20:20:40 +00:00
intel_lspcon.c drm/i915: Read out HDMI infoframes 2019-02-26 19:54:48 +02:00
intel_lvds.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_mocs.c drm/i915/gen11+: First assume next platforms will inherit stuff 2019-03-13 13:00:24 -07:00
intel_mocs.h drm/i915: drop all drmP.h includes 2019-01-09 10:26:36 +02:00
intel_opregion.c Linux 5.0-rc7 2019-02-18 13:27:15 +10:00
intel_opregion.h
intel_overlay.c drm/i915: Store the BIT(engine->id) as the engine's mask 2019-03-05 18:19:50 +00:00
intel_panel.c drm/i915: Clean up EDID downclock mode lookup 2019-03-22 18:41:39 +02:00
intel_pipe_crc.c drm/i915: stick to kernel fixed size types 2019-03-19 09:49:07 +02:00
intel_pm.c drm/i915: Split Pineview device info into desktop and mobile 2019-04-01 17:15:14 +01:00
intel_psr.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_quirks.c
intel_renderstate_gen6.c
intel_renderstate_gen7.c
intel_renderstate_gen8.c
intel_renderstate_gen9.c
intel_renderstate.h
intel_ringbuffer.c drm/i915: fix i9xx irq enable/disable 2019-03-29 17:59:12 +00:00
intel_ringbuffer.h drm/i915: take a reference to uncore in the engine and use it 2019-03-26 20:20:40 +00:00
intel_runtime_pm.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_sdvo_regs.h
intel_sdvo.c drm/i915/sdvo: Read out HDMI infoframes 2019-02-26 19:54:48 +02:00
intel_sideband.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
intel_sprite.c drm/i915: Reject rotation for some hdr formats 2019-03-27 17:53:30 +01:00
intel_tv.c drm/i915/tv: Bypass the vertical filter if possible 2019-01-29 23:27:31 +02:00
intel_uc_fw.c drm/i915: Downgrade scare message for unknown HuC firmware 2019-01-08 22:41:09 +00:00
intel_uc_fw.h
intel_uc.c drm/i915/guc: Retry GuC load for all load failures 2019-03-30 08:02:07 +00:00
intel_uc.h drm/i915/guc: Calling guc_disable_communication in all suspend paths 2019-02-20 23:53:21 +00:00
intel_uncore.c drm/i915: move the edram detection out of uncore init 2019-03-29 11:18:41 +00:00
intel_uncore.h drm/i915: move the edram detection out of uncore init 2019-03-29 11:18:41 +00:00
intel_vbt_defs.h drm/i915/vbt: Parse and use the new field with PSR2 TP2/3 wakeup time 2019-03-13 14:20:19 -07:00
intel_vdsc.c drm/dsc: Split DSC PPS and SDP header initialisations 2019-03-05 13:24:34 -05:00
intel_wopcm.c
intel_wopcm.h
intel_workarounds_types.h drm/i915: Split struct intel_context definition to its own header 2019-03-08 13:59:44 +00:00
intel_workarounds.c drm/i915: switch intel_uncore_forcewake_for_reg to intel_uncore 2019-03-26 20:16:31 +00:00
intel_workarounds.h drm/i915: Split struct intel_context definition to its own header 2019-03-08 13:59:44 +00:00
Kconfig
Kconfig.debug drm/i915: Track all held rpm wakerefs 2019-01-14 16:17:50 +00:00
Makefile drm/i915: Introduce the i915_user_extension_method 2019-03-22 13:12:30 +00:00
test_i915_active_types_standalone.c drm/i915: Split struct intel_context definition to its own header 2019-03-08 13:59:44 +00:00
test_i915_gem_context_types_standalone.c drm/i915: Split struct intel_context definition to its own header 2019-03-08 13:59:44 +00:00
test_i915_timeline_types_standalone.c drm/i915: Split struct intel_context definition to its own header 2019-03-08 13:59:44 +00:00
test_intel_context_types_standalone.c drm/i915: Split struct intel_context definition to its own header 2019-03-08 13:59:44 +00:00
test_intel_engine_types_standalone.c drm/i915: Split struct intel_context definition to its own header 2019-03-08 13:59:44 +00:00
test_intel_workarounds_types_standalone.c drm/i915: Split struct intel_context definition to its own header 2019-03-08 13:59:44 +00:00
vlv_dsi_pll.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00
vlv_dsi.c drm/i915: switch intel_wait_for_register to uncore 2019-03-26 20:20:24 +00:00