A detach removed a process-mode PMC from the current CPU only. If the
PMC had other targets, it stayed on the row of each CPU where a thread
of the detached process ran. Another owner could then attach a new
PMC on the same row to that process. When the process exited on that
CPU, pmc_process_exit() found the old PMC on the row:
panic: [pmc,8005] pm 0x... != pp_pmcs[17] 0x...
Without INVARIANTS, the exit gave the count of the old PMC to the new
one.
After the unlink, move to each CPU where a thread of the process runs.
The scheduler then switches that thread out, and the switch-out
removes the PMC.
The test detach_running_target_frees_row makes this sequence.
Sponsored by: AMD