Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Enabling profiling makes the kernel panic




Before you ask, I'm using NetBSD/i386 because it supports MULTIBOOT and so it can
be started with qemu/kvm under Linux with the -kernel flag.

First things first, building with the following parameters:

CONFIGOPTS="-p" ./build.sh -U -u -j4 -T obj/tooldir -m i386 kernel=VIRTIO

gives the following:

--- mcount.po --- In file included from /home/imil/src/NetBSD-src/sys/sys/gmon.h:37, from /home/imil/src/NetBSD-src/sys/lib/libkern/../../../common/lib/libc/gmon/mcount
.c:84:
/home/imil/src/NetBSD-src/sys/lib/libkern/../../../common/lib/libc/gmon/mcount.c: In function 'mcount':
../.././machine/profile.h:78:24: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror=frame-address]
   78 |  frompcindex = ((int *)__builtin_frame_address(1))[1];  \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~ /home/imil/src/NetBSD-src/sys/lib/libkern/../../../common/lib/libc/gmon/mcount.c:281:1: note: in expansion of macro 'MCOUNT'
  281 | MCOUNT
      | ^~~~~~

I have to add the following CFLAGS to have the build finished successfuly:

CFLAGS="-Wno-error=frame-address" ./build.sh -V CONFIGOPTS="-p" -U -u -j4 -T obj/tooldir -m i386 kernel=VIRTIO

Booting this kernel gives no output at all:

$ qemu-system-i386 -enable-kvm -m 256 -kernel netbsd-current-prof -append "-v console=com root=ld0a -v -d" -drive file=rescue.img,if=virtio -serial mon:stdio -display none

Booting the same kernel without profiling works as intended.

FWIW, booting a NetBSD 9.3_STABLE kernel with profiling enabled panic()s later:

[   1.0000030] allocated pic ioapic0 type edge pin 4 level 8 to cpu0 slot 0 idt entry 129
[   1.0000030] timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
[   1.0000030] uvm_fault(0xc02db700, 0, 2) -> 0xe
[   1.0000030] fatal page fault in supervisor mode
[   1.0000030] trap type 6 code 0x2 eip 0xc023345a cs 0x8 eflags 0x10217 cr2 0 ilevel 0x6 esp 0xc0231f28
[   1.0000030] curlwp 0xc02a1000 pid 0 lid 1 lowest kstack 0xc02e52c0
kernel: supervisor trap page fault, code=0
Stopped in pid 0.1 (system) at  c023345a:       movw    %cx,0(%eax)
db{0}>

How to proceed from there?

------------------------------------------------------------------------
Emile `iMil' Heitor <imil@{home.imil.net,NetBSD.org}> | https://imil.net



Home | Main Index | Thread Index | Old Index