IBS and the core counters share the PMC NMI. amd_intr() and
amd_intr_v2() return as soon as pmc_ibs_intr() claims an NMI, so a core
counter overflow that arrives with the same NMI is not serviced: the
counter is not reloaded and sampling with it stops.
Service the core counters after pmc_ibs_intr() and claim the NMI if
either side found work. An NMI that IBS claimed no longer uses up a
core stray-NMI credit. With no core counter sampling, amd_intr_v2()
still returns right after IBS, without freezing the core counters.
Add a test that samples unhalted cycles on cpu0 alone and then next to
IBS op, and requires the second phase to keep at least half of the
core samples.
Sponsored by: Advanced Micro Devices, Inc.