Since 9d3064010590, pmc_process_exit() calls pmc_process_csw_stop_all()
first. That clears pps_cpustate for every virtual PMC on the CPU, so the
exit loop then skips the stop and the final read.
On AMD PerfMonV2 this has two effects:
- The count from the last time slice is lost. A process that never switches out before exit reports 0 with pmcstat -p.
- The EVSEL enable bit stays set. After kldunload, the next kldload sees it and says "PMCs maybe in use by firmware!".
When the class has pcd_stop_all, always stop and read the PMC, as
pmc_process_csw_out() already does.
Fixes: 9d3064010590 ("hwpmc_amd: add PerfMonV2 global-control path")
Sponsored by: AMD