From nobody@FreeBSD.org  Thu Apr 21 04:13:45 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 14482106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Apr 2011 04:13:45 +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 045C88FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Apr 2011 04:13:45 +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 p3L4DinR086561
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Apr 2011 04:13:44 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p3L4DiqN086532;
	Thu, 21 Apr 2011 04:13:44 GMT
	(envelope-from nobody)
Message-Id: <201104210413.p3L4DiqN086532@red.freebsd.org>
Date: Thu, 21 Apr 2011 04:13:44 GMT
From: Arnaud Lacombe <lacombar@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: hwpmc(4) crash when loaded on unknown AMD cpu
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         156540
>Category:       kern
>Synopsis:       [hwpmc] hwpmc(4) crash when loaded on unknown AMD cpu
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 21 04:20:06 UTC 2011
>Closed-Date:    Sun Sep 02 02:16:09 UTC 2012
>Last-Modified:  Sun Sep 02 02:16:09 UTC 2012
>Originator:     Arnaud Lacombe
>Release:        HEAD
>Organization:
n/a
>Environment:
>Description:
Loading hwpmc.ko on a net5501 (AMD Geode LX) trigger the following crash:

# kldload hwpmc
pmc: Unknown AMD CPU.


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x8
fault code              = supervisor read, page not present
instruction pointer     = 0x20:0xc22b9e63
stack pointer           = 0x28:0xc6f9a960
frame pointer           = 0x28:0xc6f9a974
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, def32 1, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 1318 (kldload)
[ thread pid 1318 tid 100037 ]
Stopped at      pmc_md_initialize+0x93: movl    0x8(%edx),%edx
db> bt
Tracing pid 1318 tid 100037 td 0xc20c18a0
pmc_md_initialize(c6f9a9b8,246,c07ff47a,c20c1950,c07ff47a,...) at pmc_md_initialize+0x93
pmc_initialize(0,0,c6f9aa00,c05adbcb,c1f0f2c0,...) at pmc_initialize+0xfc
load(c1f0f2c0,0,0,a2,d2,...) at load+0x31
syscall_module_handler(c1f0f2c0,0,c22c03a0,75,30c,...) at syscall_module_handler+0xcb
module_register_init(c22c03d0,0,c07fa9d4,e6,0,...) at module_register_init+0xb1
linker_load_module(0,c2154000,0,0,c6f9ac18,...) at linker_load_module+0xa35
kern_kldload(c20c18a0,c2154000,c6f9ac40,0,c20c5000,...) at kern_kldload+0xd6
kldload(c20c18a0,c6f9acec,0,c0833534,0,...) at kldload+0x79
syscallenter(c20c18a0,c6f9ace4,c07b2fc0,c0892750,0,...) at syscallenter+0x263
syscall(c6f9ad28) at syscall+0x39
Xint0x80_syscall() at Xint0x80_syscall+0x2b
--- syscall (304, FreeBSD ELF32, kldload), eip = 0x280d612b, esp = 0xbfbfe76c, ebp = 0xbfbfec58 ---
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Apr 25 03:46:11 UTC 2011 
Responsible-Changed-Why:  
reclassify. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156540 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/156540: commit references a PR
Date: Sat, 28 Jan 2012 01:39:03 +0000 (UTC)

 Author: emaste
 Date: Sat Jan 28 01:38:48 2012
 New Revision: 230636
 URL: http://svn.freebsd.org/changeset/base/230636
 
 Log:
   pmc_*_initialize may return NULL if the CPU is not supported, so check
   that md is not null before dereferencing it.
   
   PR:		kern/156540
 
 Modified:
   head/sys/dev/hwpmc/hwpmc_x86.c
 
 Modified: head/sys/dev/hwpmc/hwpmc_x86.c
 ==============================================================================
 --- head/sys/dev/hwpmc/hwpmc_x86.c	Sat Jan 28 00:17:17 2012	(r230635)
 +++ head/sys/dev/hwpmc/hwpmc_x86.c	Sat Jan 28 01:38:48 2012	(r230636)
 @@ -250,7 +250,7 @@ pmc_md_initialize()
  		return (NULL);
  
  	/* disallow sampling if we do not have an LAPIC */
 -	if (!lapic_enable_pmc())
 +	if (md != NULL && !lapic_enable_pmc())
  		for (i = 1; i < md->pmd_nclass; i++)
  			md->pmd_classdep[i].pcd_caps &= ~PMC_CAP_INTERRUPT;
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: emaste 
State-Changed-When: Tue Feb 7 02:55:50 UTC 2012 
State-Changed-Why:  
Fixed in r230636 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156540 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/156540: commit references a PR
Date: Mon, 20 Aug 2012 14:54:42 +0000 (UTC)

 Author: emaste
 Date: Mon Aug 20 14:54:30 2012
 New Revision: 239433
 URL: http://svn.freebsd.org/changeset/base/239433
 
 Log:
   MFC r230636:
   
     pmc_*_initialize may return NULL if the CPU is not supported, so check
     that md is not null before dereferencing it.
   
   PR:             kern/156540
 
 Modified:
   stable/9/sys/dev/hwpmc/hwpmc_x86.c
 Directory Properties:
   stable/9/sys/   (props changed)
   stable/9/sys/dev/   (props changed)
 
 Modified: stable/9/sys/dev/hwpmc/hwpmc_x86.c
 ==============================================================================
 --- stable/9/sys/dev/hwpmc/hwpmc_x86.c	Mon Aug 20 14:52:43 2012	(r239432)
 +++ stable/9/sys/dev/hwpmc/hwpmc_x86.c	Mon Aug 20 14:54:30 2012	(r239433)
 @@ -252,7 +252,7 @@ pmc_md_initialize()
  		return (NULL);
  
  	/* disallow sampling if we do not have an LAPIC */
 -	if (!lapic_enable_pmc())
 +	if (md != NULL && !lapic_enable_pmc())
  		for (i = 0; i < md->pmd_nclass; i++) {
  			if (i == PMC_CLASS_INDEX_SOFT)
  				continue;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: eadler 
State-Changed-When: Sun Sep 2 02:16:07 UTC 2012 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156540 
>Unformatted:
