1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-30 12:04:07 +00:00
freebsd/sys/dev/hwpmc
John Baldwin a1febbf667 Fix two bugs that could result in PMC sampling effectively stopping.
In both cases, the the effect of the bug was that a very small positive
number was written to the counter. This means that a large number of
events needed to occur before the next sampling interrupt would trigger.
Even with very frequently occurring events like clock cycles wrapping all
the way around could take a long time. Both bugs occurred when updating
the saved reload count for an outgoing thread on a context switch.

First, the counter-independent code compares the current reload count
against the count set when the thread switched in and generates a delta
to apply to the saved count. If this delta causes the reload counter
to go negative, it would add a full reload interval to wrap it around to
a positive value. The fix is to add the full reload interval if the
resulting counter is zero.

Second, occasionally the raw counter value read during a context switch
has actually wrapped, but an interrupt has not yet triggered. In this
case the existing logic would return a very large reload count (e.g.
2^48 - 2 if the counter had overflowed by a count of 2). This was seen
both for fixed-function and programmable counters on an E5-2643.
Workaround this case by returning a reload count of zero.

PR:		198149
Differential Revision:	https://reviews.freebsd.org/D2557
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	Norse Corp, Inc.
2015-05-19 19:15:19 +00:00
..
hwpmc_amd.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_amd.h
hwpmc_arm64_md.c Add Performance Monitoring Counters support for AArch64. 2015-05-19 15:25:47 +00:00
hwpmc_arm64.c Add Performance Monitoring Counters support for AArch64. 2015-05-19 15:25:47 +00:00
hwpmc_arm64.h Add Performance Monitoring Counters support for AArch64. 2015-05-19 15:25:47 +00:00
hwpmc_arm.c Rather than defining our own magic checks here use INKERNEL() for 2015-03-27 08:47:16 +00:00
hwpmc_armv7.c Convert remaining hwpmc(4) debug printfs over to KTR to unbreak the build 2015-05-09 09:21:59 +00:00
hwpmc_armv7.h Add ARMv7 performance monitoring counters. 2015-01-28 16:08:07 +00:00
hwpmc_core.c Fix two bugs that could result in PMC sampling effectively stopping. 2015-05-19 19:15:19 +00:00
hwpmc_core.h Remove some prototypes for undefined functions. 2014-05-15 21:19:13 +00:00
hwpmc_e500.c Convert remaining hwpmc(4) debug printfs over to KTR to unbreak the build 2015-05-09 09:21:59 +00:00
hwpmc_intel.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_logging.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_mips24k.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_mips74k.c Convert remaining hwpmc(4) debug printfs over to KTR to unbreak the build 2015-05-09 09:21:59 +00:00
hwpmc_mips.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_mod.c Fix two bugs that could result in PMC sampling effectively stopping. 2015-05-19 19:15:19 +00:00
hwpmc_mpc7xxx.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_octeon.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_pentium.c
hwpmc_pentium.h
hwpmc_piv.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_piv.h Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
hwpmc_powerpc.c Implement hwpmc(4) for Freescale e500 core. 2015-04-18 21:39:17 +00:00
hwpmc_powerpc.h Implement hwpmc(4) for Freescale e500 core. 2015-04-18 21:39:17 +00:00
hwpmc_ppc970.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_ppro.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_ppro.h
hwpmc_soft.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_soft.h
hwpmc_sparc64.c
hwpmc_tsc.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_tsc.h
hwpmc_uncore.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_uncore.h Remove some prototypes for undefined functions. 2014-05-15 21:19:13 +00:00
hwpmc_x86.c Update the hwpmc driver to have the new type HASWELL_XEON. Also 2015-01-14 12:46:58 +00:00
hwpmc_xscale.c Convert hwpmc(4) debug printfs over to KTR. 2015-05-08 19:40:00 +00:00
hwpmc_xscale.h
pmc_events.h Add Performance Monitoring Counters support for AArch64. 2015-05-19 15:25:47 +00:00