nodejs/node · error · Exception

Could not set CPU governor. Present value is

Error message

Could not set CPU governor. Present value is %s

What it means

Thrown by CustomMachineConfiguration.SetCPUGovernor in run_perf.py after writing the requested governor string to every core's scaling_governor sysfs file: it re-reads via GetCPUGovernor and the value still does not match, so the write did not take effect.

Solutions

  1. Run the harness as root (sudo) so the sysfs write persists.
  2. Confirm the requested governor is listed: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors, and pick one that is present.
  3. Stop conflicting daemons (thermald, TLP, power-profiles-daemon, cpufrequtils) that revert the governor, then re-run.
  4. If the BIOS locks frequency control, enable OS frequency control in BIOS/UEFI.

Example fix

# before
./run_perf.py suite.json
# after
sudo systemctl stop thermald power-profiles-daemon
sudo cpupower frequency-set -g performance
sudo ./run_perf.py suite.json
Defensive patterns

Strategy: validation

Validate before calling

def can_set_governor(value: str) -> bool:
    import glob, os
    avail = open('/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors').read().split()
    return value in avail and os.geteuid() == 0

Type guard

null

Try / catch

try:
    CustomMachineConfiguration.SetCPUGovernor('performance')
except Exception as e:
    logging.warning('Could not pin CPU governor (%s); stop thermald/TLP/power-profiles-daemon and re-run with sudo.', e)

Prevention

When it happens

Trigger: SetCPUGovernor(value) writes without IOError but GetCPUGovernor() returns a different value. Happens when not root (write appears to succeed but is discarded), when the requested governor is not in scaling_available_governors for the driver, when a BIOS/management engine or thermal daemon overrides the setting, or in a container with a read-only/virtualized sysfs.

Common situations: Running perf tests without sudo; requesting 'performance' when only 'powersave' is available on intel_pstate; a power daemon (thermald, TLP, power-profiles-daemon) re-applying its policy immediately; containerized runs.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/37ed0f9cbebc4c96. Report an issue: GitHub.

Appendix: source

Thrown at deps/v8/tools/run_perf.py:1147

      raise

  @staticmethod
  def SetCPUGovernor(value):
    try:
      cpu_indices = CustomMachineConfiguration.GetCPUCoresRange()
      for cpu_index in cpu_indices:
        cpu_device = CustomMachineConfiguration.GetCPUPathForId(cpu_index)
        with open(cpu_device, 'w') as f:
          f.write(value)

    except Exception:
      logging.exception('Failed to change CPU governor to %s. Are we '
                        'running under sudo?', value)
      raise

    cur_value = CustomMachineConfiguration.GetCPUGovernor()
    if cur_value != value:
      raise Exception('Could not set CPU governor. Present value is %s'
                      % cur_value )


class MaxTotalDurationReachedError(Exception):
  """Exception used to stop running tests when max total duration is reached."""
  pass


def Main(argv):
  parser = argparse.ArgumentParser(epilog="""example:
      ./run_perf.py --d8-path=out/Release/d8 $V8_PERF/benchmarks/JetStream/JetStream2.json
    """)
  parser.add_argument('--arch',
                      help='The architecture to run tests for. Pass "auto" '
                      'to auto-detect.', default='x64',
                      choices=SUPPORTED_ARCHS + ['auto'])
  parser.add_argument('--buildbot',
                      help='Deprecated',

View on GitHub (pinned to 1b2de5e052)