freebsd-dev/sys/dev/hwpmc
Andrew Turner 7bc7e3cd65 Don't panic in hwpmc when stopping sampling.
When hwpmc stops sampling it will set the pm_state to something other
than PMC_STATE_RUNNING. This means the following sequence can happen:

CPU 0: Enter the interrupt handler
CPU 0: Set the thread TDP_CALLCHAIN pflag
CPU 1: Stop sampling
CPU 0: Call pmc_process_samples, sampling is stopped so clears ps_nsamples
CPU 0: Finishes interrupt processing with the TDP_CALLCHAIN flag set
CPU 0: Call pmc_capture_user_callchain to capture the user call chain
CPU 0: Find all the pmc sample are free so no call chains need to be captured
CPU 0: KASSERT because of this

This fixes the issue by checking if any of the samples have been stopped
and including this in te KASSERT.

PR:		204273
Reviewed by:	bz, gnn
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6581
2016-05-28 13:05:39 +00:00
..
hwpmc_amd.c sys: use our nitems() macro when param.h is available. 2016-04-21 19:40: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
hwpmc_core.h sys/dev: minor spelling fixes. 2016-05-03 03:41:25 +00:00
hwpmc_e500.c
hwpmc_intel.c
hwpmc_logging.c
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
hwpmc_mod.c Don't panic in hwpmc when stopping sampling. 2016-05-28 13:05:39 +00:00
hwpmc_mpc7xxx.c
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
hwpmc_powerpc.h
hwpmc_ppc970.c
hwpmc_ppro.c
hwpmc_ppro.h
hwpmc_riscv.h
hwpmc_soft.c
hwpmc_soft.h
hwpmc_sparc64.c
hwpmc_tsc.c
hwpmc_tsc.h
hwpmc_uncore.c
hwpmc_uncore.h
hwpmc_x86.c
hwpmc_xscale.c
hwpmc_xscale.h
pmc_events.h sys/dev: minor spelling fixes. 2016-05-03 03:41:25 +00:00