Index | Thread | Search

From:
"Ted Unangst" <tedu@tedunangst.com>
Subject:
Re: sys/sysctl: make hw.setperf MP safe
To:
"Kirill A. Korinsky" <kirill@korins.ky>
Cc:
"OpenBSD tech" <tech@openbsd.org>, mvs@openbsd.org
Date:
Wed, 21 May 2025 13:58:13 -0400

Download raw body.

Thread
  • Ted Unangst:

    sys/sysctl: make hw.setperf MP safe

  • 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?
    
    > -		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.
    
    
  • Ted Unangst:

    sys/sysctl: make hw.setperf MP safe