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.

AM6548: Unable to handle kernel NULL pointer during network sending and receiving

Part Number: AM6548

1. Chip

    AM6548

2. Processor SDK Version:

    8.4 (i forget which version exactly)

3. System

    using rt-linux kernel with ubuntu rootfs 

4. What happens

    the following errors occasionally occur during the network sending and receiving. it's hard to reproduce. 

[1296633.370657] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
[1296633.379696] Mem abort info:
[1296633.382729]   ESR = 0x96000006
[1296633.386005]   EC = 0x25: DABT (current EL), IL = 32 bits
[1296633.391517]   SET = 0, FnV = 0
[1296633.394798]   EA = 0, S1PTW = 0
[1296633.398194] Data abort info:
[1296633.401313]   ISV = 0, ISS = 0x00000006
[1296633.405336]   CM = 0, WnR = 0
[1296633.408485] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000081557000
[1296633.415103] [0000000000000010] pgd=0000000092deb003, p4d=0000000092deb003, pud=0000000092ce1003, pmd=0000000000000000
[1296633.425895] Internal error: Oops: 96000006 [#1] PREEMPT_RT SMP
[1296633.431893] Modules linked in: usb_storage crct10dif_ce icssg_prueth pru_swuart xhci_plat_hcd xhci_hcd pru_rproc ti_am335x_adc irq_pruss_intc kfifo_buf icss_iep spi_cadence_quadspi mcp25xx m_can_platform m_can ti_cal dwc3 ti_am335x_tscadc videobuf2_dma_contig udc_core v4l2_fwnode roles videobuf2_memops videobuf2_v4l2 pci_endpoint_test pvrsrvkm(O) pruss videobuf2_common sa2ul sha512_generic authenc phy_omap_usb2 dwc3_keystone 8250_pruss option usb_wwan usbserial usbcore usb_common em1000_spi_adc ip_tables x_tables ipv6
[1296633.477985] CPU: 0 PID: 469 Comm: irq/52-46000000 Tainted: G           O      5.10.140-rt73 #1
[1296633.486756] Hardware name: Texas Instruments AM654 Base Board (DT)
[1296633.493097] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[1296633.499268] pc : am65_cpsw_nuss_tx_compl_packet+0x40/0x98
[1296633.504849] lr : am65_cpsw_nuss_tx_compl_packet+0x38/0x98
[1296633.510414] sp : ffff800011b4bb50
[1296633.513893] x29: ffff800011b4bb50 x28: ffff0000038cc000 
[1296633.519371] x27: 00000000000005ea x26: 0000000000000000 
[1296633.524849] x25: 0000000000000000 x24: ffff000000d10118 
[1296633.530326] x23: ffff000000d10120 x22: ffff000000d10118 
[1296633.535803] x21: 0000000000000001 x20: 0000000000000000 
[1296633.541281] x19: ffff000000d10118 x18: fffffe0000328d08 
[1296633.546758] x17: 00000000706e99ae x16: 00000000b0c176f1 
[1296633.552237] x15: 0000000062286873 x14: 0000000000000005 
[1296633.557712] x13: ffff80001199d000 x12: 0000000000000010 
[1296633.563190] x11: 0000000000000001 x10: ffff80001199d048 
[1296633.568666] x9 : 0000000000000000 x8 : 0001ffffffffffff 
[1296633.574144] x7 : fffeffffffffffff x6 : 0001000000000000 
[1296633.579622] x5 : ffff80001199d048 x4 : 0000000000000000 
[1296633.585098] x3 : ffff80001199d048 x2 : ffff80001199d010 
[1296633.590574] x1 : 0000000000000000 x0 : ffff000000d10080 
[1296633.596053] Call trace:
[1296633.598668]  am65_cpsw_nuss_tx_compl_packet+0x40/0x98
[1296633.603887]  am65_cpsw_nuss_tx_poll+0x170/0x2c8
[1296633.608588]  net_rx_action+0x13c/0x2dc
[1296633.612510]  efi_header_end+0x1d0/0x218
[1296633.616514]  __local_bh_enable_ip+0x130/0x134
[1296633.621039]  irq_forced_thread_fn+0x80/0xa4
[1296633.625393]  irq_thread+0x120/0x1d0
[1296633.629049]  kthread+0x120/0x130
[1296633.632448]  ret_from_fork+0x10/0x30
[1296633.636202] Code: aa1303e0 97ffff83 f940c660 aa1403e1 (f9400a95) 
[1296633.642460] ---[ end trace 0000000000000002 ]---
[1296633.647403] Kernel panic - not syncing:
[1296633.651402] Oops: Fatal exception in interrupt
[1296633.651503] SMP: stopping secondary CPUs
[1296633.660212] Kernel Offset: disabled
[1296633.663864] CPU features: 0x0040002,2000200c
[1296633.668297] Memory Limit: none
[1296633.671521] ---[ end Kernel panic - not syncing: Oops: Fatal exception in interrupt ]---

5. Other

    i disassemble the source file(drivers/net/ethernet/ti/am65_cpsw_nuss.c), and found that skb is null pointer in the function am65_cpsw_nuss_tx_compl_packet.

    

static struct sk_buff *
am65_cpsw_nuss_tx_compl_packet(struct am65_cpsw_tx_chn *tx_chn,
			       dma_addr_t desc_dma)
{
	struct am65_cpsw_ndev_priv *ndev_priv;
	struct am65_cpsw_ndev_stats *stats;
	struct cppi5_host_desc_t *desc_tx;
	struct net_device *ndev;
	struct sk_buff *skb;
	void **swdata;

	desc_tx = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool,
					     desc_dma);
	swdata = cppi5_hdesc_get_swdata(desc_tx);
	skb = *(swdata);    // this is a null pointer
	am65_cpsw_nuss_xmit_free(tx_chn, desc_tx);

	ndev = skb->dev;

	am65_cpts_tx_timestamp(tx_chn->common->cpts, skb);

	ndev_priv = netdev_priv(ndev);
	stats = this_cpu_ptr(ndev_priv->stats);
	u64_stats_update_begin(&stats->syncp);
	stats->tx_packets++;
	stats->tx_bytes += skb->len;
	u64_stats_update_end(&stats->syncp);

	return skb;
}

    

