Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/subr_prof.c
RevisionDateAuthorComments
 1.50  14-Aug-2021  ryo Improved the performance of kernel profiling on MULTIPROCESSOR, and possible to get profiling data for each CPU.

In the current implementation, locks are acquired at the entrance of the mcount
internal function, so the higher the number of cores, the more lock conflict
occurs, making profiling performance in a MULTIPROCESSOR environment unusable
and slow. Profiling buffers has been changed to be reserved for each CPU,
improving profiling performance in MP by several to several dozen times.

- Eliminated cpu_simple_lock in mcount internal function, using per-CPU buffers.
- Add ci_gmon member to struct cpu_info of each MP arch.
- Add kern.profiling.percpu node in sysctl tree.
- Add new -c <cpuid> option to kgmon(8) to specify the cpuid, like openbsd.
For compatibility, if the -c option is not specified, the entire system can be
operated as before, and the -p option will get the total profiling data for
all CPUs.
 1.49  06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.48  04-Feb-2018  maxv branches: 1.48.4;
Add a proper defflag for GPROF, and include opt_gprof.h, otherwise we're
not gonna go very far.
 1.47  10-Jul-2014  christos don't cast void * in c.
 1.46  25-Feb-2014  pooka branches: 1.46.2;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.45  17-Dec-2009  rmind branches: 1.45.12; 1.45.22; 1.45.26;
Replace few USER_TO_UAREA/UAREA_TO_USER uses, reduce sys/user.h inclusions.
 1.44  12-Dec-2009  dsl Fix comment for arg types of sys_profil().
 1.43  20-Dec-2007  dsl branches: 1.43.10; 1.43.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.42  19-Oct-2007  ad branches: 1.42.4; 1.42.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.41  09-Jul-2007  ad branches: 1.41.6; 1.41.8; 1.41.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.40  06-Mar-2007  drochner branches: 1.40.2; 1.40.4;
use char* for the kernel representation of the user profile buffer
address too, for consistency
(we've lost some abstraction here)
 1.39  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.38  09-Feb-2007  ad branches: 1.38.2;
Merge newlock2 to head.
 1.37  13-Dec-2006  christos add missing initializer.
 1.36  01-Nov-2006  yamt branches: 1.36.2;
remove some __unused from function parameters.
 1.35  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.34  04-Oct-2006  christos lowercase roundup/down
 1.33  11-Dec-2005  christos branches: 1.33.20; 1.33.22;
merge ktrace-lwp.
 1.32  23-Jun-2005  thorpej branches: 1.32.2;
Use ANSI function decls.
 1.31  08-Apr-2004  atatat Lots of sysctl descriptions (if someone wants to help out here, that
would be good) mostly copied from sysctl(3). This takes care of the
top-level, most of kern.* and hw.* (modulo the ath and bge stuff), and
all of proc.*.

If you don't want the added rodata in your kernel, use "options
SYSCTL_NO_DESCR" in your kernel config.
 1.30  24-Mar-2004  atatat branches: 1.30.2;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.29  04-Dec-2003  atatat Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.28  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.27  01-Feb-2003  thorpej branches: 1.27.2;
Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.26  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.25  12-Nov-2001  lukem add RCSIDs
 1.24  29-Oct-2001  simonb Don't need to include <uvm/uvm_extern.h> just to include <sys/sysctl.h>
anymore.
 1.23  28-Apr-2001  bjh21 branches: 1.23.2; 1.23.6;
Before allowing kgmon to do anything, check that we managed to allocate the
profiling buffer at startup. If not, pretend the kernel doesn't have
profiling support at all.
 1.22  10-Dec-2000  mycroft branches: 1.22.2;
Introduce PROC_PC(), which is used to get a process's user PC. If this is
defined, call addupc_intr() directly from statclock() in the system time case,
using the same P_OWEUPC path if the copyin/copyout fails.
Use this in i386 to remove profiling code from the normal userret() path.
 1.21  27-Jun-2000  mrg remove include of <vm/vm.h>
 1.20  30-Mar-2000  augustss Get rid of register declarations.
 1.19  04-Aug-1998  perry branches: 1.19.12;
Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) -> memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
bcmp(x, y, z) -> memcmp(x, y, z)
bzero(x, y) -> memset(x, 0, y)
 1.18  31-Jul-1998  perry fix sizeofs so they comply with the KNF style guide. yes, it is pedantic.
 1.17  01-Mar-1998  fvdl branches: 1.17.2;
