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

"Nascimento, Anderson Eduardo" <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <SAWPR12MB999118C36CF1327A9913D4B9139AAD2@SAWPR12MB999118.namprd12.prod.outlook.com>
Public

> -----Original Message-----
> From: Adrian Chadd <[email protected]>
> Sent: Saturday, August 22, 2026 4:04 PM
> To: Nascimento, Anderson Eduardo
> <[email protected]>
> Cc: [email protected]
> Subject: Re: Simultaneous access to same CPU/counter across processes
> crashes hwpmc (TSC and other classes)
>
> [You don't often get email from [email protected]. Learn why this is
> important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> 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..)
>
>

Hello Adrian,

This adds important context. I had checked other pages related to PMC on the Wiki, but I missed that one. Thanks for sharing this.

>
> -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.