Opened 11 years ago

Closed 3 years ago

#3237 closed bug (no change required)

Trace buffer size not checked if fits in memory

Reported by: Adek336 Owned by: axeld
Priority: normal Milestone: R1
Component: System/Kernel Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All


Hybrid build hrev28827 with 200 MiB trace buffer run under QEMU with 200 MiB hangs after showing the boot screen; none of the boot icons are alight. F12 doesn't open the KDL.

qemu -s and gdb provided the following backtrace

#0  0x800556ba in spin ()
#1  0x800b88c8 in arch_debug_blue_screen_getchar ()
#2  0x80057ee1 in blue_screen_getchar ()
#3  0x80059905 in read_line ()
#4  0x8005a4d4 in kernel_debugger ()
#5  0x8005a67b in panic ()
#6  0x800364b5 in ConditionVariableEntry::Wait ()
#7  0x800366ed in ConditionVariable::Wait ()
#8  0x8003e2f8 in low_resource ()
#9  0x800a94fe in vm_try_reserve_memory ()
#10 0x800abafd in vm_create_anonymous_area ()
#11 0x800ac204 in create_area ()
#12 0x8005e6f2 in tracing_init ()
#13 0x80059c92 in debug_init_post_vm ()
#14 0x8003ef3f in _start ()

and the following panic message

(gdb) up
#6  0x8005a67b in panic ()
(gdb) info frame
Stack level 6, frame at 0x80204d48:
 eip = 0x8005a67b in panic; saved eip 0x800364b5
 called by frame at 0x80204d88, caller of frame at 0x80204c98
 Arglist at 0x80204d40, args:
 Locals at 0x80204d40, Previous frame's sp is 0x80204d48
 Saved registers:
  ebx at 0x80204d3c, ebp at 0x80204d40, eip at 0x80204d44
(gdb) x/12xw 0x80204d40
0x80204d40:     0x80204d80      0x800364b5      0x800f201c      0x80204dc0
0x80204d50:     0x80109788      0x00200092      0x00bfe883      0x00000000
0x80204d60:     0x80204d90      0x80036307      0x801064b8      0x00000000
(gdb) x/s 0x800f201c
0x800f201c:      "ConditionVariableEntry::Wait() called with interrupts disabled, entry: %p, variable: %p"

Entering "reb<cr>" reboots the machine.

Change History (5)

comment:1 by Adek336, 11 years ago

With qemu -serial stdio:

Load kernel...
video mode: 1024x768x24
smp: found 1 cpu
smp: apic_phys = 0xfee00000
smp: ioapic_phys = 0xfec00000
smp: apic = 0x8069d000
smp: ioapic = 0x8069e000
APIC ticks/sec = 998405238
kernel entry at 8003edfa
Welcome to kernel debugger output!
Haiku revision: 28827
CPU 0: type 0 family 6 extended_family 0 model 3 extended_model 0 stepping 3, string 'GenuineIntel'
CPU 0: features: fpu de pse tsc msr pae mce cx8 apic sep pge cmov pat mmx fxsr sse sse2 sse3
heap_add_area: area -1 added to small heap 0x80ea4000 - usable range 0x80eab000 - 0x812a4000
heap_add_area: area -1 added to medium heap 0x812a4000 - usable range 0x812a5000 - 0x8150a000
heap_add_area: area -1 added to large heap 0x8150a666 - usable range 0x8150b000 - 0x816a4000
slab: init base 0x816a4000 + 0x2000
vm_mark_page_range_inuse: page 0x9f in non-free state 7!
PANIC: ConditionVariableEntry::Wait() called with interrupts disabled, entry: 0x80204dc0, variable: 0x80109788
Welcome to Kernel Debugging Land...
Thread 0 "" running on CPU 0
kdebug> bt
Unknown command "bt". Enter "help" to get a list of all supported commands.

comment:2 by Adek336, 11 years ago

Obviously 200 MiB is more than the default 128 MiB RAM size in QEMU. qemu -m 400 makes Haiku work just fine!

Too bad the kernel debugger isn't shown on screen when Haiku panics at such an early stage (#3238). If it did show up, it would be reasonable to panic with a message "Trace buffer too large".

comment:3 by Adek336, 11 years ago

And resizing the trace buffer or at least disabling tracing.

comment:4 by Adek336, 11 years ago

Summary: Hybrid boot fail in QEMU with large trace bufferTrace buffer size not checked if fits in memory

comment:5 by axeld, 3 years ago

Component: - GeneralSystem/Kernel
Resolution: no change required
Status: newclosed

Since you have to compile your own kernel in order to use that feature in the first place, you should also be able to adapt the memory requirement as needed. If the tracing ever gets always enabled, the situation would be different, of course.

Note: See TracTickets for help on using tickets.