Merge with Lite2 + local changes
 1.16  17-Oct-1997  jonathan Add #include <sys/sysctl.h>, which in turn needs #include <vm/vm.h>.
 1.15  18-Dec-1996  gwr As discussed, replace KERNBASE with kernel_text.
 1.14  13-Oct-1996  christos backout previous kprintf change
 1.13  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.12  22-Apr-1996  christos remove include of <sys/cpu.h>
 1.11  17-Mar-1996  pk Remove extraneous argument from sysctl_doprof().
Fix a printf format.
 1.10  09-Feb-1996  christos More proto fixes
 1.9  04-Feb-1996  christos First pass at prototyping
 1.8  22-Nov-1995  cgd change definition of profil() to make it 64-bit friendly. This has
no practical consequence on 32-bit systems. old prototype was
int profil(char *, int, int, int), and new one is int profile(char *,
size_t, u_long, u_int). the size_t is the size of the buffer,
and the u_long is the 'starting offset'. (I changed the last int
to u_int, because it's treated as a u_int everywhere, and isn't
logically a signed value.)
 1.7  07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.6  19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.5  19-Mar-1995  mycroft Use %p.
 1.4  20-Oct-1994  cgd update for new syscall args description mechanism
 1.3  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.2  07-May-1994  cgd sysctl kernel prof info
 1.1  05-May-1994  cgd branches: 1.1.1;
lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.1.1.2  01-Mar-1998  fvdl Import 4.4BSD-Lite2
 1.1.1.1  01-Mar-1998  fvdl Import 4.4BSD-Lite for reference
 1.17.2.1  08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.19.12.2  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.19.12.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.22.2.5  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.22.2.4  29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.22.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.22.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.22.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.23.6.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.23.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.4  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.27.2.1  03-Aug-2004  skrll Sync with HEAD
 1.30.2.1  21-Apr-2004  jmc Pullup rev 1.31 (requested by atatat in ticket #93)

Lots of sysctl descriptions mostly copied from sysctl(3).
 1.32.2.5  21-Jan-2008  yamt sync with head
 1.32.2.4  27-Oct-2007  yamt sync with head.
 1.32.2.3  03-Sep-2007  yamt sync with head.
 1.32.2.2  26-Feb-2007  yamt sync with head.
 1.32.2.1  30-Dec-2006  yamt sync with head.
 1.33.22.3  18-Dec-2006  yamt sync with head.
 1.33.22.2  10-Dec-2006  yamt sync with head.
 1.33.22.1  22-Oct-2006  yamt sync with head
 1.33.20.10  06-Feb-2007  ad mcount(): fix entry so LOCKDEBUG+GPROF can be used together. Previously
it would recurse until eventually the machine triple faulted.
 1.33.20.9  05-Feb-2007  ad IPL_STATCLOCK needs to be >= IPL_CLOCK, so assume that proc::p_stmutex is
always a spinlock.
 1.33.20.8  31-Jan-2007  ad Don't allow LOCKDEBUG+GPROF, it doesn't work and makes no sense.
 1.33.20.7  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.33.20.6  16-Jan-2007  ad Minor corrections.
 1.33.20.5  12-Jan-2007  ad Sync with head.
 1.33.20.4  29-Dec-2006  ad Checkpoint work in progress.
 1.33.20.3  18-Nov-2006  ad Sync with head.
 1.33.20.2  17-Nov-2006  ad Checkpoint work in progress.
 1.33.20.1  20-Oct-2006  ad - Update for need_proftick() change.
- Make run time per-LWP and have calcru() compute the whole-process value.
- Minor locking changes.
 1.36.2.1  29-Dec-2006  riz Pull up following revision(s) (requested by liamjfoy in ticket #295):
sys/kern/subr_prof.c: revision 1.37
add missing initializer.
 1.38.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.40.4.1  11-Jul-2007  mjf Sync with head.
 1.40.2.2  23-Oct-2007  ad Sync with head.
 1.40.2.1  21-Mar-2007  ad GC the simplelock/spinlock debugging stuff.
 1.41.12.1  25-Oct-2007  bouyer Sync with HEAD.
 1.41.8.2  09-Jan-2008  matt sync with HEAD
 1.41.8.1  06-Nov-2007  matt sync with HEAD
 1.41.6.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.42.8.1  02-Jan-2008  bouyer Sync with HEAD
 1.42.4.1  26-Dec-2007  ad Sync with head.
 1.43.12.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.43.12.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.43.10.1  11-Mar-2010  yamt sync with head
 1.45.26.1  18-May-2014  rmind sync with head
 1.45.22.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.45.12.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.2.1  10-Aug-2014  tls Rebase.
 1.48.4.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed