Download raw body.
sys/sysctl: make hw.setperf MP safe
> From: "Ted Unangst" <tedu@tedunangst.com> > Date: Wed, 21 May 2025 13:58:13 -0400 > > On 2025-05-21, Kirill A. Korinsky wrote: > > tech@, > > > > Here a diff which makes hw.setperf MP safe. > > Am I out of the loop? What machine doesn't load an int atomically? https://lwn.net/Articles/793253/ I'm still not convinced load tearing and store tearing are genuine problems. All the examples I've seen from the Linux developers are somewhat convoluted, involving things like unions or type punning. But there is currently no consensus among OpenBSD developers. But yes, > > > - perflevel = 100; > > - cpu_setperf(perflevel); > > > + atomic_store_int(&perflevel, 100); > > + cpu_setperf(atomic_load_int(&perflevel)); > > Constructs like this in particular look weird. If there's a race, > this doesn't fix it. It is code like this that makes me believe the current path mvs@ is on isn't right.
sys/sysctl: make hw.setperf MP safe