From owner-freebsd-bugs Sun May 4 12:30:04 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id MAA12424 for bugs-outgoing; Sun, 4 May 1997 12:30:04 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.5/8.8.5) id MAA12415; Sun, 4 May 1997 12:30:02 -0700 (PDT) Date: Sun, 4 May 1997 12:30:02 -0700 (PDT) Message-Id: <199705041930.MAA12415@hub.freebsd.org> To: freebsd-bugs Cc: From: Bruce Evans Subject: Re: kern/3491: kernel profiling broken with SMP kernel Reply-To: Bruce Evans Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The following reply was made to PR kern/3491; it has been noted by GNATS. From: Bruce Evans To: andreas@klemm.gtn.com, FreeBSD-gnats-submit@FreeBSD.ORG Cc: Subject: Re: kern/3491: kernel profiling broken with SMP kernel Date: Mon, 5 May 1997 05:16:56 +1000 >Tried to create a kernel with enhanced profiling support. Don't do that. Even ordinary profiling doesn't actually work in SMP kernels. For ordinary profiling, I think clock interrupts are taken by only one (random) CPU and the other CPUs aren't accounted for. I think they need to all take clock interrupts and all except one handle only per-CPU profiling. A single profiling buffer should work OK unless you are interested in per-CPU statistics, but accesses to it would have to be locked. For enhanced profiling, there is a TSC and a set of performance counters for each CPU, so the global variables related to these must be arrays in the SMP case. This is not implemented. >Browsed through .../isa/clock.c >Seems to be ifdef'ed out for the SMP case ... Why ? > >[...snip...] >#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP) >u_int i586_ctr_bias; >u_int i586_ctr_comultiplier; >u_int i586_ctr_freq; >u_int i586_ctr_multiplier; >#endif These need to be arrays, except possibly if the CPU frequencies are almost the same (e.g., +-1% for profiling and +-0.001% for timekeeping). Bruce