From owner-freebsd-i386@FreeBSD.ORG Tue Jan 12 11:10:01 2010 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A433C1065676 for ; Tue, 12 Jan 2010 11:10:01 +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 686EE8FC14 for ; Tue, 12 Jan 2010 11:10:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o0CBA18O025494 for ; Tue, 12 Jan 2010 11:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o0CBA1Pa025493; Tue, 12 Jan 2010 11:10:01 GMT (envelope-from gnats) Resent-Date: Tue, 12 Jan 2010 11:10:01 GMT Resent-Message-Id: <201001121110.o0CBA1Pa025493@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Luca Pizzamiglio Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 167911065670 for ; Tue, 12 Jan 2010 11:01:08 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 062A68FC12 for ; Tue, 12 Jan 2010 11:01:08 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o0CB17kN038764 for ; Tue, 12 Jan 2010 11:01:07 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o0CB174V038763; Tue, 12 Jan 2010 11:01:07 GMT (envelope-from nobody) Message-Id: <201001121101.o0CB174V038763@www.freebsd.org> Date: Tue, 12 Jan 2010 11:01:07 GMT From: Luca Pizzamiglio To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: i386/142742: pmcstat segmentation fault with Intel Core CPU X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2010 11:10:01 -0000 >Number: 142742 >Category: i386 >Synopsis: pmcstat segmentation fault with Intel Core CPU >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jan 12 11:10:00 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Luca Pizzamiglio >Release: 7-STABLE >Organization: >Environment: FreeBSD pcXX.xxxx.de 7.2-STABLE FreeBSD 7.2-STABLE #0 r2462M: Tue Dec 22 12:31:48 CET 2009 root@pcXX.xxxx.de:/usr/obj/usr/home/prog/svnsys/src_7stable/sys/BW7Dev i386 >Description: pmcstat utility crashes with a segmentation fault. I've analyzed the problem that resides in the libpmc library. For INTEL CORE architecture (PMC_CPU_INTEL_CORE), initialization of the pmc_class_table[] array of lib/libpmc/libpmc.c is not completed and this causes the segmentation fault during the use of the pmcstat utility. The CPU I'm using now has the follow level 1 CPUID: cpuid level 0x1: 0x000006ec 0x00010800 0x0000c109 0xafe9fbff that means: Family 0x600 and Model 0x0e >How-To-Repeat: Running pmcstat with an INTEL CORE CPU. The problem appears both in sampling and counting mode. >Fix: I propose a patch to solve this problem: I've tested a bit and seems to work. This patch corrects the set up of the pmc_class_table[] array of lib/libpmc/libpmc.c when a PMC_CPU_INTEL_CORE CPU is recognized. Patch attached with submission follows: --- lib/libpmc/libpmc.c.orig 2010-01-11 16:43:47.000000000 +0100 +++ lib/libpmc/libpmc.c 2010-01-11 16:43:59.000000000 +0100 @@ -2507,6 +2507,7 @@ break; case PMC_CPU_INTEL_CORE: PMC_MDEP_INIT(core); + pmc_class_table[n] = &core_class_table_descr; break; case PMC_CPU_INTEL_CORE2: case PMC_CPU_INTEL_CORE2EXTREME: >Release-Note: >Audit-Trail: >Unformatted: