Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Jan 2002 17:24:39 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        k Macy <kip_macy@yahoo.com>
Cc:        "Alan L. Cox" <alc@imimic.com>, <freebsd-current@FreeBSD.ORG>
Subject:   Re: profiled kernel build fails was Re: -CURRENT AIO bug
Message-ID:  <20020120164213.L7131-100000@gamplex.bde.org>
In-Reply-To: <20020120023902.23973.qmail@web14007.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 19 Jan 2002, k Macy wrote:

> Thanks for working on this. I was going to try running
> a profiled kernel on -CURRENT and -STABLE to see what
> the difference was in time distribution. On -STABLE
> it built without a hitch. However, on -CURRENT I got
> the following even after doing a make clean:
>
> ../../../libkern/mcount.c: In function `mcount':
> ../../../libkern/mcount.c:91: `mcount_lock' undeclared
> (first use in this function)

The mcount_lock stuff apparently never even compiled.  It is only used
for the !GUPROF && SMP case, but it cannot work in that case since
mcount_lock is not declared.  Unfortunately, LINT only tests the GUPROF
case, which compiles but is even more broken at runtime in the SMP
case.  GUPROF worse fine in the !SMP case and should be non-optional
(it gives about 100000 times as much resolution as PROF on current
machines, instead of only 1000 times as much as on 486's when it was
written).

This fix has not been tested.  It has some chance of working, because
RELENG_4 uses similar code.  However, it is certainly broken if the
atomic functions that it calls are not inlined (then the functions will
call MCOUNT_ENTER() on entry).  I think this only happens if mcount.c
is compiled with -O0.  This bug is missing in RELENG_4 too.

%%%
Index: profile.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/profile.h,v
retrieving revision 1.25
diff -u -2 -r1.25 profile.h
--- profile.h	30 Oct 2001 15:04:57 -0000	1.25
+++ profile.h	20 Jan 2002 06:05:24 -0000
@@ -65,4 +65,5 @@
 #define	MCOUNT_DECL(s)	u_long s;
 #ifdef SMP
+extern int	mcount_lock;
 #define	MCOUNT_ENTER(s)	{ s = read_eflags(); disable_intr(); \
  			  while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1)) \
%%%

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020120164213.L7131-100000>