]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix hwpmc "stalled" behavior
authorJonathan T. Looney <jtl@FreeBSD.org>
Sat, 14 Nov 2015 01:40:12 +0000 (01:40 +0000)
committerJonathan T. Looney <jtl@FreeBSD.org>
Sat, 14 Nov 2015 01:40:12 +0000 (01:40 +0000)
commita39249680f95e0d0dab702c254fabcd6ab24b8e9
tree644fcaf06d0e52ab99395c07aa7941d7b921f2b0
parentefd5acf04b06ca0008a0e59100d94d6927906ed6
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
sys/dev/hwpmc/hwpmc_mod.c
sys/sys/pmc.h