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