linux_dsm_epyc7002/drivers/gpu/drm
Chris Wilson cdd1cf799b drm: Make drm_read() more robust against multithreaded races
The current implementation of drm_read() faces a number of issues:

1. Upon an error, it consumes the event which may lead to the client
blocking.
2. Upon an error, it forgets about events already copied
3. If it fails to copy a single event with O_NONBLOCK it falls into a
infinite loop of reporting EAGAIN.
3. There is a race between multiple waiters and blocking reads of the
events list.

Here, we inline drm_dequeue_event() into drm_read() so that we can take
the spinlock around the list walking and event copying, and importantly
reorder the error handling to avoid the issues above.

Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Testcase: igt/drm_read
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-21 14:57:03 +01:00
..
amd drm/amd: Remove old radeon_sa funcs from kfd-->kgd interface 2015-01-09 22:26:11 +02:00
armada Merge tag 'topic/core-stuff-2014-12-19' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-01-09 09:13:41 +10:00
ast drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
bochs drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
bridge imx-drm: encoder prepare/mode_set must use adjusted mode 2015-01-07 19:15:03 +01:00
cirrus drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
exynos drm: Drop superfluous "select VT_HW_CONSOLE_BINDING" 2015-01-21 14:57:02 +01:00
gma500 drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
i2c drm: adv7511: Remove interlaced mode check 2014-12-23 12:01:47 +02:00
i810 drm: move drm_mmap to <drm/drm_legacy.h> 2014-09-24 11:43:07 +10:00
i915 Merge tag 'drm-intel-next-2014-12-19' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-01-10 08:46:24 +10:00
imx imx-drm: core: handling of DI clock flags to ipu_crtc_mode_set() 2015-01-07 21:32:07 +01:00
mga drm: move drm_mmap to <drm/drm_legacy.h> 2014-09-24 11:43:07 +10:00
mgag200 drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
msm drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
nouveau drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
omapdrm drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
panel Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-12-15 15:52:01 -08:00
qxl drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
r128 drm: remove unnecessary sizeof(u8) 2014-11-20 11:30:37 +10:00
radeon drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
rcar-du Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/fbdev into drm-next 2015-01-21 10:16:24 +10:00
rockchip drm: Drop superfluous "select VT_HW_CONSOLE_BINDING" 2015-01-21 14:57:02 +01:00
savage drm: move drm_mmap to <drm/drm_legacy.h> 2014-09-24 11:43:07 +10:00
shmobile Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-12-15 15:52:01 -08:00
sis drm: move drm_mmap to <drm/drm_legacy.h> 2014-09-24 11:43:07 +10:00
sti Merge tag 'topic/core-stuff-2014-12-19' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-01-09 09:13:41 +10:00
tdfx drm: move drm_mmap to <drm/drm_legacy.h> 2014-09-24 11:43:07 +10:00
tegra Merge tag 'topic/core-stuff-2014-12-19' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-01-09 09:13:41 +10:00
tilcdc Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-12-15 15:52:01 -08:00
ttm drm/ttm: optionally move duplicates to a separate list 2014-12-03 18:26:52 -05:00
udl drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
via drm: move drm_mmap to <drm/drm_legacy.h> 2014-09-24 11:43:07 +10:00
vmwgfx drm/ttm: optionally move duplicates to a separate list 2014-12-03 18:26:52 -05:00
ati_pcigart.c drm: split ati_pcigart.h out of drmP.h 2014-09-12 14:11:14 +10:00
drm_agpsupport.c drm: move AGP definitions harder 2014-09-10 17:40:11 +10:00
drm_atomic_helper.c drm/atomic: atomic_check functions 2015-01-05 13:55:27 +01:00
drm_atomic.c drm/atomic: Hide drm.ko internal interfaces 2015-01-05 13:55:30 +01:00
drm_auth.c drm: Move piles of functions from drmP.h to drm_internal.h 2014-09-12 11:16:29 +02:00
drm_bufs.c drm: Move __drm_pci_free to drm_legacy.h 2014-09-12 11:08:56 +02:00
drm_cache.c drm/cache: Use wbinvd helpers 2014-12-16 08:56:55 +01:00
drm_context.c
drm_crtc_helper.c drm/atomic: Introduce state->obj backpointers 2014-12-17 20:23:23 +01:00
drm_crtc_internal.h drm/atomic: Hide drm.ko internal interfaces 2015-01-05 13:55:30 +01:00
drm_crtc.c drm: fix mismerge in drm_crtc.c 2015-01-13 07:38:53 +10:00
drm_debugfs.c drm: Move piles of functions from drmP.h to drm_internal.h 2014-09-12 11:16:29 +02:00
drm_dma.c drm: Move legacy buffer structures to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
drm_dp_helper.c drm/dp: retry AUX transactions 32 times (v1.1) 2014-12-09 09:56:44 +10:00
drm_dp_mst_topology.c drm/tile: expose the tile property to userspace (v3) 2014-12-09 09:56:48 +10:00
drm_drv.c drm: add atomic properties 2015-01-05 13:54:38 +01:00
drm_edid_load.c drm/edid: Deletion of an unnecessary check before the function call "release_firmware" 2014-11-21 12:16:27 +10:00
drm_edid.c Merge tag 'topic/core-stuff-2014-12-10' of git://anongit.freedesktop.org/drm-intel into drm-next 2014-12-11 10:12:57 +10:00
drm_encoder_slave.c
drm_fb_cma_helper.c
drm_fb_helper.c drm/fb-helper: Propagate errors from initial config failure 2015-01-21 14:57:03 +01:00
drm_flip_work.c drm: flip-work: change drm_flip_work_init prototype 2014-11-15 09:29:14 +10:00
drm_fops.c drm: Make drm_read() more robust against multithreaded races 2015-01-21 14:57:03 +01:00
drm_gem_cma_helper.c drm/cma: Remove call to drm_gem_free_mmap_offset() 2014-11-13 13:27:33 +01:00
drm_gem.c drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input 2014-11-15 09:50:21 +10:00
drm_global.c
drm_hashtab.c
drm_info.c drm/info: Remove unused code 2014-12-16 18:44:34 +01:00
drm_internal.h drm/info: Remove unused code 2014-12-16 18:44:34 +01:00
drm_ioc32.c
drm_ioctl.c drm: Ensure universal_planes is set for atomic 2015-01-05 13:55:30 +01:00
drm_irq.c Merge tag 'topic/core-stuff-2014-12-19' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-01-09 09:13:41 +10:00
drm_legacy.h drm: Create drm legacy driver header 2014-09-12 11:08:55 +02:00
drm_lock.c drm: unexport drm_global_mutex 2014-09-12 11:19:47 +02:00
drm_memory.c drm: Move drm_memory.c map support declarations to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
drm_mipi_dsi.c drm/dsi: Do not require .owner field to be set 2014-11-13 13:56:17 +01:00
drm_mm.c
drm_modes.c imx-drm mode fixup support, imx-hdmi bridge conversion and imx-drm cleanup 2015-01-21 10:17:16 +10:00
drm_modeset_lock.c drm: Per-plane locking 2014-11-12 17:56:12 +10:00
drm_of.c
drm_panel.c
drm_pci.c drm: Move legacy buffer structures to <drm/drm_legacy.h> 2014-09-12 15:28:12 +02:00
drm_plane_helper.c Merge branch 'topic/core-stuff' into topic/atomic-core 2014-12-17 20:24:02 +01:00
drm_platform.c drm: Goody bye, drm_bus! 2014-09-10 17:43:10 +10:00
drm_prime.c drm: Miscellaneous fixes for v3.19-rc1 2014-11-15 09:37:20 +10:00
drm_probe_helper.c drm: Perform basic sanity checks on probed modes 2014-12-17 18:29:35 +01:00
drm_rect.c
drm_scatter.c drm: Move sg functions into drm_legacy.h 2014-09-12 11:08:54 +02:00
drm_sysfs.c drm: Move piles of functions from drmP.h to drm_internal.h 2014-09-12 11:16:29 +02:00
drm_trace_points.c
drm_trace.h
drm_vm.c drm: Move drm_vm_open_locked into drm_internal.h 2014-09-24 11:43:20 +10:00
drm_vma_manager.c
Kconfig Merge branch 'drm_iommu_v15' of https://github.com/markyzq/kernel-drm-rockchip into drm-next 2014-12-08 13:45:18 +10:00
Makefile Merge branch 'drm_iommu_v15' of https://github.com/markyzq/kernel-drm-rockchip into drm-next 2014-12-08 13:45:18 +10:00