#28606·nomad

client: CPU fingerprint on M4 Pro is 1000x too low, go-m1cpu never converts kHz

Author: ingvarchCreated Sep 28, 2026Updated Sep 29, 2026
Labelstype/bugtheme/clientstage/acceptedhcc/jiradependencies

Nomad version

Nomad v2.0.7
BuildDate 2026-09-17T17:24:03Z
Revision 9dcbdc5e64ecc4ec63e42b225af729c87c87cf83

Operating system and Environment details

macOS 27.0 (26A428), Mac16,7, Apple M4 Pro with 10 performance and 4 efficiency cores. Nomad darwin/arm64 build.

Issue

The client fingerprints an M4 Pro as 48 MHz of CPU in total, so a dev agent cannot place a task with the default cpu = 100.

#26138 reported the same on M4 and was closed by shoenig/go-m1cpu#26. Nomad 2.0.7 ships go-m1cpu v0.2.2, which contains that change, and the numbers are still 1000 times too low.

The cause is in go-m1cpu. toHz reads the chip generation like this:

go
fmt.Sscanf(ModelName(), "Apple M%", &gen)

The format string ends with % and has no verb, so Sscanf returns missing verb: % at end of format string and gen stays 0. The gen >= 4 branch that turns kHz into Hz never runs, whatever the model name is. The format has been like this since go-m1cpu#26 and is the same on main.

go-m1cpu v0.2.2 on this machine:

model: Apple M4 Pro
P cores: 10 P Hz: 4512000
E cores: 4 E Hz: 2592000
Sscanf("Apple M%"): gen=0 n=0 err=missing verb: % at end of format string
Sscanf("Apple M%d"): gen=4 n=1 err=<nil>
The program that printed this
go
package main

import (
	"fmt"

	"github.com/shoenig/go-m1cpu"
)

func main() {
	fmt.Println("model:", m1cpu.ModelName())
	fmt.Println("P cores:", m1cpu.PCoreCount(), "P Hz:", m1cpu.PCoreHz())
	fmt.Println("E cores:", m1cpu.ECoreCount(), "E Hz:", m1cpu.ECoreHz())

	for _, f := range []string{"Apple M%", "Apple M%d"} {
		var gen int
		n, err := fmt.Sscanf(m1cpu.ModelName(), f, &gen)
		fmt.Printf("Sscanf(%q): gen=%d n=%d err=%v\n", f, gen, n, err)
	}
}

With "Apple M%d", gen is 4 and the kHz values become 4512000000 Hz and 2592000000 Hz, which match the M4 Pro clocks.

Reproduction steps

  1. On a Mac with an M4 Pro, run nomad agent -dev.
  2. Run nomad node status -self -verbose | grep cpu.
  3. Run nomad job plan on the job below, which uses the default resources.

Expected Result

cpu.frequency.efficiency          = 2592
cpu.frequency.performance         = 4512
cpu.totalcompute                  = 55488

(10 × 4512 + 4 × 2592 = 55488), and the job is placed.

Actual Result

cpu.arch                          = arm64
cpu.frequency.efficiency          = 2
cpu.frequency.performance         = 4
cpu.modelname                     = Apple M4 Pro
cpu.numcores                      = 14
cpu.numcores.efficiency           = 4
cpu.numcores.performance          = 10
cpu.reservablecores               = 0
cpu.totalcompute                  = 48
cpu.usablecompute                 = 48
Scheduler dry-run:
- WARNING: Failed to place all allocations.
  Task Group "g" (failed to place 1 allocation):
    * Resources exhausted on 1 nodes
    * Dimension "cpu" exhausted on 1 nodes

Setting client { cpu_total_compute = 55488 } works around it: the node reports 55488 and the job is placed.

Job file (if appropriate)

hcl
job "weather-bot" {
  namespace = "default"
  group "g" {
    count = 1
    task "weather-bot" {
      driver = "raw_exec"
      config {
        command = "/bin/sh"
        args    = ["-c", "while true; do sleep 5; done"]
      }
    }
  }
}