Unload cape-bone-iio overlay crash

Unloading the cape-bone-iio device tree overlay appears to crash the system. Is real-time unloading not supported at this time (or by design?)? Is there a better way to unload the overlay?

root@beaglebone:/sys/devices/bone_capemgr.9# echo cape-bone-iio > slots
root@beaglebone:/sys/devices/bone_capemgr.9# cat slots
0: 54:PF—
1: 55:PF—
2: 56:PF—
3: 57:PF—
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
8: ff:P-O-L Override Board Name,00A0,Override Manuf,cape-bone-iio

root@beaglebone:/sys/devices/bone_capemgr.9# echo -8 > slots
Connection to beaglebone.local closed.

Log:

Jun 24 14:55:21 beaglebone kernel: ti_tscadc 44e0d000.tscadc: Initialized OK.
Jun 24 14:55:21 beaglebone kernel: bone-iio-helper helper.14: ready
Jun 24 14:55:21 beaglebone kernel: bone-capemgr bone_capemgr.9: slot #8: Applied #1 overlays.

Jun 24 14:55:52 beaglebone kernel: Unable to handle kernel NULL pointer dereference at virtual address 0000001b
Jun 24 14:55:52 beaglebone kernel: pgd = d9418000
Jun 24 14:55:52 beaglebone kernel: [0000001b] *pgd=993ee831, *pte=00000000, *ppte=00000000
Jun 24 14:55:52 beaglebone kernel: Internal error: Oops: 17 [#1] SMP THUMB2
Jun 24 14:55:52 beaglebone kernel: Modules linked in: fuse ip_tables x_tables g_multi libcomposite rfcomm ircomm_tty ircomm irda ipv6 hidp bluetooth rfkill autofs4
Jun 24 14:55:52 beaglebone kernel: CPU: 0 Not tainted (3.8.13 #1)
Jun 24 14:55:52 beaglebone kernel: PC is at omap_device_idle+0xc/0x3a
Jun 24 14:55:52 beaglebone kernel: LR is at _od_runtime_suspend+0x15/0x18
Jun 24 14:55:52 beaglebone kernel: [99B blob data]
Jun 24 14:55:52 beaglebone kernel: r10: c003d0cd r9 : d93eddb8 r8 : 00000000
Jun 24 14:55:52 beaglebone kernel: r7 : 00000000 r6 : df585480 r5 : df585410 r4 : 00000000
Jun 24 14:55:52 beaglebone kernel: r3 : 00000000 r2 : 000c000b r1 : df585480 r0 : df585400
Jun 24 14:55:52 beaglebone kernel: Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment user
Jun 24 14:55:52 beaglebone kernel: Control: 50c5387d Table: 99418019 DAC: 00000015
Jun 24 14:55:52 beaglebone kernel: Process sh (pid: 630, stack limit = 0xd93ec240)
Jun 24 14:55:52 beaglebone kernel: Stack: (0xd93edd80 to 0xd93ee000)
Jun 24 14:55:52 beaglebone kernel: dd80: 00000000 c001f2c1 00000000 df585410 c001f2ad c01f6ed3 c0626bd8 df585410
Jun 24 14:55:52 beaglebone kernel: dda0: 00000000 c01f7279 00000003 00000000 df585c00 fffffdf4 00000000 40000013
Jun 24 14:55:52 beaglebone kernel: ddc0: df585410 00000000 df585480 40000013 00200200 dc8d39f8 c03a8ed8 c01f7b8f
Jun 24 14:55:52 beaglebone kernel: dde0: 00000000 df585410 c001ead9 00000004 60000013 c01f4c1d df585410 c01f6ed3
Jun 24 14:55:52 beaglebone kernel: de00: c0626bd8 df585410 00000000 c01f74a9 df585410 00000004 df585480 c01f7557
Jun 24 14:55:52 beaglebone kernel: de20: c01fa5f1 df585410 dc93d0d0 c06691f8 00000000 c0201d01 c0201ce3 df585410
Jun 24 14:55:52 beaglebone kernel: de40: c066a1e4 c01f29d5 c01f29c9 c01f1c6d df33dac0 df585444 df585410 c01f1caf
Jun 24 14:55:52 beaglebone kernel: de60: 00000000 df585410 df04643c c01f19a7 df585410 df0b2400 df0b2410 c01f073d
Jun 24 14:55:52 beaglebone kernel: de80: df585400 df0b2400 00000000 c01f2be1 df585400 c01f2d4d d935dd80 c02c8d73
Jun 24 14:55:52 beaglebone kernel: dea0: 00000013 d935dd80 dc8d39c0 dc8d39f8 00100100 c02c8df1 df33dac0 ffffffff
Jun 24 14:55:52 beaglebone kernel: dec0: ffffffb0 dc8d39c8 dc8d39c0 dc8d3a10 d940e000 c02c9307 df592810 00000000
Jun 24 14:55:52 beaglebone kernel: dee0: df112e10 d93edf80 df112e10 c01ff88b 00000008 df304820 d93229d8 c02007e1
Jun 24 14:55:52 beaglebone kernel: [drm:output_poll_execute], [CONNECTOR:5:HDMI-A-1] status updated from 2 to 2
Jun 24 14:55:52 beaglebone kernel: df00: c0688d80 c036f7bb 22222222 22222222 22222222 c020078d d93229c0 d93229d8
Jun 24 14:55:52 beaglebone kernel: df20: d93edf80 00000003 df112e18 c03a8ed8 00000000 c01efbeb df308948 c00cd74d
Jun 24 14:55:52 beaglebone kernel: df40: d93d5180 000d6408 00000003 d93edf80 000d6408 00000003 00000000 c00942d7
Jun 24 14:55:52 beaglebone kernel: df60: d93d5180 000d6408 00000000 00000000 d93d5180 00000000 000d6408 c00944e3
Jun 24 14:55:52 beaglebone kernel: df80: 00000000 00000000 00000003 00000003 000d6408 b6e84a80 00000004 c000c7e4
Jun 24 14:55:52 beaglebone kernel: dfa0: d93ec000 c000c641 00000003 000d6408 00000001 000d6408 00000003 00000000
Jun 24 14:55:52 beaglebone kernel: dfc0: 00000003 000d6408 b6e84a80 00000004 00000003 00000003 000d6408 00000000
Jun 24 14:55:52 beaglebone kernel: dfe0: 00000000 becbf9c4 b6dc0b2c b6e1330c 600f0010 00000001 00000000 00000000
Jun 24 14:55:53 beaglebone kernel: [] (omap_device_idle+0xc/0x3a) from [] (_od_runtime_suspend+0x15/0x18)
Jun 24 14:55:52 beaglebone dropbear[629]: Exit (root): Disconnect received
Jun 24 14:55:53 beaglebone kernel: [] (_od_runtime_suspend+0x15/0x18) from [] (__rpm_callback+0x23/0x40)
Jun 24 14:55:53 beaglebone kernel: [] (__rpm_callback+0x23/0x40) from [] (rpm_suspend+0x1a9/0x2d0)
Jun 24 14:55:53 beaglebone kernel: [] (rpm_suspend+0x1a9/0x2d0) from [] (__pm_runtime_suspend+0x2f/0x62)
Jun 24 14:55:53 beaglebone kernel: [] (__pm_runtime_suspend+0x2f/0x62) from [] (pm_generic_runtime_idle+0x11/0x28)
Jun 24 14:55:53 beaglebone kernel: [] (pm_generic_runtime_idle+0x11/0x28) from [] (__rpm_callback+0x23/0x40)
Jun 24 14:55:53 beaglebone kernel: [] (__rpm_callback+0x23/0x40) from [] (rpm_idle+0xbd/0xec)
Jun 24 14:55:53 beaglebone kernel: [] (rpm_idle+0xbd/0xec) from [] (__pm_runtime_idle+0x2f/0x62)
Jun 24 14:55:53 beaglebone kernel: [] (__pm_runtime_idle+0x2f/0x62) from [] (ti_tscadc_remove+0x1f/0x30)
Jun 24 14:55:53 beaglebone kernel: [] (ti_tscadc_remove+0x1f/0x30) from [] (platform_drv_remove+0xd/0xe)
Jun 24 14:55:53 beaglebone kernel: [] (platform_drv_remove+0xd/0xe) from [] (__device_release_driver+0x41/0x6e)
Jun 24 14:55:53 beaglebone kernel: [] (__device_release_driver+0x41/0x6e) from [] (device_release_driver+0x15/0x1e)
Jun 24 14:55:53 beaglebone kernel: [] (device_release_driver+0x15/0x1e) from [] (bus_remove_device+0x77/0x88)
Jun 24 14:55:53 beaglebone kernel: [] (bus_remove_device+0x77/0x88) from [] (device_del+0xa5/0xec)
Jun 24 14:55:53 beaglebone kernel: [] (device_del+0xa5/0xec) from [] (platform_device_del+0xd/0x30)
Jun 24 14:55:53 beaglebone kernel: [] (platform_device_del+0xd/0x30) from [] (platform_device_unregister+0x9/0x12)
Jun 24 14:55:53 beaglebone kernel: [] (platform_device_unregister+0x9/0x12) from [] (of_overlay_device_entry_change.isra.1+0x8f/0xd8)
Jun 24 14:55:53 beaglebone kernel: [] (of_overlay_device_entry_change.isra.1+0x8f/0xd8) from [] (of_overlay_revert_one+0x35/0x148)
Jun 24 14:55:53 beaglebone kernel: [] (of_overlay_revert_one+0x35/0x148) from [] (of_overlay_revert+0x2b/0x46)
Jun 24 14:55:53 beaglebone kernel: [] (of_overlay_revert+0x2b/0x46) from [] (bone_capemgr_remove_slot_no_lock+0x27/0x94)
Jun 24 14:55:53 beaglebone kernel: [] (bone_capemgr_remove_slot_no_lock+0x27/0x94) from [] (slots_store+0x55/0x25c)
Jun 24 14:55:53 beaglebone kernel: [] (slots_store+0x55/0x25c) from [] (dev_attr_store+0xb/0x12)
Jun 24 14:55:53 beaglebone kernel: [] (dev_attr_store+0xb/0x12) from [] (sysfs_write_file+0x9d/0xd8)
Jun 24 14:55:53 beaglebone kernel: [] (sysfs_write_file+0x9d/0xd8) from [] (vfs_write+0x63/0x104)
Jun 24 14:55:53 beaglebone kernel: [] (vfs_write+0x63/0x104) from [] (sys_write+0x27/0x44)
Jun 24 14:55:53 beaglebone kernel: [] (sys_write+0x27/0x44) from [] (ret_fast_syscall+0x1/0x46)
Jun 24 14:55:53 beaglebone kernel: Code: f8d0 41c8 e000 4604 (7ee3) 2b01
Jun 24 14:55:53 beaglebone kernel: —[ end trace a819f7f439e7436a ]—

Unloading the cape-bone-iio device tree overlay appears to crash
the system. Is real-time unloading not supported at this time (or
by design?)?

Unloading a device tree overlay is a well known way to crash your
system or cause erratic behavior. Device tree was not meant to be
dynamic, and the overlay loading is a BeagleBone specific add-on which
is why it's a bit rough around the edges.

Is there a better way to unload the overlay?

sudo reboot

:slight_smile:

- --
Charles Steinkuehler
charles@steinkuehler.net

Interesting, the reason I bring this up is that there is no issue unexporting the pwm device tree overlay (am33xx_pwm). I’d prefer to return the system to it’s initial state after a ‘cleanup()’, but it appears that may not be the best idea. I did notice bonescript doesn’t unload (unless I missed that code), so that must be the way to go.

Try unloading them in reverse order:

echo -4 > slots
echo -5 > slots
echo -8 > slots

Does it still crash?