summaryrefslogtreecommitdiff
path: root/sys/dev/hwpmc
Commit message (Collapse)AuthorAgeFilesLines
* Fix a LOR between pmc_sx and proctree/allproc when creating a new threadAttilio Rao2009-06-252-7/+19
| | | | | | | | | | | for the pmclog. Reported by: Ryan Stone <rstone at sandvine dot com> Tested by: Ryan Stone <rstone at sandvine dot com> Sponsored by: Sandvine Incorporated Notes: svn path=/head/; revision=195005
* - Add support for nehalem/corei7 cpus. This supports all of the coreJeff Roberson2009-01-273-53/+838
| | | | | | | | | | | counters defined in the reference manual. It does not support the 'uncore' events. Reviewed by: jkoshy Sponsored by: Nokia Notes: svn path=/head/; revision=187761
* Bug fixes:Joseph Koshy2008-12-161-7/+6
| | | | | | | | | | | | | - Initialize variables before use. - Remove a KASSERT() that could falsely trigger if there are other sources of NMIs in the system. Efficiency tweak: - When checking PMCs that overflowed, ignore PMCs that were not configured for sampling. Notes: svn path=/head/; revision=186177
* - Disambiguate a few panic messages.Joseph Koshy2008-12-151-35/+37
| | | | | | | - Style fixes: wrap long lines, parenthesize return values. Notes: svn path=/head/; revision=186127
* - Bug fix: prevent a thread from migrating between CPUs between theJoseph Koshy2008-12-131-16/+60
| | | | | | | | | | | | | | | | time it is marked for user space callchain capture in the NMI handler and the time the callchain capture callback runs. - Improve code and control flow clarity by invoking hwpmc(4)'s user space callchain capture callback directly from low-level code. Reviewed by: jhb (kern/subr_trap.c) Testing (various patch revisions): gnn, Fabien Thomas <fabien dot thomas at netasq dot com>, Artem Belevich <artemb at gmail dot com> Notes: svn path=/head/; revision=186037
* Fixes for Core2 Extreme support.Joseph Koshy2008-12-032-3/+5
| | | | | | | Submitted by: "Artem Belevich" <artemb at gmail dot com> Notes: svn path=/head/; revision=185585
* Add aliases that map architectural event names to fixed function counters.Joseph Koshy2008-12-031-0/+5
| | | | Notes: svn path=/head/; revision=185582
* - Efficiency tweak: when checking for PMC overflows, only go toJoseph Koshy2008-12-022-14/+13
| | | | | | | | | | hardware for PMCs that have been configured for sampling. - Bug fix: acknowledge PMC hardware overflows irrespective of the the (software) PMC's state. Notes: svn path=/head/; revision=185555
* Improve a comment.Joseph Koshy2008-11-301-4/+7
| | | | Notes: svn path=/head/; revision=185465
* - Add support for PMCs in Intel CPUs of Family 6, model 0xE (Core SoloJoseph Koshy2008-11-276-20/+2878
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and Core Duo), models 0xF (Core2), model 0x17 (Core2Extreme) and model 0x1C (Atom). In these CPUs, the actual numbers, kinds and widths of PMCs present need to queried at run time. Support for specific "architectural" events also needs to be queried at run time. Model 0xE CPUs support programmable PMCs, subsequent CPUs additionally support "fixed-function" counters. - Use event names that are close to vendor documentation, taking in account that: - events with identical semantics on two or more CPUs in this family can have differing names in vendor documentation, - identical vendor event names may map to differing events across CPUs, - each type of CPU supports a different subset of measurable events. Fixed-function and programmable counters both use the same vendor names for events. The use of a class name prefix ("iaf-" or "iap-" respectively) permits these to be distinguished. - In libpmc, refactor pmc_name_of_event() into a public interface and an internal helper function, for use by log handling code. - Minor code tweaks: staticize a global, freshen a few comments. Tested by: gnn Notes: svn path=/head/; revision=185363
* Introduce cpu_vendor_id and replace a lot of strcmp(cpu_vendor, "...").Jung-uk Kim2008-11-264-7/+11
| | | | | | | Reviewed by: jhb, peter (early amd64 version) Notes: svn path=/head/; revision=185341
* Unbreak LINT.Joseph Koshy2008-11-224-0/+24
| | | | Notes: svn path=/head/; revision=185168
* Print PMC widths in the initialization announcement.Joseph Koshy2008-11-161-1/+2
| | | | Notes: svn path=/head/; revision=184997
* Correct an oversight: call the MD finalize hook at module unloadJoseph Koshy2008-11-151-0/+3
| | | | | | | time. Notes: svn path=/head/; revision=184994
* Fix assertions.Joseph Koshy2008-11-151-6/+9
| | | | | | | Reported by: keramida Notes: svn path=/head/; revision=184993
* Correct an indexing error (a change missed out in #184802).Joseph Koshy2008-11-151-1/+1
| | | | Notes: svn path=/head/; revision=184992
* - Separate PMC class dependent code from other kinds of machineJoseph Koshy2008-11-0913-912/+1455
| | | | | | | | | | | | | | | | | | | | dependencies. A 'struct pmc_classdep' structure describes operations on PMCs; 'struct pmc_mdep' contains one or more 'struct pmc_classdep' structures depending on the CPU in question. Inside PMC class dependent code, row indices are relative to the PMCs supported by the PMC class; MI code in "hwpmc_mod.c" translates global row indices before invoking class dependent operations. - Augment the OP_GETCPUINFO request with the number of PMCs present in a PMC class. - Move code common to Intel CPUs to file "hwpmc_intel.c". - Move TSC handling to file "hwpmc_tsc.c". Notes: svn path=/head/; revision=184802
* Style tweak.Joseph Koshy2008-11-091-2/+2
| | | | Notes: svn path=/head/; revision=184801
* Remove unnecessary locking around vn_fullpath(). The vnode lock for theJohn Baldwin2008-11-041-2/+0
| | | | | | | | | | | | | | | | | | | vnode in question does not need to be held. All the data structures used during the name lookup are protected by the global name cache lock. Instead, the caller merely needs to ensure a reference is held on the vnode (such as vhold()) to keep it from being freed. In the case of procfs' <pid>/file entry, grab the process lock while we gain a new reference (via vhold()) on p_textvp to fully close races with execve(2). For the kern.proc.vmmap sysctl handler, use a shared vnode lock around the call to VOP_GETATTR() rather than an exclusive lock. MFC after: 1 month Notes: svn path=/head/; revision=184652
* Fix a number of style issues in the MALLOC / FREE commit. I've tried toDag-Erling Smørgrav2008-10-232-15/+13
| | | | | | | | be careful not to fix anything that was already broken; the NFSv4 code is particularly bad in this respect. Notes: svn path=/head/; revision=184214
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).Dag-Erling Smørgrav2008-10-236-55/+50
| | | | | | | MFC after: 3 months Notes: svn path=/head/; revision=184205
* - Sparsely number enumerations 'pmc_cputype' and 'pmc_event' in order toJoseph Koshy2008-10-091-443/+373
| | | | | | | | | | | | | | reduce ABI disruptions when new cpu types and new PMC events are added in the future. - Support alternate spellings for PMC events. Derive the canonical spelling of an event name from its enumeration name in 'enum pmc_event'. - Provide a way for users to disambiguate between identically named events supported by multiple classes of PMCs in a CPU. - Change libpmc's machine-dependent event specifier parsing code to better support CPUs containing two or more classes of PMC resources. Notes: svn path=/head/; revision=183725
* Rework pmc-dependent flag handling.Joseph Koshy2008-10-091-14/+22
| | | | Notes: svn path=/head/; revision=183717
* Correct a typo.Joseph Koshy2008-10-061-1/+1
| | | | Notes: svn path=/head/; revision=183641
* Fix a typo.Joseph Koshy2008-10-041-1/+1
| | | | Notes: svn path=/head/; revision=183588
* Correct misspellings.Joseph Koshy2008-10-021-2/+2
| | | | Notes: svn path=/head/; revision=183535
* Support sparsely numbered CPUs.Joseph Koshy2008-09-224-71/+77
| | | | | | | Requested by: obrien, alfred (long ago) Notes: svn path=/head/; revision=183266
* Correct a callchain capture bug on the i386.Joseph Koshy2008-09-151-3/+3
| | | | | | | | | | | | | | | | On the i386 architecture, the processor only saves the current value of `%esp' on stack if a privilege switch is necessary when entering the interrupt handler. Thus, `frame->tf_esp' is only valid for an entry from user mode. For interrupts taken in kernel mode, we need to determine the top-of-stack for the interrupted kernel procedure by adding the appropriate offset to the current frame pointer. Reported by: kris, Fabien Thomas Tested by: Fabien Thomas <fabien.thomas at netasq dot com> Notes: svn path=/head/; revision=183033
* - Provide kernelname as the name for process with P_KTHREAD set asJeff Roberson2008-07-251-1/+5
| | | | | | | | | | otherwise their textvp is NULL. Reviewed by: jkoshy Sponsored by: Nokia Notes: svn path=/head/; revision=180794
* Sign-extend the 48-bit AMD PMC counter before treating it to a 64-bitAdrian Chadd2008-03-181-5/+8
| | | | | | | | | | | | | | | | | 2's compliment. The 2's compliment transform is done so a "count down" sampling interval can be converted into a "count up" PMC value. a 2's complimented 'count down' value is written to the PMC counter; then the read-back counter is reverted via another 2's compliment. PR: kern/121660 Reviewed by: jkoshy Approved by: jkoshy MFC after: 1 week Notes: svn path=/head/; revision=177344
* Fix the debugging output - the '0x' was duplicated from the %p option.Adrian Chadd2008-03-181-1/+1
| | | | Notes: svn path=/head/; revision=177343
* Correct a typo.Joseph Koshy2008-03-141-2/+6
| | | | Notes: svn path=/head/; revision=177161
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inAttilio Rao2008-01-131-4/+2
| | | | | | | | | | | | | | conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary. KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed. Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com> Notes: svn path=/head/; revision=175294
* vn_lock() is currently only used with the 'curthread' passed as argument.Attilio Rao2008-01-101-1/+1
| | | | | | | | | | | | | | | | | | | Remove this argument and pass curthread directly to underlying VOP_LOCK1() VFS method. This modify makes the code cleaner and in particular remove an annoying dependence helping next lockmgr() cleanup. KPI results, obviously, changed. Manpage and FreeBSD_version will be updated through further commits. As a side note, would be valuable to say that next commits will address a similar cleanup about VFS methods, in particular vop_lock1 and vop_unlock. Tested by: Diego Sardina <siarodx at gmail dot com>, Andrea Di Pasquale <whyx dot it at gmail dot com> Notes: svn path=/head/; revision=175202
* Add stub functions to unbreak LINT.Joseph Koshy2007-12-074-0/+80
| | | | Notes: svn path=/head/; revision=174410
* Kernel and hwpmc(4) support for callchain capture.Joseph Koshy2007-12-076-112/+547
| | | | | | | Sponsored by: FreeBSD Foundation and Google Inc. Notes: svn path=/head/; revision=174395
* Revert revision 1.4.Joseph Koshy2007-11-291-1/+1
| | | | | | | | | | | | | Intel CPUs with family 0x6, model 0xE and later (i.e., Intel Core(TM)) have a PMC architecture that differs somewhat from previous CPUs in family 0x6. Even though the basic programming model is similar, the documented set of legal values that may be loaded into their PMC MSRs differs from that of the previous PMCs in family 0x6 and reusing bit values valid for the older PMCs could result in undefined behaviour in the general case. Notes: svn path=/head/; revision=174071
* Rename the kthread_xxx (e.g. kthread_create()) callsJulian Elischer2007-10-201-2/+2
| | | | | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls. Notes: svn path=/head/; revision=172836
* Commit 14/14 of sched_lock decomposition.Jeff Roberson2007-06-051-6/+6
| | | | | | | | | | | | | | - Use thread_lock() rather than sched_lock for per-thread scheduling sychronization. - Use the per-process spinlock rather than the sched_lock for per-process scheduling synchronization. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each) Notes: svn path=/head/; revision=170307
* Fix witness(4) warnings about mutex use.Joseph Koshy2007-04-193-20/+30
| | | | | | | | | | | | | | | | | | | | | Group mutexes used in hwpmc(4) into 3 "types" in the sense of witness(4): - leaf spin mutexes---only one of these should be held at a time, so these mutexes are specified as belonging to a single witness type "pmc-leaf". - `struct pmc_owner' descriptors are protected by a spin mutex of witness type "pmc-owner-proc". Since we call wakeup_one() while holding these mutexes, the witness type of these mutexes needs to dominate that of "sleepq chain" mutexes. - logger threads use a sleep mutex, of type "pmc-sleep". Submitted by: wkoszek (earlier patch) Notes: svn path=/head/; revision=168856
* Use pause() rather than tsleep() on stack variables and function pointers.John Baldwin2007-02-271-4/+4
| | | | Notes: svn path=/head/; revision=167086
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-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> Notes: svn path=/head/; revision=164033
* Declare security and security.bsd sysctl hierarchies in sysctl.h alongRobert Watson2006-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. Notes: svn path=/head/; revision=162383
* First pass at removing Alpha kernel support.John Baldwin2006-05-111-40/+0
| | | | Notes: svn path=/head/; revision=158458
* Change msleep() and tsleep() to not alter the calling thread's priorityJohn Baldwin2006-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. Notes: svn path=/head/; revision=157815
* Fix a cut-n-paste bug that crept in.Joseph Koshy2006-04-111-2/+2
| | | | | | | Reported by: "Pawel Worach" pawel.worach at gmail.com Notes: svn path=/head/; revision=157651
* Add support for Intel cpu model's 5 & 6.Paul Saab2006-04-041-1/+1
| | | | | | | Approved by: jkoshy Notes: svn path=/head/; revision=157454
* Forcibly turn off all PMCs at module unload time.Joseph Koshy2006-03-281-0/+6
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=157210
* MFP4: Support for profiling dynamically loaded objects.Joseph Koshy2006-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) Notes: svn path=/head/; revision=157144
* When deconfiguring a log, only stop PMCs that are in the RUNNINGJoseph Koshy2006-03-181-1/+2
| | | | | | | state. Notes: svn path=/head/; revision=156834