From nobody@FreeBSD.org  Tue Jul 19 17:26:35 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 03DE916A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Jul 2005 17:26:35 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B515B43D46
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Jul 2005 17:26:34 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j6JHQYWe016719
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Jul 2005 17:26:34 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j6JHQX98016604;
	Tue, 19 Jul 2005 17:26:33 GMT
	(envelope-from nobody)
Message-Id: <200507191726.j6JHQX98016604@www.freebsd.org>
Date: Tue, 19 Jul 2005 17:26:33 GMT
From: trasz <trasz@buziaczek.pl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: kldload hwpmc.ko fails with 'link_elf: symbol lapic undefined'.
X-Send-Pr-Version: www-2.3

>Number:         83738
>Category:       kern
>Synopsis:       [modules] kldload hwpmc.ko fails with 'link_elf: symbol lapic undefined'.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          suspended
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 19 17:30:11 GMT 2005
>Closed-Date:    
>Last-Modified:  Wed Jul 03 00:54:16 UTC 2013
>Originator:     trasz
>Release:        6.0-BETA1
>Organization:
>Environment:
FreeBSD traszkan.ds7 6.0-BETA1 FreeBSD 6.0-BETA1 #0: Sun Jul 17 01:48:54 CEST 2005     root@:/usr/obj/usr/src/sys/TRASHCAN  i386

>Description:
      an attempt to 'kldload hwpmc.ko' fails with 'link_elf: symbol lapic undefined' on this hardware.  it's unsupported by hwpmc anyway (k6-2), but i guess it should fail in slightly more 'informative' way.
>How-To-Repeat:
      
>Fix:
      
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jkoshy 
Responsible-Changed-By: jkoshy 
Responsible-Changed-When: Mon Dec 12 14:16:30 UTC 2005 
Responsible-Changed-Why:  
Take ownership. 

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

From: Joseph Koshy <jkoshy@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: jkoshy@FreeBSD.org
Subject: Re: kern/83738: [modules] kldload hwpmc.ko fails with 'link_elf: symbol lapic undefined'
Date: Mon, 12 Dec 2005 15:33:16 GMT

 Do you have 'device apic' in your kernel config?
 
 We need a way to communicate the configuration options for a kernel
 to the modules being built for it.  If this were possible we could
 avoid compiling the code that uses the local apic when the base
 kernel doesn't have APIC support enabled.

From: <freebsd@simplerezo.com>
To: <bug-followup@FreeBSD.org>, <trasz@buziaczek.pl>
Cc:  
Subject: Re: kern/83738: [modules] kldload hwpmc.ko fails with 'link_elf: symbol lapic undefined'.
Date: Wed, 28 Dec 2005 19:18:52 +0100

 Building a kernel 6.0-RELEASE with PMC and without APIC failed:
  
 --------------------------------------------
 linking kernel
 hwpmc_x86.o(.text+0x5): In function `pmc_x86_lapic_enable_pmc_interrupt':
 : undefined reference to `lapic'
 hwpmc_x86.o(.text+0x206): In function `pmc_md_initialize':
 : undefined reference to `lapic'
 *** Error code 1
  
 Stop in /usr/obj/usr/src/sys/KERNEL.
 *** Error code 1
  
 Stop in /usr/src.
 *** Error code 1
  
 Stop in /usr/src.
 --------------------------------------------
  
 So it seems look like APIC is mandatory for PMC... and this should be
 mentioned in KERNEL file.
 

From: jkoshy@FreeBSD.ORG (Joseph Koshy)
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: kern/83738: [modules] kldload hwpmc.ko fails with 'link_elf: 
 symbol lapic undefined'.
Date: Thu, 29 Dec 2005 02:29:15 +0000 (GMT)

 >  So it seems look like APIC is mandatory for PMC... and this should be
 >  mentioned in KERNEL file.
 
 I've added a mention to the 'NOTES' file that additional architecture specific
 configuration options are documented in the hwpmc(4) manual page.
 
 Regards,
 Koshy
 <jkoshy@freebsd.org>
 
State-Changed-From-To: open->suspended 
State-Changed-By: jkoshy 
State-Changed-When: Thu Jan 5 03:08:48 UTC 2006 
State-Changed-Why:  
'sys/conf/NOTES' now warns that hwpmc may require additional 
architecture specific configuration options, and that these are 
documented in the hwpmc(4) manual page. 

I'm changing the state of the PR to 'suspended' till I find a way 
of compiling the hwpmc module to match the kernel it is going to 
run under.  I.e., if 'device apic' is missing in an i386 kernel 
configuration file then compiled hwpmc.ko should not refer to the 
'lapic' symbol (and therefore not support sampling either). 


http://www.freebsd.org/cgi/query-pr.cgi?pr=83738 
State-Changed-From-To: suspended->suspended 
State-Changed-By: linimon 
State-Changed-When: Wed Jul 3 00:50:32 UTC 2013 
State-Changed-Why:  
commit bit has been taken in for safekeeping. 


Responsible-Changed-From-To: jkoshy->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Jul 3 00:50:32 UTC 2013 
Responsible-Changed-Why:  

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

I get this from ktrace:

1286 kldload  NAMI  "/boot/kernel/hwpmc.ko"
  1286 kldload  RET   kldload -1 errno 2 No such file or directory
  1286 kldload  CALL  write(0x2,0xbfbfe270,0x9)
  1286 kldload  GIO   fd 2 wrote 9 bytes
       "kldload: "
  1286 kldload  RET   write 9
  1286 kldload  CALL  write(0x2,0xbfbfe290,0x13)
  1286 kldload  GIO   fd 2 wrote 19 bytes
       "can't load hwpmc.ko"
  1286 kldload  RET   write 19/0x13
  1286 kldload  CALL  write(0x2,0x2812c210,0x2)
  1286 kldload  GIO   fd 2 wrote 2 bytes
       ": "
  1286 kldload  RET   write 2
  1286 kldload  CALL  write(0x2,0xbfbfe270,0x1a)
  1286 kldload  GIO   fd 2 wrote 26 bytes
       "No such file or directory
       "
  1286 kldload  RET   write 26/0x1a
  1286 kldload  CALL  exit(0x1)
