Err_rec: attempting to reset the capture channel failed

Hello everyone,

Now I am debugging GMSL for camera, the driver run correctly. But when I using slave or trigger mode. The Orin NX show following error, it cannot recovery channel reset.

I was meeting similar problem before. and I solved it using follow patch.

Why does it cause it. Thank you.

BTW, Jetpack version

R35 (release), REVISION: 6.4, GCID: 43803471, BOARD: t186ref, EABI: aarch64, DATE: Tue Jan 27 08:01:21 UTC 2026

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2022 NVIDIA Corporation.  All rights reserved.
+ * Copyright (c) 2016-2023, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -536,9 +536,10 @@ void vi_capture_shutdown(
 			destroy_buffer_table(capture->buf_ctx);
 			capture->buf_ctx = NULL;
 		}
-
-		vfree(capture->unpins_list);
-		capture->unpins_list = NULL;
+		if (capture->unpins_list) {
+			vfree(capture->unpins_list);
+			capture->unpins_list = NULL;
+		}
 	}
 	kfree(capture);
 	chan->capture_data = NULL;
[   71.133466] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   71.142620] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   71.152630] (NULL device *): vi_capture_control_message: NULL VI channel received
[   71.160386] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[   71.171276] (NULL device *): vi_capture_control_message: NULL VI channel received
[   71.179248] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[   73.693490] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   73.702625] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   73.712670] (NULL device *): vi_capture_control_message: NULL VI channel received
[   73.720429] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[   73.731292] (NULL device *): vi_capture_control_message: NULL VI channel received
[   73.739039] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_open: VI channel not found for stream- 0 vc- 1
[   73.749758] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[   76.509509] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   76.518649] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   76.528226] (NULL device *): vi_capture_control_message: NULL VI channel received
[   76.535933] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=0, csi_port=0
[   76.546577] (NULL device *): vi_capture_control_message: NULL VI channel received
[   77.565476] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[   77.573803] tegra194-vi5 13e40000.host1x:vi0@15c00000: vi_capture_control_send_message: failed to send IVC control message
[   78.589329] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[   78.597670] tegra-camrtc-capture-vi tegra-capture-vi: vi capture setup failed
[   78.605014] tegra-camrtc-capture-vi tegra-capture-vi: fatal: error recovery failed
[   85.021937] ------------[ cut here ]------------
[   85.026717] refcount_t: addition on 0; use-after-free.
[   85.026746] WARNING: CPU: 7 PID: 2159 at lib/refcount.c:25 refcount_warn_saturate+0x98/0x140
[   85.035438] Modules linked in: ar0234_dser(E) max96716(E) lzo_rle(E) lzo_compress(E) zram(E) ramoops(E) reed_solomon(E) snd_soc_tegra186_asrc(E) snd_soc_tegra210_admaif(E) snd_soc_tegra186_dspk(E) snd_soc_tegra210_iqc(E) snd_soc_tegra_utils(E) snd_soc_tegra210_ope(E) snd_soc_tegra_pcm(E) snd_soc_tegra210_mvc(E) snd_soc_tegra210_adx(E) snd_soc_tegra186_arad(E) snd_soc_tegra210_amx(E) snd_soc_tegra210_mixer(E) snd_soc_tegra210_afc(E) snd_soc_tegra210_dmic(E) snd_soc_tegra210_i2s(E) snd_soc_tegra210_sfc(E) snd_soc_simple_card_utils(E) aes_ce_blk(E) crypto_simd(E) binfmt_misc(E) cryptd(E) aes_ce_cipher(E) ghash_ce(E) sha2_ce(E) sha256_arm64(E) sha1_ce(E) snd_soc_spdif_tx(E) snd_soc_tegra210_ahub(E) tegra_bpmp_thermal(E) userspace_alert(E) tegra210_adma(E) spi_tegra114(E) ina3221(E) pwm_fan(E) nvgpu(E) nvmap(E) ip_tables(E) x_tables(E) [last unloaded: mtd]
[   85.035552] CPU: 7 PID: 2159 Comm: v4l2-ctl Tainted: G            E     5.10.216-tegra #2
[   85.035556] Hardware name: NVIDIA NVIDIA Jetson Orin NX Engineering Reference Developer Kit Super/Jetson, BIOS 202210.5.3-d86a837d-dirty 03/26/2026
[   85.035561] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[   85.035566] pc : refcount_warn_saturate+0x98/0x140
[   85.035570] lr : refcount_warn_saturate+0x98/0x140
[   85.035572] sp : ffff80001500ba80
[   85.035575] x29: ffff80001500ba80 x28: ffff0a9b1c766740 
[   85.035582] x27: 0000000000000000 x26: 0000ffffb7334b0c 
[   85.035588] x25: ffffb776a8446000 x24: ffff0a9b1c766d40 
[   85.035594] x23: ffff0a9e5a82a1f8 x22: ffff0a9e5a8ee0a0 
[   85.035599] x21: ffff0a9b10936770 x20: ffff0a9e5a82a550 
[   85.035605] x19: ffff0a9b10936740 x18: 0000000000000010 
[   85.035611] x17: 0000000000000000 x16: ffffb776a6a45040 
[   85.035616] x15: ffff0a9b1c766cb0 x14: ffffffffffffffff 
[   85.035622] x13: ffff80009500b6b7 x12: ffff80001500b6c0 
[   85.035628] x11: 000000000010c714 x10: 0000000000000ab0 
[   85.035634] x9 : ffff80001500ba80 x8 : 612d657375203b30 
[   85.035640] x7 : 206e6f206e6f6974 x6 : c0000000ffffefff 
[   85.035645] x5 : ffff0a9e6e94c970 x4 : ffffb776a8757b48 
[   85.035651] x3 : 0000000000000001 x2 : ffff0a9e6e94c978 
[   85.035656] x1 : 0000000000000000 x0 : 0000000000000000 
[   85.035663] Call trace:
[   85.035668]  refcount_warn_saturate+0x98/0x140
[   85.035675]  kthread_stop+0x4c/0x290
[   85.035683]  vi5_channel_stop_kthreads+0x54/0x70
[   85.035688]  vi5_channel_stop_streaming+0xa8/0xb0
[   85.035692]  tegra_channel_stop_streaming+0x3c/0x70
[   85.035697]  __vb2_queue_cancel+0x40/0x220
[   85.035701]  vb2_core_queue_release+0x30/0x60
[   85.035706]  _vb2_fop_release+0x88/0xb0
[   85.035710]  tegra_channel_close+0x68/0x190
[   85.035716]  v4l2_release+0xc0/0x100
[   85.035722]  __fput+0x80/0x260
[   85.035727]  ____fput+0x24/0x30
[   85.035732]  task_work_run+0x88/0xe0
[   85.035739]  do_exit+0x35c/0xb00
[   85.035743]  do_group_exit+0x4c/0xb0
[   85.035748]  get_signal+0x184/0x8c0
[   85.035755]  do_notify_resume+0x18c/0x990
[   85.035759]  work_pending+0xc/0x738
[   85.035763] ---[ end trace 0ae4d7739dc50211 ]---
[   85.040546] ------------[ cut here ]------------
[   85.045325] refcount_t: underflow; use-after-free.
[   85.045343] WARNING: CPU: 7 PID: 2159 at lib/refcount.c:28 refcount_warn_saturate+0xec/0x140
[   85.054033] Modules linked in: ar0234_dser(E) max96716(E) lzo_rle(E) lzo_compress(E) zram(E) ramoops(E) reed_solomon(E) snd_soc_tegra186_asrc(E) snd_soc_tegra210_admaif(E) snd_soc_tegra186_dspk(E) snd_soc_tegra210_iqc(E) snd_soc_tegra_utils(E) snd_soc_tegra210_ope(E) snd_soc_tegra_pcm(E) snd_soc_tegra210_mvc(E) snd_soc_tegra210_adx(E) snd_soc_tegra186_arad(E) snd_soc_tegra210_amx(E) snd_soc_tegra210_mixer(E) snd_soc_tegra210_afc(E) snd_soc_tegra210_dmic(E) snd_soc_tegra210_i2s(E) snd_soc_tegra210_sfc(E) snd_soc_simple_card_utils(E) aes_ce_blk(E) crypto_simd(E) binfmt_misc(E) cryptd(E) aes_ce_cipher(E) ghash_ce(E) sha2_ce(E) sha256_arm64(E) sha1_ce(E) snd_soc_spdif_tx(E) snd_soc_tegra210_ahub(E) tegra_bpmp_thermal(E) userspace_alert(E) tegra210_adma(E) spi_tegra114(E) ina3221(E) pwm_fan(E) nvgpu(E) nvmap(E) ip_tables(E) x_tables(E) [last unloaded: mtd]
[   85.054123] CPU: 7 PID: 2159 Comm: v4l2-ctl Tainted: G        W   E     5.10.216-tegra #2
[   85.054126] Hardware name: NVIDIA NVIDIA Jetson Orin NX Engineering Reference Developer Kit Super/Jetson, BIOS 202210.5.3-d86a837d-dirty 03/26/2026
[   85.054131] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[   85.054134] pc : refcount_warn_saturate+0xec/0x140
[   85.054138] lr : refcount_warn_saturate+0xec/0x140
[   85.054140] sp : ffff80001500ba80
[   85.054143] x29: ffff80001500ba80 x28: ffff0a9b1c766740 
[   85.054148] x27: 0000000000000000 x26: 0000ffffb7334b0c 
[   85.054154] x25: ffffb776a8446000 x24: ffff0a9b1c766d40 
[   85.054160] x23: ffff0a9e5a82a1f8 x22: ffff0a9e5a8ee0a0 
[   85.054166] x21: ffff0a9b10936770 x20: 0000000000000000 
[   85.054171] x19: ffff0a9b10936740 x18: 0000000000000010 
[   85.054177] x17: 0000000000000000 x16: ffffb776a6a45040 
[   85.054182] x15: ffff0a9b1c766cb0 x14: ffffffffffffffff 
[   85.054188] x13: ffff80009500b6b7 x12: ffff80001500b6c0 
[   85.054194] x11: 000000000010c714 x10: 0000000000000000 
[   85.054199] x9 : ffff80001500ba80 x8 : 72657466612d6573 
[   85.054205] x7 : 75203b776f6c6672 x6 : c0000000ffffefff 
[   85.054211] x5 : ffff0a9e6e94c970 x4 : ffffb776a8757b48 
[   85.054216] x3 : 0000000000000001 x2 : ffff0a9e6e94c978 
[   85.054222] x1 : 0000000000000000 x0 : 0000000000000000 
[   85.054227] Call trace:
[   85.054231]  refcount_warn_saturate+0xec/0x140
[   85.054235]  kthread_stop+0x27c/0x290
[   85.054241]  vi5_channel_stop_kthreads+0x54/0x70
[   85.054245]  vi5_channel_stop_streaming+0xa8/0xb0
[   85.054248]  tegra_channel_stop_streaming+0x3c/0x70
[   85.054253]  __vb2_queue_cancel+0x40/0x220
[   85.054258]  vb2_core_queue_release+0x30/0x60
[   85.054262]  _vb2_fop_release+0x88/0xb0
[   85.054266]  tegra_channel_close+0x68/0x190
[   85.054271]  v4l2_release+0xc0/0x100
[   85.054276]  __fput+0x80/0x260
[   85.054281]  ____fput+0x24/0x30
[   85.054286]  task_work_run+0x88/0xe0
[   85.054290]  do_exit+0x35c/0xb00
[   85.054294]  do_group_exit+0x4c/0xb0
[   85.054299]  get_signal+0x184/0x8c0
[   85.054305]  do_notify_resume+0x18c/0x990
[   85.054308]  work_pending+0xc/0x738
[   85.054311] ---[ end trace 0ae4d7739dc50212 ]---
[   85.059103] ar0234_dser 35-0012: ar0234_stop_streaming: stop stream
[   85.098273] bwmgr API not supported
[   85.108073] ar0234_dser 35-0012: ar0234_power_off: power off
[   85.189575] [RCE] WARNING: core/hsp/hsp-vm.c:283 [camrtc_hsp_full_ss_isr] "VM0 issued IVC in inactive state."
[   86.141518] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[   86.149857] tegra194-vi5 13e40000.host1x:vi0@15c00000: csi_stream_release: failed to disable nvcsi tpg on stream 0 virtual channel 1

