Kernel crashes when adding a cape/slot

This forum is for supported devices using an ARMv7 Texas Instruments (TI) SoC.

Kernel crashes when adding a cape/slot

Postby ciofeca » Sat Dec 02, 2017 9:45 pm

I downloaded and installed and updated the latest BeagleBone ArchLinuxARM image as of BeagleBone instructions.

If I try to enable a serial port, for example using:
$this->bbcode_second_pass_code('', 'echo BB-UART2 > /sys/devices/platform/bone_capemgr/slots')

the kernel (Linux version 4.14.3-2-ARCH) crashes in the of_overlay_create function call::
$this->bbcode_second_pass_code('', '[ 20.744934] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 278.798072] bone_capemgr bone_capemgr: part_number 'BB-UART1', version 'N/A'
[ 278.805292] bone_capemgr bone_capemgr: slot #7: override
[ 278.810727] bone_capemgr bone_capemgr: Using override eeprom data at slot 7
[ 278.817763] bone_capemgr bone_capemgr: slot #7: 'Override Board Name,00A0,Override Manuf,BB-UART1'
[ 278.860506] Unable to handle kernel NULL pointer dereference at virtual address 0000000c
[ 278.868747] pgd = c9b20000
[ 278.871518] [0000000c] *pgd=89b0e831, *pte=00000000, *ppte=00000000
[ 278.877872] Internal error: Oops: 17 [#1] ARM
[ 278.882256] Modules linked in: evdev uio_pdrv_genirq uio cpufreq_dt sch_fq_codel ip_tables x_tables
[ 278.891390] CPU: 0 PID: 171 Comm: bash Not tainted 4.14.3-2-ARCH #1
[ 278.897692] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 278.903819] task: cf5c9f40 task.stack: cf3be000
[ 278.908404] PC is at __of_overlay_create+0x3a4/0xb20
[ 278.913399] LR is at __of_overlay_create+0x3b0/0xb20
')

I don't know if this is a kernel bug or a devicetree overlay /lib/firmware/BB*.dtbo file issue. Should I file the same bug to two different packages (linux-am33x and linux-firmware) in the Packages section?

Apparently this problem is quite old - it was also reported in another (currently locked) thread when Linux 4.10 came out.

Copying the relevant *.dtbo files in the /lib/firmware directory of the initramfs-linux.img in order to use the kernel command-line bone_capemgr.enable_partno parameter shows the same kernel crash (maybe this is why there is no /lib/firmware in the initramfs-linux.img so that you at most get a warning "bone_capemgr bone_capemgr: loader: failed to load slot BB-UART2:00A0 (prio 0)" in the dmesg output).

I had to manually downgrade the kernel to 4.9.10, thanks to the images provided by Chalmers Revere (other architectures may be found here) using the commands:
$this->bbcode_second_pass_code('', 'pacman -U linux-am33x-4.9.10-1-armv7h.pkg.tar.xz linux-am33x-headers-4.9.10-1-armv7h.pkg.tar.xz')

After rebooting, the bone_capemgr kernel section will successfully load the dtbo file. In my case, I can check the serial ports:
$this->bbcode_second_pass_code('', '# cat /proc/version
Linux version 4.9.10-1-ARCH (builduser@leming) (gcc version 6.3.1 20170109 (GCC) ) #1 Thu Feb 16 20:52:57 MST 2017

# echo BB-UART2 > /sys/devices/platform/bone_capemgr/slots

# dmesg | tail -7
[ 22.256947] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 50.822692] bone_capemgr bone_capemgr: part_number 'BB-UART2', version 'N/A'
[ 50.829884] bone_capemgr bone_capemgr: slot #7: override
[ 50.835426] bone_capemgr bone_capemgr: Using override eeprom data at slot 7
[ 50.842531] bone_capemgr bone_capemgr: slot #7: 'Override Board Name,00A0,Override Manuf,BB-UART2'
[ 50.885985] 48024000.serial: ttyS2 at MMIO 0x48024000 (irq = 185, base_baud = 3000000) is a 8250
[ 50.912124] bone_capemgr bone_capemgr: slot #7: dtbo 'BB-UART2-00A0.dtbo' loaded; overlay id #0

# cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
7: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-UART2

# cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:8250 mmio:0x44E09000 irq:158 tx:5720 rx:0 RTS|CTS|DTR|DSR
1: uart:unknown port:00000000 irq:0
2: uart:8250 mmio:0x48024000 irq:185 tx:0 rx:0 CTS|DSR
3: uart:unknown port:00000000 irq:0
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
')
ciofeca
 
Posts: 13
Joined: Wed Feb 20, 2013 10:19 pm

Re: Kernel crashes when adding a cape/slot

Postby ciofeca » Tue Jan 23, 2018 12:47 pm

Still happens with kernel Linux version 4.14.14-1-ARCH.

And we now know where is the problem:
$this->bbcode_second_pass_code('', '[ 259.631165] ------------[ cut here ]------------
[ 259.635849] kernel BUG at fs/sysfs/group.c:113!
[ 259.640406] Internal error: Oops - BUG: 0 [#1] ARM')

As of github, either a provided kernel object was NULL or an updated provided a NULL sd - this sounds like a problem from the bone_capemgr slots manager:
$this->bbcode_second_pass_code('', 'static int internal_create_group(struct kobject *kobj, int update,
const struct attribute_group *grp)
{
struct kernfs_node *kn;
int error;

BUG_ON(!kobj || (!update && !kobj->sd));')
ciofeca
 
Posts: 13
Joined: Wed Feb 20, 2013 10:19 pm


Return to Texas Instruments (TI)

Who is online

Users browsing this forum: No registered users and 5 guests