Date: Mon, 12 Mar 2012 19:21:17 GMT From: Vitaly Magerya <vmagerya@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/165984: pmc(3) causes kernel panic when sampling current process Message-ID: <201203121921.q2CJLHwC052798@red.freebsd.org> Resent-Message-ID: <201203121930.q2CJUDuh040494@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 165984
>Category: kern
>Synopsis: pmc(3) causes kernel panic when sampling current process
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Mar 12 19:30:13 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Vitaly Magerya
>Release: FreeBSD 8.2-RELEASE amd64
>Organization:
>Environment:
FreeBSD tx97.net 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
While trying to use pmc(3) framework to sample current process, I'm
reliably getting a panic. The message on the screen says:
kernel trap 9 with interrupt disabled
Fatal trap 9: general protection fault while in kernel mode
cpuid = 0; apic id = 00
instruction pointer = 0x20:0xffffffff80e81707
stack pointer = 0x28:0xffffffff80bd68d0
frame pointer = 0x28:0xffffffff80bd6920
code segment = base 0x0, limit 0xfffff, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags = resume, IOPL = 0
current process = 10201 (a.out)
trap number = 9
panic: general protection fault
pcuid = 0
KDB: stack backtrace:
#0 0xffffffff805f4e0e at kdb_backtrace+0x5e
#1 0xffffffff805c2d07 at panic+0x187
#2 0xffffffff808ac600 at trap_fatal+0x290
#3 0xffffffff808acbe9 at trap+0x109
#4 0xffffffff80894fb4 at calltrap+0x8
#5 0xffffffff808acc30 at trap+0x150
#6 0xffffffff80895384 at nmi_calltrap+0x8
Uptime: 16h57m31s
Cannot dump. Device not defined or unavailable.
Automatic reboot in 15 seconds - press a key on the console to abort
The system is an Intel Atom 330 box running FreeBSD 8.2 amd64.
If it makes any difference, here's what I have in /boot/loader.conf:
kern.hwpmc.nsamples="64"
kern.hwpmc.nbuffers="64"
I can provide more details about my box on request, but the problem
may be generic.
>How-To-Repeat:
Take the program below, compile it, load hwpmc(4) kernel module and
execute the program, like this:
# kldload hwpmc
$ cc -lpmc crash.c
$ ./a.out
---- crash.c ----
#include <sys/types.h>
#include <pmc.h>
#include <fcntl.h>
int main() {
pmc_id_t pmcid;
pmc_value_t value;
int fd, i;
pmc_init();
pmc_allocate("instructions", PMC_MODE_TS, 0, PMC_CPU_ANY, &pmcid);
fd = open("pmc.log", O_WRONLY|O_CREAT|O_TRUNC, 0666);
pmc_configure_logfile(fd);
pmc_start(pmcid);
for (i = 0; i < 10*1000000; i++);
pmc_stop(pmcid);
pmc_flush_logfile();
pmc_release(pmcid);
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203121921.q2CJLHwC052798>