Hi, NVIDIA developers:

I have tested it without GMSL, connecting camera to Jetson Orin NX directly. It showed the same error when trying to recover VI/CSI channel.

The log

tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   68.336856] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   68.346434] (NULL device *): vi_capture_control_message: NULL VI channel received
[   68.354157] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=1, csi_port=1
[   68.364835] (NULL device *): vi_capture_control_message: NULL VI channel received
[   68.373109] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: successfully reset the capture channel
[   70.884133] tegra-camrtc-capture-vi tegra-capture-vi: uncorr_err: request timed out after 2500 ms
[   70.893261] tegra-camrtc-capture-vi tegra-capture-vi: err_rec: attempting to reset the capture channel
[   70.902828] (NULL device *): vi_capture_control_message: NULL VI channel received
[   70.910536] t194-nvcsi 13e40000.host1x:nvcsi@15a00000: csi5_stream_close: Error in closing stream_id=1, csi_port=1
[   70.921184] (NULL device *): vi_capture_control_message: NULL VI channel received
[   71.940062] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[   71.948392] tegra194-vi5 13e40000.host1x:vi0@15c00000: vi_capture_control_send_message: failed to send IVC control message
[   72.964064] tegra194-vi5 13e40000.host1x:vi0@15c00000: capture control message timed out
[   72.972413] tegra-camrtc-capture-vi tegra-capture-vi: vi capture setup failed
[   72.979764] tegra-camrtc-capture-vi tegra-capture-vi: fatal: error recovery failed

