nodejs/node · error · Exception

CPU cores have differing governor settings

Error message

CPU cores have differing governor settings

What it means

Thrown by CustomMachineConfiguration.GetCPUGovernor in run_perf.py while reading the scaling governor of every CPU core: it assumes all cores share one governor setting, and if any core reports a different value it aborts. Consistent CPU frequency policy is required for benchmark determinism.

Source

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

    ret = '/sys/devices/system/cpu/cpu'
    ret += str(cpu_index)
    ret += '/cpufreq/scaling_governor'
    return ret

  @staticmethod
  def GetCPUGovernor():
    try:
      cpu_indices = CustomMachineConfiguration.GetCPUCoresRange()
      ret = None
      for cpu_index in cpu_indices:
        cpu_device = CustomMachineConfiguration.GetCPUPathForId(cpu_index)
        with open(cpu_device, 'r') as f:
          # We assume the governors of all CPUs are set to the same value
          val = f.readline().strip()
          if ret is None:
            ret = val
          elif ret != val:
            raise Exception('CPU cores have differing governor settings')
      return ret
    except Exception:
      logging.exception('Failed to get the current CPU governor. Is the CPU '
                        'governor disabled? Check BIOS.')
      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)

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Pin all cores to the same governor before running: sudo cpupower frequency-set -g performance (this sets it cluster-wide; verify each core).
  2. On hybrid systems, either isolate the benchmark to a homogeneous cluster via taskset/cgroups or pre-set the governor on every cpuN individually in a loop.
  3. Check for offline cores (ls /sys/devices/system/cpu/cpu*/online) and bring them online or exclude them so governor reads are consistent.

Example fix

# before: mixed governors across cores
# after: force one governor on every core
for c in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
  echo performance | sudo tee "$c"
done
Defensive patterns

Strategy: validation

Validate before calling

def governors_consistent() -> bool:
    import glob
    vals = {open(f).read().strip() for f in glob.glob('/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor')}
    return len(vals) == 1

Type guard

null

Try / catch

try:
    gov = CustomMachineConfiguration.GetCPUGovernor()
except Exception as e:
    logging.warning('Inconsistent CPU governors (%s); pin all cores first.', e)

Prevention

When it happens

Trigger: Iterating cpu_indices from /sys/devices/system/cpu/present; reading each /sys/devices/system/cpu/cpuN/cpufreq/scaling_governor; the value on one core differs from the first core's value.

Common situations: Heterogeneous big.LITTLE or hybrid (P-core/E-core) systems where cores legitimately run different governors; a CPU hotplug/hotplug-offline event leaving a core on a default governor; a partially-applied cpupower/cpufreq-set that only changed some cores.

Related errors


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