00000000000007e0 <am65_cpsw_nuss_tx_compl_packet>:
am65_cpsw_nuss_tx_compl_packet():
     7e0:	d503233f 	paciasp
     7e4:	a9bd7bfd 	stp	x29, x30, [sp, #-48]!
     7e8:	910003fd 	mov	x29, sp
     7ec:	a90153f3 	stp	x19, x20, [sp, #16]
     7f0:	aa0003f3 	mov	x19, x0
     7f4:	f90013f5 	str	x21, [sp, #32]
     7f8:	f940c800 	ldr	x0, [x0, #400]
     7fc:	94000000 	bl	0 <k3_cppi_desc_pool_dma2virt>
			7fc: R_AARCH64_CALL26	k3_cppi_desc_pool_dma2virt
     800:	aa0003e4 	mov	x4, x0
     804:	97fffe1d 	bl	78 <cppi5_hdesc_get_swdata>
     808:	aa0403e1 	mov	x1, x4
     80c:	f9400014 	ldr	x20, [x0]
     810:	aa1303e0 	mov	x0, x19
     814:	97ffff83 	bl	620 <am65_cpsw_nuss_xmit_free>
     818:	f940c660 	ldr	x0, [x19, #392]
     81c:	aa1403e1 	mov	x1, x20
     820:	f9400a95 	ldr	x21, [x20, #16]
     824:	f94c0800 	ldr	x0, [x0, #6160]
     828:	94000000 	bl	0 <am65_cpts_tx_timestamp>
			828: R_AARCH64_CALL26	am65_cpts_tx_timestamp
     82c:	f944eab3 	ldr	x19, [x21, #2512]
     830:	94000000 	bl	0 <debug_smp_processor_id>
			830: R_AARCH64_CALL26	debug_smp_processor_id
     834:	90000001 	adrp	x1, 0 <__per_cpu_offset>
			834: R_AARCH64_ADR_PREL_PG_HI21	__per_cpu_offset
     838:	91000021 	add	x1, x1, #0x0
			838: R_AARCH64_ADD_ABS_LO12_NC	__per_cpu_offset
     83c:	f8605820 	ldr	x0, [x1, w0, uxtw #3]
     840:	8b000262 	add	x2, x19, x0
     844:	f8606a61 	ldr	x1, [x19, x0]
     848:	91000421 	add	x1, x1, #0x1
     84c:	f8206a61 	str	x1, [x19, x0]
     850:	f9400440 	ldr	x0, [x2, #8]
     854:	b9407281 	ldr	w1, [x20, #112]
     858:	8b010000 	add	x0, x0, x1
     85c:	f9000440 	str	x0, [x2, #8]
     860:	aa1403e0 	mov	x0, x20
     864:	a94153f3 	ldp	x19, x20, [sp, #16]
     868:	f94013f5 	ldr	x21, [sp, #32]
     86c:	a8c37bfd 	ldp	x29, x30, [sp], #48
     870:	d50323bf 	autiasp
     874:	d65f03c0 	ret