Jetson agx xavier capture mipi csi video error

Hi,
I’m using jetson agx xavier(JP4.6.rev1) to capture a 4 lane mipi csi 1080P yuv422 video, got kernel crash as follows:

[ 2783.353449] [RCE] vi5_hwinit: firmware CL2018101701 protocol version 2.2
[ 2785.981250] tegra194-vi5 15c10000.vi: no reply from camera processor
[ 2785.981405] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms
[ 2785.981575] tegra194-vi5 15c10000.vi: err_rec: attempting to reset the capture channel
[ 2785.984612] Unable to handle kernel NULL pointer dereference at virtual address 00000010
[ 2785.984784] Mem abort info:
[ 2785.984838]   ESR = 0x96000005
[ 2785.984902]   Exception class = DABT (current EL), IL = 32 bits
[ 2785.985004]   SET = 0, FnV = 0
[ 2785.985088]   EA = 0, S1PTW = 0
[ 2785.985146] Data abort info:
[ 2785.985200]   ISV = 0, ISS = 0x00000005
[ 2785.985359]   CM = 0, WnR = 0
[ 2785.985425] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc7c000b000
[ 2785.985540] [0000000000000010] *pgd=0000000000000000, *pud=0000000000000000
[ 2785.985684] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[ 2785.985785] Modules linked in: bnep fuse xt_conntrack ipt_MASQUERADE nf_nat_masquerade_ipv4 nf_conntrack_netlink nfnetlink xt_addrtype iptable_filter iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack br_netfilter zram overlay bluedroid_pm userspace_alert nvgpu ip_tables x_tables
[ 2785.996172] CPU: 0 PID: 9059 Comm: vi-output, mipi Not tainted 4.9.253-tegra #4
[ 2786.003334] Hardware name: Jetson-AGX (DT)
[ 2786.007538] task: ffffffc7c174b800 task.stack: ffffffc79af84000
[ 2786.013494] PC is at _raw_write_lock+0x30/0x58
[ 2786.017520] LR is at destroy_buffer_table+0x40/0xd8
[ 2786.022760] pc : [<ffffff8008f5dcb0>] lr : [<ffffff8008b3fc08>] pstate: 20c00045
[ 2786.030022] sp : ffffffc79af87c70
[ 2786.033177] x29: ffffffc79af87c70 x28: 0000000000000000 
[ 2786.038682] x27: 0000000000000000 x26: 0000000000000000 
[ 2786.044193] x25: 0000000000000010 x24: 0000000000000098 
[ 2786.049719] x23: 0000000000000018 x22: ffffff8009073b58 
[ 2786.055131] x21: 0000000000000000 x20: ffffffc7c46e3b80 
[ 2786.060294] x19: 0000000000000010 x18: 0000000000004025 
[ 2786.065983] x17: 0000000000000002 x16: 0000000000000003 
[ 2786.071507] x15: 0000000000000366 x14: 0000000000000012 
[ 2786.077444] x13: 00000000000003dc x12: 0000000000000400 
[ 2786.082882] x11: 0000000000000400 x10: 0000000000000000 
[ 2786.088821] x9 : ffffffc79af87a80 x8 : 0000000000000000 
[ 2786.094347] x7 : ffffffc79aff4700 x6 : ffffffc7928caa81 
[ 2786.100108] x5 : ffffff800852d884 x4 : ffffffbf1e4a3290 
[ 2786.105445] x3 : 0000000000000000 x2 : ffffffc7928caa80 
[ 2786.110534] x1 : 0000000000000000 x0 : 0000000080000000 

