kfb assertion failure (old >= 0) on BeagleBoard-xM
As of current master (https://github.com/HelenOS/helenos/commit/37d4c915fb39ff74e65cfe063a2abfd05093b32d) kfb will fail an assertion failure on BeagleBoard-xM built with default configuration:
OK
## Transferring control to NetBSD stage-2 loader (at address 80000000) ...
HelenOS bootloader, release 0.9.1 (Armonia), revision 37d4c915f
Built on 2020-11-20 17:16:28 for arm32
Copyright (c) 2001-2019 HelenOS project
Boot loader: 0x80000000 -> 0x8000dd1c
Memory statistics
0x8000d000|0x8000d000: bootstrap stack
0x80008000|0x80008000: bootstrap page table
0x8000d818|0x8000d818: boot info structure
0x80a00000|0x80a00000: kernel entry point
Boot loader: 0x80000000 -> 0x8000dd1c
Payload: 0x8000dd1c -> 0x8028651c
Kernel load address: 0x80a00000
Kernel start: 0x80a00000
RAM end: 0x81a00000 (16777216 bytes available)
Inflating components ...
0x80a00000|0x80a00000: kernel.elf.gz image (498204/148007 bytes)
0x80a7a000|0x80a7a000: ns.gz image (109868/50394 bytes)
0x80a95000|0x80a95000: loader.gz image (116424/53928 bytes)
0x80ab2000|0x80ab2000: init.gz image (140576/63708 bytes)
0x80ad5000|0x80ad5000: locsrv.gz image (125436/57862 bytes)
0x80af4000|0x80af4000: rd.gz image (116248/53519 bytes)
0x80b11000|0x80b11000: vfs.gz image (140140/63730 bytes)
0x80b34000|0x80b34000: logger.gz image (122368/56051 bytes)
0x80b52000|0x80b52000: ext4fs.gz image (177924/81761 bytes)
0x80b7e000|0x80b7e000: initrd.img.gz image (12582912/1947403 bytes)
Done.
Booting the kernel...
SPARTAN kernel, release 0.9.1 (Armonia), revision 37d4c915f
Built on 2020-11-20 17:16:28 for arm32
Copyright (c) 2001-2019 HelenOS project
Detected 1 CPU(s), 524288 KiB free memory
Found DCache L1: 4-way, 128 sets, 64 byte lines (shifts: w29, s6)
Found DCache L2: 8-way, 512 sets, 64 byte lines (shifts: w28, s6)
Detected VFPv3+ with 32 regs
Program loader at 0xc001f000
Kernel console ready (press any key to activate)
RAM disk at 0x80b7e000 (size 12582912 bytes)
[init:ns(2)] ns: HelenOS IPC Naming Service
[init:ns(2)] ns: Accepting connections
[init:init(3)] init: HelenOS init
[init:locsrv(4)] loc: HelenOS Location Service
[init:rd(5)] rd: HelenOS RAM disk server
[init:rd(5)] rd: Found RAM disk at 0x80b7e000, 12582912 bytes
[init:vfs(6)] vfs: HelenOS VFS server
[init:logger(7)] logger: HelenOS Logging Service
[init:ext4fs(8)] ext4fs: HelenOS ext4 file system server
[init:logger(7)] logger: Accepting connections
[init:locsrv(4)] loc: Accepting connections
[init:vfs(6)] vfs: Accepting connections
[init:rd(5)] rd: Accepting connections
[init:ext4fs(8)] ext4fs: Accepting connections
[init:init(3)] init: Root file system mounted on / (ext4fs at bd/initrd)
[init:init(3)] init: Unable to stat /srv/fs/tmpfs
[init:init(3)] init: Unable to stat /srv/fs/exfat
[init:init(3)] init: Unable to stat /srv/fs/fat
[init:init(3)] init: Unable to stat /srv/fs/cdfs
[init:init(3)] init: Unable to stat /srv/fs/mfs
[init:init(3)] init: Starting /srv/klog
[kernel/other] note: Program loader at 0xc001f000
[init:init(3)] init: Starting /srv/fs/locfs
[kernel/other] note: RAM disk at 0x80b7e000 (size 12582912 bytes)
[/srv/fs/locfs(10)] locfs: HelenOS Device Filesystem
[/srv/fs/locfs(10)] locfs: Accepting connections
[init:init(3)] init: Unable to stat /srv/taskmon
[init:init(3)] init: Location service file system mounted on /loc (locfs)
[init:init(3)] init: Temporary file system not mounted on /tmp ([ENOFS] No such)
[init:init(3)] init: Starting /srv/devman
[/srv/devman(11)] devman: HelenOS Device Manager
[/srv/devman(11)] devman: Accepting connections.
[/drv/root/root(12)] root: HelenOS root device driver
[init:init(3)] init: Unable to stat /srv/hid/s3c24xx_uart
[devman] note: The `root' driver was successfully registered as running.
[init:init(3)] init: Unable to stat /srv/hid/s3c24xx_ts
[init:init(3)] init: Unable to stat /srv/bd/vbd
[init:init(3)] init: Unable to stat /srv/volsrv
[init:init(3)] init: Unable to stat /srv/net/loopip
[init:init(3)] init: Unable to stat /srv/net/ethip
[init:init(3)] init: Unable to stat /srv/net/inetsrv
[init:init(3)] init: Unable to stat /srv/net/tcp
[init:init(3)] init: Unable to stat /srv/net/udp
[init:init(3)] init: Unable to stat /srv/net/dnsrsrv
[init:init(3)] init: Unable to stat /srv/net/dhcp
[init:init(3)] init: Unable to stat /srv/net/nconfsrv
[init:init(3)] init: Unable to stat /srv/clipboard
[init:init(3)] init: Unable to stat /srv/hid/remcons
[init:init(3)] init: Starting /srv/hid/input
[/drv/amdm37x/amdm37x(14)] amdm37x: HelenOS AM/DM37x(OMAP37x) platform driver
[/drv/virt/virt(13)] virt: HelenOS virtual devices root driver
[devman] note: The `amdm37x' driver was successfully registered as running.
[devman] note: The `virt' driver was successfully registered as running.
[/srv/hid/input(15)] input: HelenOS input service
[amdm37x] note: Base frequency: 13.0Mhz
[/srv/hid/input(15)] input: Accepting connections
[virt] note: Registered child device `kfb'
[init:init(3)] init: Starting /srv/hid/output
[amdm37x] note: MPU running at 600.0 MHz
[amdm37x] note: CORE CLK running at 332.0 MHz
[amdm37x] note: L3 interface at 166.0 MHz
[amdm37x] error: USB TLL is not accessible
[amdm37x] fatal: Failed to init USB TLL!.
[/drv/kfb/kfb(16)] kfb: HelenOS kernel framebuffer driver
[/srv/hid/output(17)] output: HelenOS output service
[/srv/hid/output(17)] output: Accepting connections
[devman] note: The `kfb' driver was successfully registered as running.
[init:init(3)] init: Unable to stat /srv/audio/hound
[init:init(3)] Error contacting volume service.
[/drv/kfb/kfb(16)] Assertion failed (old >= 0) in task 16, file "../uspace/lib/.
Task /drv/kfb/kfb (16) killed due to an exception at program counter 0x00000000.
r0 =0x7017eca0 r1 =0x00214e74 r2 =0x70176b4c r3 =0x00000000
r4 =0x00214e74 r5 =0x00214e30 r6 =0x00000014 r7 =0x70181810
r8 =0x7017eca0 r9 =0x00113824 r10=0x00113a00 fp =0x00214e5c
r12=0x00214e20 sp =0x00214e20 lr =0x70176ab8 spsr=0x20000050
0x00214e5c: 0x00000000()
0x00214e74: 0x70176b68()
0x00214e94: 0x701772e4()
0x00214ebc: 0x00102b70()
0x00214efc: 0x0010156c()
0x00214f0c: 0x001018b4()
0x00214f7c: 0x001033c8()
0x00214fe4: 0x70169c80()
0x00214ff4: 0x70163928()
Kill message: Page fault: 0x00000000.
[init:init(3)] init: Starting /srv/hid/display
[/srv/hid/display(18)] display: Display server
[display] error: No output device found.
[init:init(3)] init: Server /srv/hid/display failed to start (exit code 1)
[init:init(3)] init: Starting /srv/hid/console
[/srv/hid/console(19)] console: HelenOS Console service
[/srv/hid/console(19)] console: Accepting connections
[init:init(3)] init: Spawning /app/getterm term/vc0 /loc --msg --wait -- /app/bh
[init:init(3)] init: Spawning /app/getterm term/vc1 /loc --wait -- /app/bdsh
[init:init(3)] init: Spawning /app/getterm term/vc2 /loc --wait -- /app/bdsh
[init:init(3)] init: Spawning /app/getterm term/vc3 /loc --wait -- /app/bdsh
[init:init(3)] init: Spawning /app/getterm term/vc4 /loc --wait -- /app/bdsh
[init:init(3)] init: Spawning /app/getterm term/vc5 /loc --wait -- /app/bdsh
kconsole>
Root cause: If kernel frame buffer was not present (sysinfo key 'fb' not set), kfb driver would perform a double ddf_fun_destroy(fun) in port_init().
Fixed in commit b27553c1c5a811aeba3e07e95c353cebbbed5ccd.