Re: [PATCH v7 00/16] media: cadence,ti: CSI2RX Multistream Support
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date: 2025-09-24 09:33:59
Also in:
linux-media, lkml
Hi, On 11/09/2025 13:28, Rishikesh Donadkar wrote:
This series adds multi-stream support and PM support for Cadence CSI2RX and TI CSI2RX SHIM drivers. PM patches are picked from: https://lore.kernel.org/all/20250902-ti_csi_pm-v2-0-59a3be199940@ideasonboard.com/ (local) PATCH 01 : Remove word size alignment restriction on frame width PATCH 02-07: Support multiple DMA contexts/video nodes in TI CSI2RX PATCH 08-09: Use get_frame_desc to propagate virtual channel information across Cadence and TI CSI-RX subdevs PATCH 10-11: Use new multi-stream APIs across the drivers to support multiplexed cameras from sources like UB960 (FPDLink) PATCH 12: Optimize stream on by submitting all queued buffers to DMA PATCH 13: Change the drain architecture to support multi-stream and implement completion barriers for last drain. PATCH 14-16: Runtime PM and System PM support for CSI-RX. Testing for this series has been done on top of media tree with 4x IMX219 camera modules connected to TI's AM62A using V3 Link fusion mini board. Overlay and defconfig changes for the same can be found below: https://github.com/RISHI27-dot/linux/commits/u/multistream_v7/
I made a quick test with this branch, am62a-sk with fpdlink, but:
[ 214.387480] ======================================================
[ 214.393648] WARNING: possible circular locking dependency detected
[ 214.399817] 6.17.0-rc1+ #1 Not tainted
[ 214.403557] ------------------------------------------------------
[ 214.409723] python3/408 is trying to acquire lock:
[ 214.414506] ffff0008079e00f8 (&csi->mutex){+.+.}-{4:4}, at:
ti_csi2rx_sd_enable_streams+0x80/0xc0 [j721e_csi2rx]
[ 214.424701]
[ 214.424701] but task is already holding lock:
[ 214.430520] ffff000803de5568
(j721e_csi2rx:1471:sd->active_state->lock){+.+.}-{4:4}, at:
v4l2_subdev_enable_streams+0xc0/0x
3a0 [videodev]
[ 214.442977]
[ 214.442977] which lock already depends on the new lock.
[ 214.442977]
[ 214.451135]
[ 214.451135] the existing dependency chain (in reverse order) is:
[ 214.458601]
[ 214.458601] -> #1 (j721e_csi2rx:1471:sd->active_state->lock){+.+.}-{4:4}:
[ 214.466864] __mutex_lock+0xc8/0x8a8
[ 214.470959] mutex_lock_nested+0x2c/0x40
[ 214.475395] ti_csi2rx_get_route+0x50/0xe8 [j721e_csi2rx]
[ 214.481312] ti_csi2rx_get_vc.isra.0+0xe4/0x1b8 [j721e_csi2rx]
[ 214.487661] ti_csi2rx_start_streaming+0xe8/0x250 [j721e_csi2rx]
[ 214.494182] vb2_start_streaming+0x74/0x190 [videobuf2_common]
[ 214.500552] vb2_core_streamon+0x108/0x1d8 [videobuf2_common]
[ 214.506829] vb2_ioctl_streamon+0x54/0xa0 [videobuf2_v4l2]
[ 214.512842] v4l_streamon+0x2c/0x40 [videodev]
[ 214.517890] __video_do_ioctl+0x2e0/0x3d8 [videodev]
[ 214.523447] video_usercopy+0x310/0x870 [videodev]
[ 214.528831] video_ioctl2+0x20/0x38 [videodev]
[ 214.533869] v4l2_ioctl+0x48/0x70 [videodev]
[ 214.538730] __arm64_sys_ioctl+0xb4/0x118
[ 214.543259] invoke_syscall+0x50/0x120
[ 214.547524] el0_svc_common.constprop.0+0x48/0xf0
[ 214.552740] do_el0_svc+0x24/0x38
[ 214.556570] el0_svc+0x4c/0x178
[ 214.560229] el0t_64_sync_handler+0xa0/0xe8
[ 214.564926] el0t_64_sync+0x1a4/0x1a8
[ 214.569104]
[ 214.569104] -> #0 (&csi->mutex){+.+.}-{4:4}:
[ 214.574855] __lock_acquire+0x136c/0x1f78
[ 214.579381] lock_acquire+0x250/0x350
[ 214.583557] __mutex_lock+0xc8/0x8a8
[ 214.587647] mutex_lock_nested+0x2c/0x40
[ 214.592082] ti_csi2rx_sd_enable_streams+0x80/0xc0 [j721e_csi2rx]
[ 214.598694] v4l2_subdev_enable_streams+0x208/0x3a0 [videodev]
[ 214.605128] ti_csi2rx_start_streaming+0x158/0x250 [j721e_csi2rx]
[ 214.611738] vb2_start_streaming+0x74/0x190 [videobuf2_common]
[ 214.618107] vb2_core_streamon+0x108/0x1d8 [videobuf2_common]
[ 214.624383] vb2_ioctl_streamon+0x54/0xa0 [videobuf2_v4l2]
[ 214.630395] v4l_streamon+0x2c/0x40 [videodev]
[ 214.635436] __video_do_ioctl+0x2e0/0x3d8 [videodev]
[ 214.640994] video_usercopy+0x310/0x870 [videodev]
[ 214.646379] video_ioctl2+0x20/0x38 [videodev]
[ 214.651415] v4l2_ioctl+0x48/0x70 [videodev]
[ 214.656280] __arm64_sys_ioctl+0xb4/0x118
[ 214.660807] invoke_syscall+0x50/0x120
[ 214.665071] el0_svc_common.constprop.0+0x48/0xf0
[ 214.670288] do_el0_svc+0x24/0x38
[ 214.674117] el0_svc+0x4c/0x178
[ 214.677775] el0t_64_sync_handler+0xa0/0xe8
[ 214.682472] el0t_64_sync+0x1a4/0x1a8
[ 214.686649]
[ 214.686649] other info that might help us debug this:
[ 214.686649]
[ 214.694637] Possible unsafe locking scenario:
[ 214.694637]
[ 214.700543] CPU0 CPU1
[ 214.705061] ---- ----
[ 214.709579] lock(j721e_csi2rx:1471:sd->active_state->lock);
[ 214.715320] lock(&csi->mutex);
[ 214.721060]
lock(j721e_csi2rx:1471:sd->active_state->lock);
[ 214.729314] lock(&csi->mutex);
[ 214.732540]
[ 214.732540] *** DEADLOCK ***
[ 214.732540]
[ 214.738447] 2 locks held by python3/408:
[ 214.742361] #0: ffff0008079e18f0 (&ctx->mutex){+.+.}-{4:4}, at:
__video_do_ioctl+0xe8/0x3d8 [videodev]
[ 214.751844] #1: ffff000803de5568
(j721e_csi2rx:1471:sd->active_state->lock){+.+.}-{4:4}, at:
v4l2_subdev_enable_streams+0x
c0/0x3a0 [videodev]
[ 214.764705]
[ 214.764705] stack backtrace:
[ 214.769054] CPU: 2 UID: 0 PID: 408 Comm: python3 Not tainted
6.17.0-rc1+ #1 PREEMPT
[ 214.769064] Hardware name: Texas Instruments AM62A7 SK (DT)
[ 214.769068] Call trace:
[ 214.769073] show_stack+0x20/0x38 (C)
[ 214.769084] dump_stack_lvl+0x8c/0xd0
[ 214.769094] dump_stack+0x18/0x28
[ 214.769102] print_circular_bug+0x28c/0x370
[ 214.769110] check_noncircular+0x170/0x188
[ 214.769117] __lock_acquire+0x136c/0x1f78
[ 214.769125] lock_acquire+0x250/0x350
[ 214.769133] __mutex_lock+0xc8/0x8a8
[ 214.769141] mutex_lock_nested+0x2c/0x40
[ 214.769148] ti_csi2rx_sd_enable_streams+0x80/0xc0 [j721e_csi2rx]
[ 214.769164] v4l2_subdev_enable_streams+0x208/0x3a0 [videodev]
[ 214.769255] ti_csi2rx_start_streaming+0x158/0x250 [j721e_csi2rx]
[ 214.769268] vb2_start_streaming+0x74/0x190 [videobuf2_common]
[ 214.769298] vb2_core_streamon+0x108/0x1d8 [videobuf2_common]
[ 214.769326] vb2_ioctl_streamon+0x54/0xa0 [videobuf2_v4l2]
[ 214.769348] v4l_streamon+0x2c/0x40 [videodev]
[ 214.769438] __video_do_ioctl+0x2e0/0x3d8 [videodev]
[ 214.769528] video_usercopy+0x310/0x870 [videodev]
[ 214.769617] video_ioctl2+0x20/0x38 [videodev]
[ 214.769704] v4l2_ioctl+0x48/0x70 [videodev]
[ 214.769793] __arm64_sys_ioctl+0xb4/0x118
[ 214.769804] invoke_syscall+0x50/0x120
[ 214.769812] el0_svc_common.constprop.0+0x48/0xf0
[ 214.769819] do_el0_svc+0x24/0x38
[ 214.769826] el0_svc+0x4c/0x178
[ 214.769835] el0t_64_sync_handler+0xa0/0xe8
[ 214.769844] el0t_64_sync+0x1a4/0x1a8
Tomi