summaryrefslogtreecommitdiffstats
path: root/sys/dev/hwpmc
Commit message (Collapse)AuthorAgeFilesLines
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-7/+12
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Declare security and security.bsd sysctl hierarchies in sysctl.h alongrwatson2006-09-171-2/+0
| | | | | | | | with other commonly used sysctl name spaces, rather than declaring them all over the place. MFC after: 1 month Sponsored by: nCircle Network Security, Inc.
* First pass at removing Alpha kernel support.jhb2006-05-111-40/+0
|
* Change msleep() and tsleep() to not alter the calling thread's priorityjhb2006-04-171-8/+1
| | | | | | | | | | | | if the specified priority is zero. This avoids a race where the calling thread could read a snapshot of it's current priority, then a different thread could change the first thread's priority, then the original thread would call sched_prio() inside msleep() undoing the change made by the second thread. I used a priority of zero as no thread that calls msleep() or tsleep() should be specifying a priority of zero anyway. The various places that passed 'curthread->td_priority' or some variant as the priority now pass 0.
* Fix a cut-n-paste bug that crept in.jkoshy2006-04-111-2/+2
| | | | Reported by: "Pawel Worach" pawel.worach at gmail.com
* Add support for Intel cpu model's 5 & 6.ps2006-04-041-1/+1
| | | | Approved by: jkoshy
* Forcibly turn off all PMCs at module unload time.jkoshy2006-03-281-0/+6
| | | | MFC after: 1 week
* MFP4: Support for profiling dynamically loaded objects.jkoshy2006-03-262-16/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel changes: Inform hwpmc of executable objects brought into the system by kldload() and mmap(), and of their removal by kldunload() and munmap(). A helper function linker_hwpmc_list_objects() has been added to "sys/kern/kern_linker.c" and is used by hwpmc to retrieve the list of currently loaded kernel modules. The unused `MAPPINGCHANGE' event has been deprecated in favour of separate `MAP_IN' and `MAP_OUT' events; this change reduces space wastage in the log. Bump the hwpmc's ABI version to "2.0.00". Teach hwpmc(4) to handle the map change callbacks. Change the default per-cpu sample buffer size to hold 32 samples (up from 16). Increment __FreeBSD_version. libpmc(3) changes: Update libpmc(3) to deal with the new events in the log file; bring the pmclog(3) manual page in sync with the code. pmcstat(8) changes: Introduce new options to pmcstat(8): "-r" (root fs path), "-M" (mapfile name), "-q"/"-v" (verbosity control). Option "-k" now takes a kernel directory as its argument but will also work with the older invocation syntax. Rework string handling in pmcstat(8) to use an opaque type for interned strings. Clean up ELF parsing code and add support for tracking dynamic object mappings reported by a v2.0.00 hwpmc(4). Report statistics at the end of a log conversion run depending on the requested verbosity level. Reviewed by: jhb, dds (kernel parts of an earlier patch) Tested by: gallatin (earlier patch)
* When deconfiguring a log, only stop PMCs that are in the RUNNINGjkoshy2006-03-181-1/+2
| | | | state.
* When compiled with -DDEBUG, only print the old value of a PMC in ajkoshy2006-03-161-1/+1
| | | | | | | | | debugging message if the flag PMC_F_OLDVALUE was specified in the PMC_OP_RW request being acted upon. This should fix Coverity bug CID 671. Found by: Coverity Prevent MFC after: 3 weeks
* When a process is de-configuring a log file, also stop all of itsjkoshy2006-03-092-5/+8
| | | | | | | | PMCs that require a log file to operate. This change should fix PR 90269. PR: kern/90269 MFC after: 1 week
* Fix a memory leak.jkoshy2006-01-171-5/+7
| | | | Found by: Coverity
* - Plug a memory leak: free up per-cpu sample buffers at module unload time.jkoshy2005-12-261-3/+14
| | | | - Correct a few style nits.
* Wrap comment lines to be under 80 characters wide.jkoshy2005-12-261-2/+3
| | | | MFC after: 3 days
* Fix -Wundef warnings found when compiling i386 LINT, GENERIC andru2005-12-054-27/+27
| | | | custom kernels.
* Add support for a new/unreleased Pentium-M.ps2005-11-181-1/+1
| | | | Reviewed by: jkoshy
* Bug fix initialization on multi-core HTT CPUs.jkoshy2005-10-101-46/+59
| | | | | Reported by: ps Tested by: ps
* Process one NMI interrupt per handler invocation as the processorjkoshy2005-09-121-4/+9
| | | | | | | | 'buffers' pending NMIs from multiple interrupting PMCs and delivers them serially. Reported by: Olivier Crameri <olivier.crameri@epfl.ch> MFC after: 3 days
* Re-enable sampling on the AMD64.jkoshy2005-08-271-5/+0
|
* On x86 processors, turn off any 'INTERRUPT' capabilities on PMCsjkoshy2005-08-221-3/+13
| | | | | | if the CPU does not have its local APIC enabled. MFC after: 3 days
* Return EOPNOTSUPP instead of EINVAL if a PMC allocation requestjkoshy2005-08-221-1/+15
| | | | | | | | specifies a PMC capability (e.g., sampling) that is not supported by hardware. Return EINVAL early if the PMC class passed in is not recognized. MFC after: 3 days
* Print PMC capabilities at module load time.jkoshy2005-08-221-3/+9
| | | | MFC after: 3 days
* Turn off sampling modes on the AMD64 till the time I can track downjkoshy2005-08-221-0/+5
| | | | | | the reason for the double fault seen when sampling under load. MFC after: 3 days
* Fail the module loading process if the currently executing kerneljkoshy2005-07-301-0/+12
| | | | | | | | was not compiled with 'options HWPMC_HOOKS' or if the compiled-in version numbers of the kernel and module are out of sync. Reported by: cracauer MFC after: 3 days
* Use LK_CANRECURSE since when a PMC-owning process performs an exec,jkoshy2005-07-171-1/+1
| | | | | | the new text vnode is already locked by itself. MFC after: 3 days
* Convert the atomic_ptr() operations over to operating on uintptr_tjhb2005-07-151-1/+2
| | | | | | | | | | variables rather than void * variables. This makes it easier and simpler to get asm constraints and volatile keywords correct. MFC after: 3 days Tested on: i386, alpha, sparc64 Compiled on: ia64, powerpc, amd64 Kernel toolchain busted on: arm
* Fix breakage introduced in rev 1.7.jkoshy2005-07-141-1/+1
| | | | MFC after: 3 days
* sys/dev/hwpmc/hwpmc_{amd,piv,ppro}.c:jkoshy2005-07-095-34/+44
| | | | | | | | | | | | | | | | | | - Update driver interrupt statistics correctly. sys/sys/pmc.h, sys/dev/hwpmc/hwpmc_mod.c: - Fix a bug affecting debug printfs. - Move the 'stalled' flag from being in a bit in the 'pm_flags' field of a 'struct pmc' to a field of its own in the same structure. This flag is updated from the NMI handler and keeping it separate makes it easier to avoid races with other parts of the code. sys/dev/hwpmc/hwpmc_logging.c: - Do arithmetic with 'uintptr_t' types rather that casting to and from 'char *'. Approved by: re (scottl)
* - Update the CPU version check to recognize P4/EMT64 CPUs. [1]jkoshy2005-07-031-1/+1
| | | | | | | | | - Allow libpmc(3) to support P4/EMT64 PMCs on the amd64 architecture and AMD K8 PMCs on the i386. [2] Submitted by: ps [1] Pointy hat: myself [2] Approved by: re (scottl)
* MFP4:jkoshy2005-06-302-24/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - pmcstat(8) gprof output mode fixes: lib/libpmc/pmclog.{c,h}, sys/sys/pmclog.h: + Add a 'is_usermode' field to the PMCLOG_PCSAMPLE event + Add an 'entryaddr' field to the PMCLOG_PROCEXEC event, so that pmcstat(8) can determine where the runtime loader /libexec/ld-elf.so.1 is getting loaded. sys/kern/kern_exec.c: + Use a local struct to group the entry address of the image being exec()'ed and the process credential changed flag to the exec handling hook inside hwpmc(4). usr.sbin/pmcstat/*: + Support "-k kernelpath", "-D sampledir". + Implement the ELF bits of 'gmon.out' profile generation in a new file "pmcstat_log.c". Move all log related functions to this file. + Move local definitions and prototypes to "pmcstat.h" - Other bug fixes: + lib/libpmc/pmclog.c: correctly handle EOF in pmclog_read(). + sys/dev/hwpmc_mod.c: unconditionally log a PROCEXIT event to all attached PMCs when a process exits. + sys/sys/pmc.h: correct a function prototype. + Improve usage checks in pmcstat(8). Approved by: re (blanket hwpmc)
* Fix a -Wuninitialized warning reported by rwatson.jkoshy2005-06-211-1/+2
| | | | Approved by: re (blanket hwpmc)
* MFP4:jkoshy2005-06-0917-1196/+3896
| | | | | | | | | | | | | | | | - Implement sampling modes and logging support in hwpmc(4). - Separate MI and MD parts of hwpmc(4) and allow sharing of PMC implementations across different architectures. Add support for P4 (EMT64) style PMCs to the amd64 code. - New pmcstat(8) options: -E (exit time counts) -W (counts every context switch), -R (print log file). - pmc(3) API changes, improve our ability to keep ABI compatibility in the future. Add more 'alias' names for commonly used events. - bug fixes & documentation.
* Kernel hooks to support PMC sampling modes.jkoshy2005-05-303-3/+6
| | | | Reviewed by: alc
* Add convenience APIs pmc_width() and pmc_capabilities() to -lpmc.jkoshy2005-05-015-296/+625
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Have pmcstat(8) and pmccontrol(8) use these APIs. Return PMC class-related constants (PMC widths and capabilities) with the OP GETCPUINFO call leaving OP PMCINFO to return only the dynamic information associated with a PMC (i.e., whether enabled, owner pid, reload count etc.). Allow pmc_read() (i.e., OPS PMCRW) on active self-attached PMCs to get upto-date values from hardware since we can guarantee that the hardware is running the correct PMC at the time of the call. Bug fixes: - (x86 class processors) Fix a bug that prevented an RDPMC instruction from being recognized as permitted till after the attached process had context switched out and back in again after a pmc_start() call. Tighten the rules for using RDPMC class instructions: a GETMSR OP is now allowed only after an OP ATTACH has been done by the PMC's owner to itself. OP GETMSR is not allowed for PMCs that track descendants, for PMCs attached to processes other than their owner processes. - (P4/HTT processors only) Fix a bug that caused the MI and MD layers to get out of sync. Add a new MD operation 'get_config()' as part of this fix. - Allow multiple system-mode PMCs at the same row-index but on different CPUs to be allocated. - Reject allocation of an administratively disabled PMC. Misc. code cleanups and refactoring. Improve a few comments.
* Return the correct register number in the 'get_msr()' MD function.jkoshy2005-04-284-21/+78
| | | | | | | | Only allow a process to use the x86 RDPMC instruction if it has allocated and attached a PMC to itself. Inform the MD layer of the "pseudo context switch out" that needs to be done when the last thread of a process is exiting.
* Include <sys/pmc.h> instead of <machine/pmc_mdep.h>. The MI headermarcel2005-04-206-12/+5
| | | | | | | | includes the MD header for us. Do not include <machine/specialreg.h> as it is not a header file that can be included from MI files. It is included from <machine/pmc_mdep.h> if so needed and possible. Ok'd: jkoshy@
* Remove dead variable.jkoshy2005-04-201-3/+2
|
* Remove unused variable that was horking up the LINT buildimp2005-04-191-5/+2
|
* Minimal changes to get this to compile with -DDEBUG defined as wellimp2005-04-191-1/+3
| | | | as hack a couple used before set warnings for LINT happiness.
* Bring a working snapshot of hwpmc(4), its associated libraries, userland ↵jkoshy2005-04-196-0/+7086
utilities and documentation into -CURRENT. Bump FreeBSD_version. Reviewed by: alc, jhb (kernel changes)
OpenPOWER on IntegriCloud