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

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)) \


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to