Re: Simultaneous access to same CPU/counter across processes crashes hwpmc (TSC and other classes)

Adrian Chadd <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <CAJ-VmokGRKTYZZ0Rig5Z1kPLVUgYF3Z=3TBrT4kTK5knqO7_Ww@mail.gmail.com>
On Wed, 19 Aug 2026 at 07:18, Nascimento, Anderson Eduardo
<[email protected]> wrote:
>
> Public
>
> Hello all,
>
> I am working on developing a new class of PMCs for the hwpmc subsystem and I ran into a kernel crash while testing my implementation. I believe I have identified the reason the crash happens, and I could try to fix it on the affected classes, but so far it's still not clear to me what model the hwpmc subsystem intends to enforce. Should simultaneous access to the same CPU and counter by different processes be allowed?

The initial design goals and list from the original author (jkoshy@)
is still available on the wiki, eg see
https://wiki.freebsd.org/PmcTools/Features .

So yes, one of the design goals of hwpmc versus what was available in
Linux at the time (oprofile) was that counters
are virtualised both for context switching between processes /and/
multiple processes accessing the same counters
on a given CPU (and as part of this, handling context switching appropriately.)

It's what made it much nicer to use back when it was introduced versus
oprofile. (of course, oprofiles tooling
'just worked' versus pmc..)



-adrian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.