xref: /freebsd/share/man/man4/hwpmc.4 (revision 3642298923e528d795e3a30ec165d2b469e28b40)
1.\" Copyright (c) 2003-2005 Joseph Koshy
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd April 15, 2005
28.Dt HWPMC 4
29.Os
30.Sh NAME
31.Nm hwpmc
32.Nd "Hardware Performance Monitoring Counter support"
33.Sh SYNOPSIS
34.Cd "options HWPMC_HOOKS"
35.Cd "device hwpmc"
36.Sh DESCRIPTION
37The
38.Nm
39driver virtualizes the hardware performance monitoring facilities in
40modern CPUs and provides support for using these facilities from
41user level processes.
42.Pp
43The driver supports multi-processor systems.
44.Pp
45PMCs are allocated using the
46.Dv PMC_OP_PMCALLOCATE
47request.
48A successful
49.Dv PMC_OP_PMCALLOCATE
50request will return an integer handle (typically a small integer) to
51the requesting process.
52Subsequent operations on the allocated PMC use this handle to denote
53the specific PMC.
54A process that has successfully allocated a PMC is termed an
55.Dq "owner process" .
56.Pp
57PMCs may be allocated to operate in process-private or in system-wide
58modes.
59.Bl -tag -width ".Em Process-private"
60.It Em Process-private
61In process-private mode, a PMC is active only when a thread belonging
62to a process it is attached to is scheduled on a CPU.
63.It Em System-wide
64In system-wide mode, a PMC operates independently of processes and
65measures hardware events for the system as a whole.
66.El
67.Pp
68The
69.Nm
70driver supports the use of hardware PMCs for counting or for
71sampling:
72.Bl -tag -width ".Em Counting"
73.It Em Counting
74In counting modes, the PMCs count hardware events.
75These counts are retrievable using the
76.Dv PMC_OP_PMCREAD
77system call on all architectures, though some architectures like the
78x86 and amd64 offer faster methods of reading these counts.
79.It Em Sampling
80In sampling modes, where PMCs are configured to sample the CPU
81instruction pointer after a configurable number of hardware events
82have been observed.
83These instruction pointer samples are directed to a log file for
84subsequent analysis.
85.El
86.Pp
87These modes of operation are orthogonal; a PMC may be configured to
88operate in one of four modes:
89.Bl -tag -width indent
90.It Process-private, counting
91These PMCs count hardware events whenever a thread in their attached process is
92scheduled on a CPU.
93These PMCs normally count from zero, but the initial count may be
94set using the
95.Dv PMC_OP_SETCOUNT
96operation.
97Applications can read the value of the PMC anytime using the
98.Dv PMC_OP_PMCRW
99operation.
100.It Process-private, sampling
101These PMCs sample the target processes instruction pointer after they
102have seen the configured number of hardware events.
103The PMCs only count events when a thread belonging to their attached
104process is active.
105The desired frequency of sampling is set using the
106.Dv PMC_OP_SETCOUNT
107operation prior to starting the PMC.
108Log files are configured using the
109.Dv PMC_OP_CONFIGURELOG
110operation.
111.It System-wide, counting
112These PMCs count hardware events seen by them independent of the
113processes that are executing.
114The current count on these PMCs can be read using the
115.Dv PMC_OP_PMCRW
116request.
117These PMCs normally count from zero, but the initial count may be
118set using the
119.Dv PMC_OP_SETCOUNT
120operation.
121.It System-wide, sampling
122These PMCs will periodically sample the instruction pointer of the CPU
123they are allocated on, and will write the sample to a log for further
124processing.
125The desired frequency of sampling is set using the
126.Dv PMC_OP_SETCOUNT
127operation prior to starting the PMC.
128Log files are configured using the
129.Dv PMC_OP_CONFIGURELOG
130operation.
131.Pp
132System-wide statistical sampling can only be enabled by a process with
133super-user privileges.
134.El
135.Pp
136Processes are allowed to allocate as many PMCs are the hardware and
137current operating conditions permit.
138Processes may mix allocations of system-wide and process-private
139PMCs.
140Multiple processes are allowed to be concurrently using the facilities
141of the
142.Nm
143driver.
144.Pp
145Allocated PMCs are started using the
146.Dv PMC_OP_PMCSTART
147operation, and stopped using the
148.Dv PMC_OP_PMCSTOP
149operation.
150Stopping and starting a PMC is permitted at any time the owner process
151has a valid handle to the PMC.
152.Pp
153Process-private PMCs need to be attached to a target process before
154they can be used.
155Attaching a process to a PMC is done using the
156.Dv PMC_OP_PMCATTACH
157operation.
158An already attached PMC may be detached from its target process
159using the converse
160.Dv PMC_OP_PMCDETACH
161operation.
162Issuing a
163.Dv PMC_OP_PMCSTART
164operation on an as yet unattached PMC will cause it to be attached
165to its owner process.
166The following rules determine whether a given process may attach
167a PMC to another target process:
168.Bl -bullet -compact
169.It
170A non-jailed process with super-user privileges is allowed to attach
171to any other process in the system.
172.It
173Other processes are only allowed to attach to targets that they would
174be able to attach to for debugging (as determined by
175.Xr p_candebug 9 ) .
176.El
177.Pp
178PMCs are released using
179.Dv PMC_OP_PMCRELEASE .
180After a successful
181.Dv PMC_OP_PMCRELEASE
182operation the handle to the PMC will become invalid.
183.Ss Modifier Flags
184The
185.Dv PMC_OP_PMCALLOCATE
186operation supports the following flags that modify the behavior
187of an allocated PMC:
188.Bl -tag -width indent
189.It Dv PMC_F_DESCENDANTS
190This modifier is valid only for a PMC being allocated in process-private
191mode.
192It signifies that the PMC will track hardware events for its
193target process and the target's current and future descendants.
194.It Dv PMC_F_KGMON
195This modifier is valid only for a PMC being allocated in system-wide
196sampling mode.
197It signifies that the PMC's sampling interrupt is to be used to drive
198kernel profiling via
199.Xr kgmon 8 .
200.It Dv PMC_F_LOG_PROCCSW
201This modifier is valid only for a PMC being allocated in process-private
202mode.
203When this modifier is present, at every context switch,
204.Nm
205will log a record containing the number of hardware events
206seen by the target process when it was scheduled on the CPU.
207.It Dv PMC_F_LOG_PROCEXIT
208This modifier is valid only for a PMC being allocated in process-private
209mode.
210With this modifier present,
211.Nm
212will maintain per-process counts for each target process attached to
213a PMC.
214At process exit time, a record containing the target process' PID and
215the accumulated per-process count for that process will be written to the
216configured log file.
217.El
218.Pp
219Modifiers
220.Dv PMC_F_LOG_PROCEXIT
221and
222.Dv PMC_F_LOG_PROCCSW
223may be used in combination with modifier
224.Dv PMC_F_DESCENDANTS
225to track the behaviour of complex pipelines of processes.
226PMCs with modifiers
227.Dv PMC_F_LOG_PROCEXIT
228and
229.Dv PMC_F_LOG_PROCCSW
230cannot be started until their owner process has configured a log file.
231.Ss Signals
232The
233.Nm
234driver may deliver signals to processes that have allocated PMCs:
235.Bl -tag -width ".Dv SIGBUS"
236.It Dv SIGIO
237A
238.Dv PMC_OP_PMCRW
239operation was attempted on a process-private PMC that does not have
240attached target processes.
241.It Dv SIGBUS
242The
243.Nm
244driver is being unloaded from the kernel.
245.El
246.Sh PROGRAMMING API
247The recommended way for application programs to use the facilities of
248the
249.Nm
250driver is using the API provided by the
251.Xr pmc 3
252library.
253.Pp
254The
255.Nm
256driver operates using a system call number that is dynamically
257allotted to it when it is loaded into the kernel.
258.Pp
259The
260.Nm
261driver supports the following operations:
262.Bl -tag -width indent
263.It Dv PMC_OP_CONFIGURELOG
264Configure a log file for sampling mode PMCs.
265.It Dv PMC_OP_FLUSHLOG
266Transfer buffered log data inside
267.Nm
268to a configured output file.
269This operation returns to the caller after the write operation
270has returned.
271.It Dv PMC_OP_GETCPUINFO
272Retrieve information about the number of CPUs on the system and
273the number of hardware performance monitoring counters available per-CPU.
274.It Dv PMC_OP_GETDRIVERSTATS
275Retrieve module statistics (for analyzing the behavior of
276.Nm
277itself).
278.It Dv PMC_OP_GETMODULEVERSION
279Retrieve the version number of API.
280.It Dv PMC_OP_GETPMCINFO
281Retrieve information about the current state of the PMCs on a
282given CPU.
283.It Dv PMC_OP_PMCADMIN
284Set the administrative state (i.e., whether enabled or disabled) for
285the hardware PMCs managed by the
286.Nm
287driver.
288.It Dv PMC_OP_PMCALLOCATE
289Allocate and configure a PMC.
290On successful allocation, a handle to the PMC (a small integer)
291is returned.
292.It Dv PMC_OP_PMCATTACH
293Attach a process mode PMC to a target process.
294The PMC will be active whenever a thread in the target process is
295scheduled on a CPU.
296.Pp
297If the
298.Dv PMC_F_DESCENDANTS
299flag had been specified at PMC allocation time, then the PMC is
300attached to all current and future descendants of the target process.
301.It Dv PMC_OP_PMCDETACH
302Detach a PMC from its target process.
303.It Dv PMC_OP_PMCRELEASE
304Release a PMC.
305.It Dv PMC_OP_PMCRW
306Read and write a PMC.
307This operation is valid only for PMCs configured in counting modes.
308.It Dv PMC_OP_SETCOUNT
309Set the initial count (for counting mode PMCs) or the desired sampling
310rate (for sampling mode PMCs).
311.It Dv PMC_OP_PMCSTART
312Start a PMC.
313.It Dv PMC_OP_PMCSTOP
314Stop a PMC.
315.It Dv PMC_OP_WRITELOG
316Insert a timestamped user record into the log file.
317.El
318.Ss i386 Specific API
319Some i386 family CPUs support the RDPMC instruction which allows a
320user process to read a PMC value without needing to invoke a
321.Dv PMC_OP_PMCRW
322operation.
323On such CPUs, the machine address associated with an allocated PMC is
324retrievable using the
325.Dv PMC_OP_PMCX86GETMSR
326system call.
327.Bl -tag -width indent
328.It Dv PMC_OP_PMCX86GETMSR
329Retrieve the MSR (machine specific register) number associated with
330the given PMC handle.
331.Pp
332The PMC needs to be in process-private mode and allocated without the
333.Dv PMC_F_DESCENDANTS
334modifier flag, and should be attached only to its owner process at the
335time of the call.
336.El
337.Ss amd64 Specific API
338AMD64 CPUs support the RDPMC instruction which allows a
339user process to read a PMC value without needing to invoke a
340.Dv PMC_OP_PMCRW
341operation.
342The machine address associated with an allocated PMC is
343retrievable using the
344.Dv PMC_OP_PMCX86GETMSR
345system call.
346.Bl -tag -width indent
347.It Dv PMC_OP_PMCX86GETMSR
348Retrieve the MSR (machine specific register) number associated with
349the given PMC handle.
350.Pp
351The PMC needs to be in process-private mode and allocated without the
352.Dv PMC_F_DESCENDANTS
353modifier flag, and should be attached only to its owner process at the
354time of the call.
355.El
356.Sh SYSCTL VARIABLES AND LOADER TUNABLES
357The behavior of
358.Nm
359is influenced by the following
360.Xr sysctl 8
361and
362.Xr loader 8
363tunables:
364.Bl -tag -width indent
365.It Va kern.hwpmc.debugflags Pq string, read-write
366(Only available if the
367.Nm
368driver was compiled with
369.Fl DDEBUG . )
370Control the verbosity of debug messages from the
371.Nm
372driver.
373.It Va kern.hwpmc.hashsize Pq integer, read-only
374The number of rows in the hash tables used to keep track of owner and
375target processes.
376The default is 16.
377.It Va kern.hwpmc.logbuffersize Pq integer, read-only
378The size in kilobytes of each log buffer used by
379.Nm Ns 's
380logging function.
381The default buffers size is 4KB.
382.It Va kern.hwpmc.mtxpoolsize Pq integer, read-only
383The size of the spin mutex pool used by the PMC driver.
384The default is 32.
385.It Va kern.hwpmc.nbuffers Pq integer, read-only
386The number of log buffers used by
387.Nm
388for logging.
389The default is 16.
390.It Va kern.hwpmc.nsamples Pq integer, read-only
391The number of entries in the per-CPU ring buffer used during sampling.
392The default is 16.
393.It Va security.bsd.unprivileged_syspmcs Pq boolean, read-write
394If set to non-zero, allow unprivileged processes to allocate system-wide
395PMCs.
396The default value is 0.
397.It Va security.bsd.unprivileged_proc_debug Pq boolean, read-write
398If set to 0, the
399.Nm
400driver will only allow privileged processes to attach PMCs to other
401processes.
402.El
403.Pp
404These variables may be set in the kernel environment using
405.Xr kenv 1
406before
407.Nm
408is loaded.
409.Sh SECURITY CONSIDERATIONS
410PMCs may be used to monitor the actual behaviour of the system on hardware.
411In situations where this constitutes an undesirable information leak,
412the following options are available:
413.Bl -enum
414.It
415Set the
416.Xr sysctl 8
417tunable
418.Va security.bsd.unprivileged_syspmcs
419to 0.
420This ensures that unprivileged processes cannot allocate system-wide
421PMCs and thus cannot observe the hardware behavior of the system
422as a whole.
423This tunable may also be set at boot time using
424.Xr loader 8 ,
425or with
426.Xr kenv 1
427prior to loading the
428.Nm
429driver into the kernel.
430.It
431Set the
432.Xr sysctl 8
433tunable
434.Va security.bsd.unprivileged_proc_debug
435to 0.
436This will ensure that an unprivileged process cannot attach a PMC
437to any process other than itself and thus cannot observe the hardware
438behavior of other processes with the same credentials.
439.El
440.Pp
441System administrators should note that on IA-32 platforms
442.Fx
443makes the content of the IA-32 TSC counter available to all processes
444via the RDTSC instruction.
445.Sh IMPLEMENTATION NOTES
446.Ss SMP Symmetry
447The kernel driver requires all physical CPUs in an SMP system to have
448identical performance monitoring counter hardware.
449.Ss i386 TSC Handling
450Historically, on the x86 architecture,
451.Fx
452has permitted user processes running at a processor CPL of 3 to
453read the TSC using the RDTSC instruction.
454The
455.Nm
456driver preserves this semantics.
457.Ss Intel P4/HTT Handling
458On CPUs with HTT support, Intel P4 PMCs are capable of qualifying
459only a subset of hardware events on a per-logical CPU basis.
460Consequently, if HTT is enabled on a system with Intel Pentium P4
461PMCs, then the
462.Nm
463driver will reject allocation requests for process-private PMCs that
464request counting of hardware events that cannot be counted separately
465for each logical CPU.
466.Ss Intel Pentium-Pro Handling
467Writing a value to the PMC MSRs found ing Intel Pentium-Pro style PMCs
468(found in
469.Tn "Intel Pentium Pro" ,
470.Tn "Pentium II" ,
471.Tn "Pentium III" ,
472.Tn "Pentium M"
473and
474.Tn "Celeron"
475processors) will replicate bit 31 of the
476value being written into the upper 8 bits of the MSR,
477bringing down the usable width of these PMCs to 31 bits.
478For process-virtual PMCs, the
479.Nm
480driver implements a workaround in software and makes the corrected 64
481bit count available via the
482.Dv PMC_OP_RW
483operation.
484Processes that intend to use RDPMC instructions directly or
485that intend to write values larger than 2^31 into these PMCs with
486.Dv PMC_OP_RW
487need to be aware of this hardware limitation.
488.Sh DIAGNOSTICS
489.Bl -diag
490.It "hwpmc: [class/npmc/capabilities]..."
491Announce the presence of
492.Va npmc
493PMCs of class
494.Va class ,
495with capabilities described by bit string
496.Va capabilities .
497.It "hwpmc: kernel version (0x%x) does not match module version (0x%x)."
498The module loading process failed because a version mismatch was detected
499between the currently executing kernel and the module being loaded.
500.It "hwpmc: this kernel has not been compiled with 'options HWPMC_HOOKS'."
501The module loading process failed because the currently executing kernel
502was not configured with the required configuration option
503.Cd HWPMC_HOOKS .
504.It "hwpmc: tunable hashsize=%d must be greater than zero."
505A negative value was supplied for tunable
506.Va kern.hwpmc.hashsize .
507.It "hwpmc: tunable logbuffersize=%d must be greater than zero."
508A negative value was supplied for tunable
509.Va kern.hwpmc.logbuffersize .
510.It "hwpmc: tunable nlogbuffers=%d must be greater than zero."
511A negative value was supplied for tunable
512.Va kern.hwpmc.nlogbuffers .
513.It "hwpmc: tunable nsamples=%d out of range."
514The value for tunable
515.Va kern.hwpmc.nsamples
516was negative or greater than 65535.
517.El
518.Sh COMPATIBILITY
519The
520.Nm
521driver is
522.Ud
523The API and ABI documented in this manual page may change in
524the future.
525The recommended method of accessing this driver is using the
526.Xr pmc 3
527API.
528.Sh ERRORS
529A command issued to the
530.Nm
531driver may fail with the following errors:
532.Bl -tag -width Er
533.It Bq Er EBUSY
534A
535.Dv PMC_OP_CONFIGURELOG
536operation was requested while an existing log was active.
537.It Bq Er EBUSY
538A DISABLE operation was requested using the
539.Dv PMC_OP_PMCADMIN
540request for a set of hardware resources currently in use for
541process-private PMCs.
542.It Bq Er EBUSY
543A
544.Dv PMC_OP_PMCADMIN
545operation was requested on an active system mode PMC.
546.It Bq Er EBUSY
547A
548.Dv PMC_OP_PMCATTACH
549operation was requested for a target process that already had another
550PMC using the same hardware resources attached to it.
551.It Bq Er EBUSY
552A
553.Dv PMC_OP_PMCRW
554request writing a new value was issued on a PMC that was active.
555.It Bq Er EBUSY
556A
557.Dv PMC_OP_PMCSETCOUNT
558request was issued on a PMC that was active.
559.It Bq Er EDOOFUS
560A
561.Dv PMC_OP_PMCSTART
562operation was requested without a log file being configured for a
563PMC allocated with
564.Dv PMC_F_LOG_PROCCSW
565and
566.Dv PMC_F_LOG_PROCEXIT
567modifiers.
568.It Bq Er EEXIST
569A
570.Dv PMC_OP_PMCATTACH
571request was reissued for a target process that already is the target
572of this PMC.
573.It Bq Er EFAULT
574A bad address was passed in to the driver.
575.It Bq Er EINVAL
576A process specified an invalid PMC handle.
577.It Bq Er EINVAL
578An invalid CPU number was passed in for a
579.Dv PMC_OP_GETPMCINFO
580operation.
581.It Bq Er EINVAL
582An invalid CPU number was passed in for a
583.Dv PMC_OP_PMCADMIN
584operation.
585.It Bq Er EINVAL
586An invalid operation request was passed in for a
587.Dv PMC_OP_PMCADMIN
588operation.
589.It Bq Er EINVAL
590An invalid PMC ID was passed in for a
591.Dv PMC_OP_PMCADMIN
592operation.
593.It Bq Er EINVAL
594A suitable PMC matching the parameters passed in to a
595.Dv PMC_OP_PMCALLOCATE
596request could not be allocated.
597.It Bq Er EINVAL
598An invalid PMC mode was requested during a
599.Dv PMC_OP_PMCALLOCATE
600request.
601.It Bq Er EINVAL
602An invalid CPU number was specified during a
603.Dv PMC_OP_PMCALLOCATE
604request.
605.It Bq Er EINVAL
606A CPU other than
607.Dv PMC_CPU_ANY
608was specified in a
609.Dv PMC_OP_ALLOCATE
610request for a process-private PMC.
611.It Bq Er EINVAL
612A CPU number of
613.Dv PMC_CPU_ANY
614was specified in a
615.Dv PMC_OP_ALLOCATE
616request for a system-wide PMC.
617.It Bq Er EINVAL
618The
619.Ar pm_flags
620argument to an
621.Dv PMC_OP_PMCALLOCATE
622request contained unknown flags.
623.It Bq Er EINVAL
624A PMC allocated for system-wide operation was specified with a
625.Dv PMC_OP_PMCATTACH
626request.
627.It Bq Er EINVAL
628The
629.Ar pm_pid
630argument to a
631.Dv PMC_OP_PMCATTACH
632request specified an illegal process ID.
633.It Bq Er EINVAL
634A
635.Dv PMC_OP_PMCDETACH
636request was issued for a PMC not attached to the target process.
637.It Bq Er EINVAL
638Argument
639.Ar pm_flags
640to a
641.Dv PMC_OP_PMCRW
642request contained illegal flags.
643.It Bq Er EINVAL
644A
645.Dv PMC_OP_PMCX86GETMSR
646operation was requested for a PMC not in process-virtual mode, or
647for a PMC that is not solely attached to its owner process, or for
648a PMC that was allocated with flag
649.Dv PMC_F_DESCENDANTS .
650.It Bq Er EINVAL
651(On Intel Pentium 4 CPUs with HTT support)
652An allocation request for
653a process-private PMC was issued for an event that does not support
654counting on a per-logical CPU basis.
655.It Bq Er ENOMEM
656The system was not able to allocate kernel memory.
657.It Bq Er ENOSYS
658(i386 architectures)
659A
660.Dv PMC_OP_PMCX86GETMSR
661operation was requested for hardware that does not support reading
662PMCs directly with the RDPMC instruction.
663.It Bq Er ENXIO
664A
665.Dv PMC_OP_GETPMCINFO
666operation was requested for a disabled CPU.
667.It Bq Er ENXIO
668A system-wide PMC on a disabled CPU was requested to be allocated with
669.Dv PMC_OP_PMCALLOCATE .
670.It Bq Er ENXIO
671A
672.Dv PMC_OP_PMCSTART
673or
674.Dv PMC_OP_PMCSTOP
675request was issued for a system-wide PMC that was allocated on a
676currently disabled CPU.
677.It Bq Er EOPNOTSUPP
678A
679.Dv PMC_OP_PMCALLOCATE
680request was issued for PMC capabilities not supported
681by the specified PMC class.
682.It Bq Er EPERM
683A
684.Dv PMC_OP_PMCADMIN
685request was issued by a process without super-user
686privilege or by a jailed super-user process.
687.It Bq Er EPERM
688A
689.Dv PMC_OP_PMCATTACH
690operation was issued for a target process that the current process
691does not have permission to attach to.
692.It Bq Er EPERM
693(i386 and amd64 architectures)
694A
695.Dv PMC_OP_PMCATTACH
696operation was issued on a PMC whose MSR has been retrieved using
697.Dv PMC_OP_PMCX86GETMSR .
698.It Bq Er ESRCH
699A process issued a PMC operation request without having allocated any
700PMCs.
701.It Bq Er ESRCH
702A process issued a PMC operation request after the PMC was detached
703from all of its target processes.
704.It Bq Er ESRCH
705A
706.Dv PMC_OP_PMCATTACH
707request specified a non-existent process ID.
708.It Bq Er ESRCH
709The target process for a
710.Dv PMC_OP_PMCDETACH
711operation is not being monitored by the
712.Nm
713driver.
714.El
715.Sh SEE ALSO
716.Xr kenv 1 ,
717.Xr pmc 3 ,
718.Xr pmclog 3 ,
719.Xr kgmon 8 ,
720.Xr kldload 8 ,
721.Xr pmccontrol 8 ,
722.Xr pmcstat 8 ,
723.Xr sysctl 8 ,
724.Xr p_candebug 9
725.Sh HISTORY
726The
727.Nm
728driver first appeared in
729.Fx 6.0 .
730.Sh BUGS
731The driver samples the state of the kernel's logical processor support
732at the time of initialization (i.e., at module load time).
733On CPUs supporting logical processors, the driver could misbehave if
734logical processors are subsequently enabled or disabled while the
735driver is active.
736.Pp
737On x86 architectures, the driver requires that the local APIC on the
738CPU be enabled for sampling mode to be supported.
739Many single-processor motherboards keep the APIC disabled in BIOS; on
740such systems
741.Nm
742will not support sampling PMCs.
743