diff options
author | jtl <jtl@FreeBSD.org> | 2015-11-14 01:40:12 +0000 |
---|---|---|
committer | jtl <jtl@FreeBSD.org> | 2015-11-14 01:40:12 +0000 |
commit | d3aee48be1f3413950da2ed942bf029594dfc133 (patch) | |
tree | 644fcaf06d0e52ab99395c07aa7941d7b921f2b0 /sys/sys/pmc.h | |
parent | c3c0db4f86f7529ec2a9621dabc9d61d0d5e04ef (diff) | |
download | FreeBSD-src-d3aee48be1f3413950da2ed942bf029594dfc133.zip FreeBSD-src-d3aee48be1f3413950da2ed942bf029594dfc133.tar.gz |
Fix hwpmc "stalled" behavior
Currently, there is a single pm_stalled flag that tracks whether a
performance monitor was "stalled" due to insufficent ring buffer
space for samples. However, because the same performance monitor
can run on multiple processes or threads at the same time, a single
pm_stalled flag that impacts them all seems insufficient.
In particular, you can hit corner cases where the code fails to stop
performance monitors during a context switch out, because it thinks
the performance monitor is already stopped. However, in reality,
it may be that only the monitor running on a different CPU was stalled.
This patch attempts to fix that behavior by tracking on a per-CPU basis
whether a PM desires to run and whether it is "stalled". This lets the
code make better decisions about when to stop PMs and when to try to
restart them. Ideally, we should avoid the case where the code fails
to stop a PM during a context switch out.
Sponsored by: Juniper Networks
Reviewed by: jhb
Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D4124
Diffstat (limited to 'sys/sys/pmc.h')
-rw-r--r-- | sys/sys/pmc.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h index 8da3abe..6ed909b 100644 --- a/sys/sys/pmc.h +++ b/sys/sys/pmc.h @@ -614,6 +614,7 @@ struct pmc_op_getdyneventinfo { #include <sys/malloc.h> #include <sys/sysctl.h> +#include <sys/_cpuset.h> #include <machine/frame.h> @@ -729,7 +730,8 @@ struct pmc { pmc_value_t pm_initial; /* counting PMC modes */ } pm_sc; - uint32_t pm_stalled; /* marks stalled sampling PMCs */ + volatile cpuset_t pm_stalled; /* marks stalled sampling PMCs */ + volatile cpuset_t pm_cpustate; /* CPUs where PMC should be active */ uint32_t pm_caps; /* PMC capabilities */ enum pmc_event pm_event; /* event being measured */ uint32_t pm_flags; /* additional flags PMC_F_... */ |