Kernel crash when camera disconnected during capture

hi!
3 patches from Kernel panic when closing a stuck camera - #4 by ting.chang
plus disable recovery and by doing goto
in
static int vi5_channel_error_recover(struct tegra_channel *chan,
bool queue_error)
{
int err = 0;
int vi_port = 0;
struct tegra_channel_buffer *buf;
struct tegra_mc_vi *vi = chan->vi;
struct v4l2_subdev *csi_subdev;

/* stop vi channel */
for (vi_port = 0; vi_port < chan->valid_ports; vi_port++) {
	filp_close(chan->fp[vi_port], NULL);
	chan->tegra_vi_channel[vi_port] = NULL;
	kfree(chan->tegra_vi_channel[vi_port]);
[kernel_crash_log.txt|attachment](upload://eTbV88m8kXZsfjZDwRZKaEsnd0b.txt) (18.4 KB)

}
goto done;


kernel crash is still happening JP-5.1.3/r35.5.0
please help us to fix it ?
ub960 2-003d: CHECK LOCK: locked=1, port->locked=1
[  444.900959] ub960 2-003d: probe success
[  452.412959] ------------[ cut here ]------------
[  452.412976] WARNING: CPU: 0 PID: 3463 at kernel/kthread.c:83 kthread_stop+0x58/0x290
[  452.420949] Modules linked in: nvidia_modeset(OE) fuse(E) lzo_rle(E) lzo_compress(E) zram(E) ramoops(E) reed_solomon(E) loop(E) snd_soc_tegra186_asrc(E) snd_soc_tegra186_dspk(E) snd_soc_tegra210_ope(E) snd_soc_tegra186_arad(E) snd_soc_tegra210_mvc(E) snd_soc_tegra210_iqc(E) snd_soc_tegra210_afc(E) snd_soc_tegra210_dmic(E) snd_soc_tegra210_adx(E) snd_soc_tegra210_amx(E) snd_soc_tegra210_admaif(E) snd_soc_tegra210_mixer(E) snd_soc_tegra210_i2s(E) snd_soc_tegra_pcm(E) snd_soc_tegra210_sfc(E) aes_ce_blk(E) crypto_simd(E) cryptd(E) aes_ce_cipher(E) ghash_ce(E) sha2_ce(E) sha256_arm64(E) sha1_ce(E) snd_hda_codec_hdmi(E) snd_soc_tegra210_adsp(E) snd_soc_tegra_machine_driver(E) snd_soc_tegra_utils(E) snd_hda_tegra(E) input_leds(E) snd_soc_simple_card_utils(E) snd_soc_spdif_tx(E) tegra_bpmp_thermal(E) at24(E) tegra210_adma(E) userspace_alert(E) snd_soc_tegra210_ahub(E) nvadsp(E) snd_hda_codec(E) snd_hda_core(E) spi_tegra114(E) r8168(E) nvidia(OE) binfmt_misc(E) ina3221(E) pwm_fan(E) nvgpu(E)
[  452.421026]  nvmap(E) ip_tables(E) x_tables(E) [last unloaded: mtd]
[  452.421037] CPU: 0 PID: 3463 Comm: v4l2-ctl Tainted: G        W  OE     5.10.192-tegra #23
[  452.421038] Hardware name: Orin NX 16GB for DSBOARD-ORNXS (DT)
[  452.421042] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[  452.421044] pc : kthread_stop+0x58/0x290
[  452.421046] lr : kthread_stop+0x4c/0x290
[  452.421047] sp : ffff80001ef4ba90
[  452.421048] x29: ffff80001ef4ba90 x28: ffff465483693b00 
[  452.421052] x27: 0000000000000000 x26: 0000ffffb9c28acc 
[  452.421055] x25: ffffadec1de12000 x24: ffff465483694100 
[  452.421058] x23: ffff46579885a1f8 x22: ffff4654437c20a0 
[  452.421061] x21: ffff4654836958b0 x20: ffff46579885a550 
[  452.421063] x19: ffff465483695880 x18: 0000000000000000 
[  452.421066] x17: 0000000000000000 x16: 0000000000000000 
[  452.421069] x15: 0000000000000000 x14: 0000000000000000 
[  452.421072] x13: ffffff1953054908 x12: ffffadec1e3d4bc8 
[  452.421075] x11: 0000000000000000 x10: 0000000000000ab0 
[  452.421078] x9 : ffff80001ef4b8d0 x8 : ffff465483694610 
[  452.421081] x7 : 0008b10a2952d60e x6 : 000000036d0764c7 
[  452.421084] x5 : 00000000410fd420 x4 : 0000000000f0000f 
[  452.421087] x3 : 0000000000000000 x2 : 00000000c0000000 
[  452.421090] x1 : ffffadec1e3e22bf x0 : 0000000000408444 
[  452.421093] Call trace:
[  452.421095]  kthread_stop+0x58/0x290
[  452.421102]  vi5_channel_stop_kthreads+0x44/0x60
[  452.421105]  vi5_channel_stop_streaming+0xa8/0xb0
[  452.421108]  tegra_channel_stop_streaming+0x3c/0x70
[  452.421112]  __vb2_queue_cancel+0x40/0x220
[  452.421115]  vb2_core_queue_release+0x30/0x60
[  452.421118]  _vb2_fop_release+0x88/0xb0
[  452.421120]  tegra_channel_close+0x68/0x190
[  452.421124]  v4l2_release+0xc0/0x100
[  452.421128]  __fput+0x80/0x260
[  452.421130]  ____fput+0x24/0x30
[  452.421134]  task_work_run+0x88/0xe0
[  452.421138]  do_exit+0x35c/0xb00
[  452.421140]  do_group_exit+0x4c/0xb0
[  452.421144]  get_signal+0x184/0x8c0
[  452.421148]  do_notify_resume+0x18c/0x990
[  452.421151]  work_pending+0xc/0x738
[  452.421153] ---[ end trace 592254bbe4ef268e ]---
[  452.426041] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[  452.435213] Mem abort info:
[  452.438168]   ESR = 0x96000004
[  452.441379]   EC = 0x25: DABT (current EL), IL = 32 bits
[  452.446921]   SET = 0, FnV = 0
[  452.450112]   EA = 0, S1PTW = 0
[  452.453372] Data abort info:
[  452.456379]   ISV = 0, ISS = 0x00000004
[  452.460356]   CM = 0, WnR = 0
[  452.463439] user pgtable: 4k pages, 48-bit VAs, pgdp=000000011aecc000
[  452.470111] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
[  452.477133] Internal error: Oops: 96000004 [#1] PREEMPT SMP
please see log attached
[kernel_crash_log.txt|attachment](upload://eTbV88m8kXZsfjZDwRZKaEsnd0b.txt) (18.4 KB)
[capure_command.txt|attachment](upload://d8CWB9bsZlB5IG5ACGYE6gAelZ6.txt) (1.6 KB)

Looks like didn’t fix yet.
Maybe you can try the patches from here to try.

Hi!
Shane if the patches are validated by NVIDIA?
I prefer to get official validated fixes from NVIDIA
thanks

No, we don’t.

hi!
when jetpack JetPack_5.1.3 new release with mipi bug fixes will be released ?
we worked with jetpack 4 and 4.6 kernel was stable there
I looked into patches and only 2 patches dated by 2024
other patches are too old from 19 20 21
kernel panic is new problem from jepack 5.1.3

We are trying to fix it for r35 release.

Thanks

Hi!
Can you update please when fixes will be released ?
we need it asap
Thanks

Please apply attached patch for it.

0001-kernel-camera-remove-csi-enent-sync-for-recover.patch (2.0 KB)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.