From owner-freebsd-current Sat Jan 19 22:23:32 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 4165C37B404 for ; Sat, 19 Jan 2002 22:23:27 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id RAA22564; Sun, 20 Jan 2002 17:23:13 +1100 Date: Sun, 20 Jan 2002 17:24:39 +1100 (EST) From: Bruce Evans X-X-Sender: To: k Macy Cc: "Alan L. Cox" , Subject: Re: profiled kernel build fails was Re: -CURRENT AIO bug In-Reply-To: <20020120023902.23973.qmail@web14007.mail.yahoo.com> Message-ID: <20020120164213.L7131-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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