Trace log

# tracer: nop
#
# entries-in-buffer/entries-written: 37/37   #P:8
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
     kworker/1:2-133     [001] ....   168.343972: rtcpu_string: tstamp:5468809281 id:0x04010000 str:"VM0 deactivating."
        v4l2-ctl-2248    [004] ....   176.829320: tegra_channel_open: vi-output, ar0234 34-0010
        v4l2-ctl-2248    [004] ....   176.832454: tegra_channel_set_power: ar0234 34-0010 : 0x1
        v4l2-ctl-2248    [004] ....   176.832463: camera_common_s_power: status : 0x1
        v4l2-ctl-2248    [004] ....   176.835249: tegra_channel_set_power: 13e40000.host1x:nvcsi@15a00000- : 0x1
        v4l2-ctl-2248    [004] ....   176.835251: csi_s_power: enable : 0x1
        v4l2-ctl-2248    [004] ....   176.835935: tegra_channel_capture_setup: vnc_id 0 W 1920 H 1200 fmt 5
     kworker/1:2-133     [001] ....   176.859977: rtcpu_string: tstamp:5735196663 id:0x04010000 str:"VM0 activating."
        v4l2-ctl-2248    [004] ....   176.870344: tegra_channel_set_stream: enable : 0x1
        v4l2-ctl-2248    [004] ....   176.882325: tegra_channel_set_stream: 13e40000.host1x:nvcsi@15a00000- : 0x1
        v4l2-ctl-2248    [004] ....   176.882328: csi_s_stream: enable : 0x1
        v4l2-ctl-2248    [004] ....   176.882652: tegra_channel_set_stream: ar0234 34-0010 : 0x1
     kworker/1:2-133     [001] ....   176.915980: rtcpu_vinotify_event: tstamp:5736191136 cch:1 vi:0 tag:VIFALC_TDSTATE channel:0x22 frame:0 vi_tstamp:183557710720 data:0x759d520010000000
     kworker/1:2-133     [001] ....   176.915982: rtcpu_vinotify_event: tstamp:5736191337 cch:1 vi:0 tag:VIFALC_TDSTATE channel:0x22 frame:0 vi_tstamp:183557717184 data:0x0000000031000001
     kworker/1:2-133     [001] ....   176.915982: rtcpu_vinotify_event: tstamp:5736191536 cch:1 vi:0 tag:VIFALC_TDSTATE channel:0x22 frame:0 vi_tstamp:183557763104 data:0x759d4f0010000000
     kworker/1:2-133     [001] ....   176.915983: rtcpu_vinotify_event: tstamp:5736191705 cch:1 vi:0 tag:VIFALC_TDSTATE channel:0x22 frame:0 vi_tstamp:183557769664 data:0x0000000031000002
 vi-output, ar02-2250    [005] ....   179.476640: tegra_channel_capture_setup: vnc_id 0 W 1920 H 1200 fmt 5
     kworker/1:2-133     [001] ....   179.491970: rtcpu_vinotify_event: tstamp:5818088260 cch:2 vi:0 tag:VIFALC_TDSTATE channel:0x21 frame:0 vi_tstamp:186165020768 data:0x759d4c0010000000
     kworker/1:2-133     [001] ....   179.491973: rtcpu_vinotify_event: tstamp:5818088391 cch:2 vi:0 tag:VIFALC_TDSTATE channel:0x21 frame:0 vi_tstamp:186165063456 data:0x0000000031000001
     kworker/1:2-133     [001] ....   179.491973: rtcpu_vinotify_event: tstamp:5818088538 cch:2 vi:0 tag:VIFALC_TDSTATE channel:0x21 frame:0 vi_tstamp:186165081120 data:0x759d490010000000
     kworker/1:2-133     [001] ....   179.491974: rtcpu_vinotify_event: tstamp:5818088675 cch:2 vi:0 tag:VIFALC_TDSTATE channel:0x21 frame:0 vi_tstamp:186165141504 data:0x0000000031000002
 vi-output, ar02-2250    [007] ....   182.043492: tegra_channel_capture_setup: vnc_id 0 W 1920 H 1200 fmt 5
     kworker/1:2-133     [001] ....   182.068108: rtcpu_vinotify_event: tstamp:5898383909 cch:1 vi:0 tag:VIFALC_TDSTATE channel:0x22 frame:0 vi_tstamp:188731767712 data:0x759d520010000000
     kworker/1:2-133     [001] ....   182.068110: rtcpu_vinotify_event: tstamp:5898384038 cch:1 vi:0 tag:VIFALC_TDSTATE channel:0x22 frame:0 vi_tstamp:188731810432 data:0x0000000031000001
     kworker/1:2-133     [001] ....   182.068111: rtcpu_vinotify_event: tstamp:5898384182 cch:1 vi:0 tag:VIFALC_TDSTATE channel:0x22 frame:0 vi_tstamp:188731828096 data:0x759d4f0010000000
     kworker/1:2-133     [001] ....   182.068111: rtcpu_vinotify_event: tstamp:5898384305 cch:1 vi:0 tag:VIFALC_TDSTATE channel:0x22 frame:0 vi_tstamp:188731888480 data:0x0000000031000002
 vi-output, ar02-2250    [007] ....   185.879765: tegra_channel_capture_setup: vnc_id 0 W 1920 H 1200 fmt 5
        v4l2-ctl-2248    [004] ....   190.208201: tegra_channel_close: vi-output, ar0234 34-0010
        v4l2-ctl-2248    [004] ....   190.208213: tegra_channel_set_stream: enable : 0x0
        v4l2-ctl-2248    [004] ....   190.208213: tegra_channel_set_stream: ar0234 34-0010 : 0x0
        v4l2-ctl-2248    [004] ....   190.245560: tegra_channel_set_stream: 13e40000.host1x:nvcsi@15a00000- : 0x0
        v4l2-ctl-2248    [004] ....   190.245562: csi_s_stream: enable : 0x0
        v4l2-ctl-2248    [000] ....   190.257409: tegra_channel_set_power: ar0234 34-0010 : 0x0
        v4l2-ctl-2248    [000] ....   190.257426: camera_common_s_power: status : 0x0
        v4l2-ctl-2248    [000] ....   190.259459: tegra_channel_set_power: 13e40000.host1x:nvcsi@15a00000- : 0x0
        v4l2-ctl-2248    [000] ....   190.259462: csi_s_power: enable : 0x0
     kworker/1:2-133     [001] ....   192.260156: rtcpu_string: tstamp:6215497797 id:0x04010000 str:"VM0 deactivating."

Please verify on original r36.5 by set the timeout by below command.

v4l2-ctl -c override_capture_timeout_ms=-1