Re: Crash in pmc: [pmc,1762] negative increment cpu=1 ri=17 newvalue=45d4906d saved=fffff616cee9 incr=ffff00004fbdc184

Alexander Leidinger <[email protected]> Sun, 19 Jul 2026 14:26:42 +0200
Newsgroups gmane.os.freebsd.current
Organization No organization, this is a private message.
Message-ID <[email protected]>
Am 2026-07-14 20:49, schrieb Alexander Leidinger:

> Am 2026-07-14 00:28, schrieb Ali Mashtizadeh:
> 
>> Hello Alexander,
>> 
>> I believe this is related to a bug I'm looking into, otherwise you may 
>> be using a counter that's not really a counter.  We probably need to 
>> remove that assert for some of the memory counters.
>> 
>> With process mode counters we eventually don't re-enable the pmc on a 
>> context switch and you will eventually just see zeros for the 
>> incremental counts.  That's probably what's happening here is that 
>> when it queries the PMC it goes from some positive number to zero in 
>> the next sample.  Also explains why you don't see this problem with 
>> sleep because it takes a few context switches for it to show up.
>> 
>> Not sure when this bug was introduced but it seems to be fairly old 
>> and I wasn't readily hitting it in some cases.
>> 
>> Do you mind sharing the pmcstat command you tested with?
> 
> cpuset -l 1 pmcstat -p inst_retired.any_p -p cpu_clk_unhalted.thread_p 
> -p br_misp_retired.all_branches \
> /tmp/lame-off/lame/frontend/lame --quiet -b 320 /tmp/corpus.wav 
> /tmp/o.mp3
> 
> CPU Intel Xeon X5675 (Westmere-EP)
> 
> from inside a jail

Fix and unit tests and another panic fix in:
     https://reviews.freebsd.org/D58340
     https://reviews.freebsd.org/D58341
     https://reviews.freebsd.org/D58342
     https://reviews.freebsd.org/D5834 [1]

Bye,
Alexander.

-- 
http://www.Leidinger.net [email protected]: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    [email protected]  : PGP 0x8F31830F9F2772BF

Links:
------
[1] https://reviews.freebsd.org/D58343
signature.asc (application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCAA5FiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmpcwo0bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwzAAoJEBINsJsD+NiGSS0QAJV5BjlMHPtiY8PTvyFi
t+3w/EwZoYMEvaGZmXVDvr/lmfMra1ebb/P/KRIAne8GaDtjw2Xf5hEkTV3WvDQz
qTGCNxGCBW/CNl3bo2wnbSnONmcsupllQ4e9BMczVLIGIZUsHQeuTkXQlAtAqwal
joXF2fSnlDi1k43Czo6K6ks13Qs7NUO64TKkrZvR7oii43s9JRoUHVM2BWwddboj
D+kbAY4m/4R85eeMA386CuhYHA0XQwAhBISVUl/7k+lgFAG4EG7xuIVi5afeYOSX
AxKCCfZPXmwxoZuIsG6EKIXw4uQpyNenigbj+zk5Dgbstp6KaO9B07MrOK5aCnL9
ZijHPIipVGrcqHP0KEN19wWbKMU6P+aATiYf115p8tHgVwPkvjEj+8Mkm1x7KFvF
fG/ruGPDcm3bjeoAv/Ni6RQL44kY011WRu52JQWt9dooZd1jKTLRWat2WrEQ3YoK
QyPWi5JMQDi4iGP+fnh3bwsLwrKdpDMw/ft7YtdqcJRPI4faDdzPj/lIzchSm8d5
cxuRzqM8vogrm9/zhwhEMlXENiJLB5C0M6P269HJZ3iryutC7x/8GXe4IVsCDdwn
LCtt1BFB4cZkvrwqNzR8jJNBfF3rbpsPSRS6tLGcJRiG2Dl5pYoKVxSDYeMsb+1y
ehhX9uITs/iLTSrdjy32pgLS
=i7nc
-----END PGP SIGNATURE-----