Wednesday, January 26, 2011

kernel crash dump use ELF core file format.

NetBSD currently dumps its kernel crashes in a NetBSD specific format. This requires gdb to know how to read them (and be linked against libkbm).

Instead, NetBSD should dump kernel core dumps as a ELF core dump (just like any other application). User pages would not be dumped. There would be a note section for each LWP allowing automatic viewing of the LWP's register using the normal gdb thread command (encoding the thread id might get tricky for system LWPs or processes with multiple LWPs).

ELF phdrs would be written so that gdb can automagically map kernel virtual addresses to physical addresses (including direct mapped pages for PMAP_MAP_POOLPAGE support). This may require a lot of phdrs but that's true even for normal ELF core files.

1 comment:

  1. The huge balloon of phdrs could be a problem with debuggers. It's a lot less compact than simply writing out the page tables that's done now.

    This could probably be mitigated with changes to how the memory allocator works. Allocating larger chunks of physically-contig memory, setting up a mapping, and then splitting it up into fragments could greatly reduce both phdr bloat as well as allow the use of large pages to reduce TLB thrash on platforms that don't have the direct-mapped segments.

    Geezus we should just get rid of the gawd-awful kernel malloc() once and for all. And maybe get the other stuff stacked on top of a real vmem implementation that doesn't use pools. And then maybe continue to enhance the kmem allocator so we can get off of the pool API completely.

    Or something.

    ReplyDelete