freebsd-skq/sys/dev/hwpmc
Andriy Gapon 3c1f73b18d hwpmc: fix a race between amd_stop_pmc and amd_intr
It is possible that wrmsr in amd_stop_pmc() causes an overflow in a counter
that it disables.  In that case a non-maskable interrupt is generated.  The
interrupt handler code was written in such a way that it would re-enable the
counter.  That would lead to an unexpected interrupt later on.

This problem was easy to reproduce with
$ pmcstat -T -P instructions -t $pid
if the target process is sufficiently busy and there are context switches from
time to time.  There would be a lot of interrupts to "race" with amd_stop_pmc()
called during the context switches.  The problem affected only AMD processors.

While there, trace whether amd_intr() claimed an interrupt.

Reviewed by:	jhb
MFC after:	2 weeks
2016-10-30 09:38:10 +00:00
..
hwpmc_amd.c hwpmc: fix a race between amd_stop_pmc and amd_intr 2016-10-30 09:38:10 +00:00
hwpmc_amd.h
hwpmc_arm64_md.c
hwpmc_arm64.c
hwpmc_arm64.h
hwpmc_arm.c
hwpmc_armv7.c
hwpmc_armv7.h
hwpmc_core.c Apply the fix from r232612 to fixed function counters. 2016-08-03 16:52:00 +00:00
hwpmc_core.h sys/dev: minor spelling fixes. 2016-05-03 03:41:25 +00:00
hwpmc_e500.c Remove unused e500_event_codes_size. 2016-04-20 20:37:58 +00:00
hwpmc_intel.c Add support for Intel Skylake and Intel Broadwell PMC's. The Broadwell PMC's have been 2015-11-30 17:35:49 +00:00
hwpmc_logging.c hwpmc: remove sys/capability.h backwards compatibility 2016-09-20 12:56:03 +00:00
hwpmc_mips24k.c sys: use our nitems() macro when param.h is available. 2016-04-21 19:40:10 +00:00
hwpmc_mips74k.c sys: use our nitems() macro when param.h is available. 2016-04-21 19:40:10 +00:00
hwpmc_mips.c Cleanup unnecessary semicolons from the kernel. 2016-04-10 23:07:00 +00:00
hwpmc_mod.c Don't panic in hwpmc when stopping sampling. 2016-05-28 13:05:39 +00:00
hwpmc_mpc7xxx.c Remove slightly used const values that can be replaced with nitems(). 2016-04-21 15:38:28 +00:00
hwpmc_octeon.c sys: use our nitems() macro when param.h is available. 2016-04-21 19:40:10 +00:00
hwpmc_pentium.c
hwpmc_pentium.h
hwpmc_piv.c Remove misc NULL checks after M_WAITOK allocations. 2016-05-10 10:26:07 +00:00
hwpmc_piv.h
hwpmc_powerpc.c e5500 HWPMC is identical to e500mc, so add support check for it. 2016-01-17 00:14:22 +00:00
hwpmc_powerpc.h
hwpmc_ppc970.c
hwpmc_ppro.c
hwpmc_ppro.h
hwpmc_riscv.h Welcome the RISC-V 64-bit kernel. 2016-01-29 15:12:31 +00:00
hwpmc_soft.c
hwpmc_soft.h
hwpmc_sparc64.c
hwpmc_tsc.c
hwpmc_tsc.h
hwpmc_uncore.c Remove slightly used const values that can be replaced with nitems(). 2016-04-21 15:38:28 +00:00
hwpmc_uncore.h
hwpmc_x86.c
hwpmc_xscale.c Remove slightly used const values that can be replaced with nitems(). 2016-04-21 15:38:28 +00:00
hwpmc_xscale.h
pmc_events.h sys/dev: minor spelling fixes. 2016-05-03 03:41:25 +00:00