This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TDA4VH-Q1:socketCAN 驱动程序中的内核严重错误(SDK 9.2)

Guru**** 2393625 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1496521/tda4vh-q1-kernel-panic-in-the-socketcan-driver-sdk-9-2

器件型号:TDA4VH-Q1
主题中讨论的其他器件:TDA4VH

工具与软件:

您好!

我们刚刚发现, 当我们的应用程序被杀死时,我们会遇到内核恐慌,并且跟踪指向 socketcan 驱动程序。

如何重现:

  • 运行应用程序
  • 关闭应用程序。 或者:
    • Kill -9.
    • 关闭 SSH 会话
  • 发生内核严重错误

这里是迹线

[   68.505897] Unable to handle kernel paging request at virtual address 0000000608ace2b0
[   68.513812] Mem abort info:
[   68.516602]   ESR = 0x0000000086000005
[   68.520347]   EC = 0x21: IABT (current EL), IL = 32 bits
[   68.525653]   SET = 0, FnV = 0
[   68.528703]   EA = 0, S1PTW = 0
[   68.531840]   FSC = 0x05: level 1 translation fault
[   68.536714] user pgtable: 64k pages, 48-bit VAs, pgdp=000000094246e000
[   68.543238] [0000000608ace2b0] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
[   68.551939] Internal error: Oops: 0000000086000005 [#1] PREEMPT SMP
[   68.558191] Modules linked in: can_raw can veth xt_nat xt_tcpudp xt_conntrack xt_MASQUERADE iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c xt_addrtype iptable_filter ip_tablei
[   68.558322]  videodev pci_j721e_host m_can pci_j721e at24 pcie_cadence_host rti_wdt mc pcie_cadence can_dev pwm_tiehrpwm optee_rng rng_core fuse drm drm_panel_orientation_quirks ipv6
[   68.661497] CPU: 5 PID: 40 Comm: ksoftirqd/5 Tainted: G           O       6.1.80-g2e423244f8 #1
[   68.670175] Hardware name: Texas Instruments J784S4 EVM (DT)
[   68.675816] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   68.682759] pc : 0x608ace2b0
[   68.685632] lr : skb_release_head_state+0x34/0xe4
[   68.690330] sp : ffff80000a5afb80
[   68.693630] x29: ffff80000a5afb80 x28: ffff0008c060b100 x27: ffff000f7d9cac78
[   68.700748] x26: 000000000000000a x25: 0000000000000001 x24: ffff80000a5afd50
[   68.707866] x23: ffff800009390008 x22: ffff8000097b3a20 x21: ffff80000984d440
[   68.714985] x20: ffff0008c4cccae0 x19: ffff0008d3050000 x18: ffffffffffffffff
[   68.722103] x17: 676e696d61657274 x16: 73205d6d61657274 x15: 0000000000000200
[   68.729221] x14: 000000000000001a x13: 0000000000000000 x12: 0000000000003fff
[   68.736338] x11: 0000000000000040 x10: ffff800009849ec0 x9 : ffff800008ad4f0c
[   68.743455] x8 : ffff80000a5afaa8 x7 : 0000000000000000 x6 : 0000000000000101
[   68.750573] x5 : ffff8000097b4000 x4 : ffff8000097b4258 x3 : 0000000000000000
[   68.757691] x2 : ffff800008ad5348 x1 : 0000000608ace2b0 x0 : ffff0008d3050000
[   68.764810] Call trace:
[   68.767243]  0x608ace2b0
[   68.769766]  kfree_skb_reason+0x48/0x14c
[   68.773677]  skb_queue_purge+0x28/0x44
[   68.777413]  can_sock_destruct+0x24/0x40 [can]
[   68.781854]  __sk_destruct+0x34/0x230
[   68.785503]  sk_destruct+0x5c/0x6c
[   68.788892]  __sk_free+0x80/0x130
[   68.792194]  sk_free+0x6c/0x90
[   68.795235]  can_rx_delete_receiver+0x90/0xb0 [can]
[   68.800102]  rcu_core+0x2c4/0xab4
[   68.803407]  rcu_core_si+0x18/0x24
[   68.806796]  __do_softirq+0x178/0x474
[   68.810446]  run_ksoftirqd+0x64/0x84
[   68.814013]  smpboot_thread_fn+0x1e8/0x21c
[   68.818099]  kthread+0x104/0x110
[   68.821316]  ret_from_fork+0x10/0x20
[   68.824886] Code: bad PC value
[   68.827930] ---[ end trace 0000000000000000 ]---
[   68.832532] Kernel panic - not syncing: Oops: Fatal exception in interrupt
[   68.839388] SMP: stopping secondary CPUs
[   68.843305] Kernel Offset: disabled
[   68.846779] CPU features: 0x40000,20028084,0000420b
[   68.851641] Memory Limit: none
[   68.854685] ---[ end Kernel panic - not syncing: Oops: Fatal exception in interrupt ]---

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Fred:

    我手头没有 TDA4VH、因此我使用手头的 TDA4VEN。 到目前为止、我无法使用 CAN-utils 命令行工具 (如"ip"、"candump"和"cansend")重现问题。 在下面应该使用 SocketCAN。

    至于实验、我执行了以下序列:

    e2e.ti.com/.../tda4ven_5F00_can_5F00_commands.txt

    我在 while 循环 bash 脚本(见下文)中放入 cansend、以查看问题是否仅在消息不断发送时发生。

    e2e.ti.com/.../send_5F00_can.sh

    我有一个单独的 ssh 终端、用来终止 candump 和 cansend bash 脚本进程。 当每个进程都被终止时、不会发生内核恐慌。

    请随时尝试我尝试过的实验、以查看这是否显示您的系统上的错误。 如果这样不会出现问题、则可能是应用级问题。

    此致、

    Takuma

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好、Takuma、

    感谢您的快速回复。 我看了一下 candump 的代码 、发现他们添加了信号处理程序以在崩溃之前正常地关闭打开的套接字。

    static void sigterm(int signo)
    {
    	running = 0;
    	signal_num = signo;
    }
    
    /* ... */ 
        signal(SIGTERM, sigterm);
        signal(SIGHUP, sigterm);
        signal(SIGINT, sigterm);
    

    添加这似乎停止了内核恐慌。 我将把它标记为已解决。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Fred:

    很高兴听到您能弄清楚!  感谢您 发布解决方案。

    此致、

    Takuma