[ 2786.117532] Process vi-output, mipi (pid: 9059, stack limit = 0xffffffc79af84000)
[ 2786.124441] Call trace:
[ 2786.127065] [<ffffff8008f5dcb0>] _raw_write_lock+0x30/0x58
[ 2786.132138] [<ffffff8008b3fc08>] destroy_buffer_table+0x40/0xd8
[ 2786.137740] [<ffffff8008b31f14>] vi_capture_shutdown+0xd4/0x130
[ 2786.143081] [<ffffff8008b3256c>] vi_channel_close_ex+0x34/0x88
[ 2786.148940] [<ffffff8008b33a78>] vi5_channel_error_recover+0x48/0x1c8
[ 2786.154888] [<ffffff8008b28b48>] tegra_channel_error_recover+0x58/0x90
[ 2786.160757] [<ffffff8008b34338>] tegra_channel_kthread_capture_dequeue+0xf8/0x1c0
[ 2786.167669] [<ffffff80080db09c>] kthread+0xec/0xf0
[ 2786.172563] [<ffffff80080838a0>] ret_from_fork+0x10/0x30
[ 2786.177817] ---[ end trace ebae804554574502 ]---
[ 2786.197435] note: vi-output, mipi[9059] exited with preempt_count 1
[ 2788.277241] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 2788.277415] Mem abort info:
[ 2788.277478]   ESR = 0x96000005
[ 2788.277570]   Exception class = DABT (current EL), IL = 32 bits
[ 2788.277672]   SET = 0, FnV = 0
[ 2788.277731]   EA = 0, S1PTW = 0
[ 2788.277790] Data abort info:
[ 2788.277845]   ISV = 0, ISS = 0x00000005
[ 2788.277941]   CM = 0, WnR = 0
[ 2788.278003] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc77dabe000
[ 2788.278114] [0000000000000000] *pgd=0000000000000000, *pud=0000000000000000
[ 2788.278260] Internal error: Oops: 96000005 [#2] PREEMPT SMP
[ 2788.278363] Modules linked in: bnep fuse xt_conntrack ipt_MASQUERADE nf_nat_masquerade_ipv4 nf_conntrack_netlink nfnetlink xt_addrtype iptable_filter iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack br_netfilter zram overlay bluedroid_pm userspace_alert nvgpu ip_tables x_tables
[ 2788.279702] CPU: 4 PID: 9054 Comm: gst-launch-1.0 Tainted: G      D         4.9.253-tegra #4
[ 2788.280322] Hardware name: Jetson-AGX (DT)
[ 2788.282985] task: ffffffc7878baa00 task.stack: ffffffc77d894000
[ 2788.288506] PC is at exit_creds+0x2c/0x78
[ 2788.292701] LR is at __put_task_struct+0x4c/0x140
[ 2788.297422] pc : [<ffffff80080de15c>] lr : [<ffffff80080aee9c>] pstate: 60400045
[ 2788.304943] sp : ffffffc77d897a40
[ 2788.307924] x29: ffffffc77d897a40 x28: 0000000000000000 
[ 2788.313602] x27: ffffffc7c59da800 x26: 0000000000000001 
[ 2788.318868] x25: ffffff8009fb3758 x24: 0000000000000013 
[ 2788.324889] x23: 0000000000000000 x22: ffffffc77d897d10 
[ 2788.329967] x21: ffffffc7c174b830 x20: 0000000000000000 
[ 2788.335126] x19: ffffffc7c174b800 x18: 0000007f802d0a70 
[ 2788.340901] x17: 0000007f8024d258 x16: ffffff80082b1000 
[ 2788.346502] x15: 00001d9076700071 x14: 0000201ecc6e4136 
[ 2788.352190] x13: 0000000000003e9e x12: 071c71c71c71c71c 
[ 2788.357701] x11: 000000000000000b x10: 0000000000000a10 
[ 2788.363476] x9 : ffffffc77d897890 x8 : ffffffc7878bb470 
[ 2788.369253] x7 : fefefeff646c606d x6 : 000000146830cca8 
[ 2788.374764] x5 : 0000000000000800 x4 : 0000000000000000 
[ 2788.380103] x3 : 00000000000000e2 x2 : 0000000000000000 
[ 2788.385441] x1 : 0000000000000000 x0 : 00000000ffffffff 

[ 2788.391932] Process gst-launch-1.0 (pid: 9054, stack limit = 0xffffffc77d894000)
[ 2788.399178] Call trace:
[ 2788.401721] [<ffffff80080de15c>] exit_creds+0x2c/0x78
[ 2788.406533] [<ffffff80080aee9c>] __put_task_struct+0x4c/0x140
[ 2788.411613] [<ffffff80080dbbfc>] kthread_stop+0x1e4/0x1e8
[ 2788.416690] [<ffffff8008b33c90>] vi5_channel_stop_kthreads+0x40/0x58
[ 2788.422813] [<ffffff8008b33d74>] vi5_channel_stop_streaming+0xcc/0xd0
[ 2788.429195] [<ffffff8008b259e4>] tegra_channel_stop_streaming+0x34/0x48
[ 2788.435410] [<ffffff8008b1dcfc>] __vb2_queue_cancel+0x34/0x188
[ 2788.441010] [<ffffff8008b1e0ac>] vb2_core_streamoff+0x54/0xb8
[ 2788.446087] [<ffffff8008b229d4>] vb2_streamoff+0x54/0x88
[ 2788.451163] [<ffffff8008b22a5c>] vb2_ioctl_streamoff+0x54/0x60
[ 2788.457108] [<ffffff8008afc56c>] v4l_streamoff+0x3c/0x50
[ 2788.462188] [<ffffff8008b0161c>] __video_do_ioctl+0x204/0x2c8
[ 2788.468045] [<ffffff8008b00fc8>] video_usercopy+0x2a0/0x6a0
[ 2788.473645] [<ffffff8008b01404>] video_ioctl2+0x3c/0x50
[ 2788.478636] [<ffffff8008afae68>] v4l2_ioctl+0x88/0x118
[ 2788.483802] [<ffffff8008271538>] do_vfs_ioctl+0xb0/0x8d8
[ 2788.489137] [<ffffff8008271dec>] SyS_ioctl+0x8c/0xa8
[ 2788.494040] [<ffffff8008083900>] el0_svc_naked+0x34/0x38
[ 2788.499552] ---[ end trace ebae804554574503 ]---
nvidia@agx-dev-1:~$ 

test cmd:

v4l2-ctl -d /dev/video0 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw --set-fmt-video=width=1920,height=1080,pixelformat=UYVY

hw connection: CSI0_D0 CSI0_D1 CSI1_D0 CSI1_D1 CSI0_CLK
dts code:

	host1x {
		vi@15c10000 {
			num-channels = <1>;
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					e3326_vi_in0: endpoint {
						port-index = <0>;
						bus-width = <4>;
						remote-endpoint = <&e3326_csi_out0>;
					};
				};
			};
		};

		nvcsi@15a00000 {
			num-channels = <1>;
			#address-cells = <1>;
			#size-cells = <0>;
			channel@0 {
				reg = <0>;
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						e3326_csi_in0: endpoint@0 {
							port-index = <0>;
							bus-width = <4>;
							remote-endpoint = <&e3326_ov5693_out0>;
						};
					};
					port@1 {
						reg = <1>;
						e3326_csi_out0: endpoint@1 {
							remote-endpoint = <&e3326_vi_in0>;
						};
					};
				};
			};
		};
	};

Could you tell me how should I do to debug this error?

Thanks.

Hi @suchb,

It looks that you are using an ov camera. You can check the driver messages in the dmesg with the following command.

dmesg | grep ov

To check if it’s a possible issue with the driver.

Also, you can try to debug the crash with gdb as following.

gdb --args v4l2-ctl -d /dev/video0 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw --set-fmt-video=width=1920,height=1080,pixelformat=UYVY

Verify that you have the debug symbols of the v4l2-utils package.

Finally, check a detailed backtrace with the following commands in the gdb environment.

run
bt

Regards,
Mauricio Montero J.

Hi @mauricio.montero
Thank you for your information.

FYI
V4L2 timeout leads to NULL pointer dereference in kernel in jetpack 4.6 - Jetson & Embedded Systems / Jetson Xavier NX - NVIDIA Developer Forums