linux-sg2042/drivers/media/platform/s5p-fimc
Sylwester Nawrocki 740ad921f8 [media] s5p-fimc: Prevent AB-BA deadlock during links reconfiguration
This patch patch eliminates potential AB-BA deadlock when one process calls
open(), or VIDIOC_S/TRY_FMT ioctl  on the FIMC capture video node, while
other thread is reconfiguring media links via media device node:
/dev/video? open()		  /dev/media? MEDIA_IOC_SETUP_LINK ioctl
mutex_lock(video_lock)            mutex_lock(graph_lock)
    fimc_pipeline_open()               fimc_md_link_notify()
        mutex_lock(graph_lock)	          mutex_lock(video_lock)
          ...                               ...
The deadlock is avoided by always taking the graph mutex first in video
node open() or an ioctl, before the video lock is acquired. Reversed
order seems impossible, since media device driver's link_notify callback
is called with media graph mutex already held.
To ensure proper locking order VIDIOC_S_FMT and VIDIOC_TRY_FMT ioctls are
not serialized in the v4l2-core and the driver takes care of it itself.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 09:26:20 -02:00
..
Kconfig [media] s5p-csis: Select S5P_SETUP_MIPIPHY 2012-10-25 14:42:16 -02:00
Makefile [media] rename drivers/media/video as .../platform 2012-08-15 16:43:09 -03:00
fimc-capture.c [media] s5p-fimc: Prevent AB-BA deadlock during links reconfiguration 2013-01-06 09:26:20 -02:00
fimc-core.c [media] s5p-fimc: Add variant data structure for Exynos4x12 2012-12-21 12:22:34 -02:00
fimc-core.h [media] s5p-fimc: Add variant data structure for Exynos4x12 2012-12-21 12:22:34 -02:00
fimc-lite-reg.c [media] fimc-lite: Register dump function cleanup 2012-12-21 12:19:28 -02:00
fimc-lite-reg.h [media] rename drivers/media/video as .../platform 2012-08-15 16:43:09 -03:00
fimc-lite.c [media] s5p-fimc: Prevent AB-BA deadlock during links reconfiguration 2013-01-06 09:26:20 -02:00
fimc-lite.h [media] fimc-lite: Add ISP FIFO output support 2012-12-21 12:26:20 -02:00
fimc-m2m.c [media] s5p-fimc: Add variant data structure for Exynos4x12 2012-12-21 12:22:34 -02:00
fimc-mdevice.c [media] s5p-fimc: Prevent AB-BA deadlock during links reconfiguration 2013-01-06 09:26:20 -02:00
fimc-mdevice.h [media] s5p-fimc: Add sensor group ids for fimc-is 2012-12-21 12:25:57 -02:00
fimc-reg.c [media] s5p-fimc: Add variant data structure for Exynos4x12 2012-12-21 12:22:34 -02:00
fimc-reg.h [media] s5p-fimc: Clean up capture enable/disable helpers 2012-12-21 12:21:43 -02:00
mipi-csis.c [media] s5p-fimc: convert struct spinlock to spinlock_t 2012-12-27 14:59:12 -02:00
mipi-csis.h [media] rename drivers/media/video as .../platform 2012-08-15 16:43:09 -03:00