From owner-freebsd-bugs@FreeBSD.ORG Mon Mar 12 19:30:13 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8DD9106568C for ; Mon, 12 Mar 2012 19:30:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8D2B88FC1D for ; Mon, 12 Mar 2012 19:30:13 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q2CJUDQb040496 for ; Mon, 12 Mar 2012 19:30:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q2CJUDuh040494; Mon, 12 Mar 2012 19:30:13 GMT (envelope-from gnats) Resent-Date: Mon, 12 Mar 2012 19:30:13 GMT Resent-Message-Id: <201203121930.q2CJUDuh040494@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Vitaly Magerya Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82BE21065673 for ; Mon, 12 Mar 2012 19:21:18 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 58DBB8FC18 for ; Mon, 12 Mar 2012 19:21:18 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q2CJLI7H052800 for ; Mon, 12 Mar 2012 19:21:18 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q2CJLHwC052798; Mon, 12 Mar 2012 19:21:17 GMT (envelope-from nobody) Message-Id: <201203121921.q2CJLHwC052798@red.freebsd.org> Date: Mon, 12 Mar 2012 19:21:17 GMT From: Vitaly Magerya To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/165984: pmc(3) causes kernel panic when sampling current process X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2012 19:30:13 -0000 >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 #include #include 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: