RE: Simultaneous access to same CPU/counter across processes crashes hwpmc (TSC and other classes)
Date: Thu, 27 Aug 2026 16:40:04 UTC
Public > -----Original Message----- > From: Adrian Chadd <adrian@freebsd.org> > Sent: Saturday, August 22, 2026 4:04 PM > To: Nascimento, Anderson Eduardo > <AndersonEduardo.Nascimento@amd.com> > Cc: freebsd-hackers@freebsd.org > Subject: Re: Simultaneous access to same CPU/counter across processes > crashes hwpmc (TSC and other classes) > > [You don't often get email from adrian@freebsd.org. 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 > <AndersonEduardo.Nascimento@amd.com> 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