open-nomad/helper
Seth Hoenig 87f4b71df0
client/fingerprint: correctly fingerprint E/P cores of Apple Silicon chips (#16672)
* client/fingerprint: correctly fingerprint E/P cores of Apple Silicon chips

This PR adds detection of asymetric core types (Power & Efficiency) (P/E)
when running on M1/M2 Apple Silicon CPUs. This functionality is provided
by shoenig/go-m1cpu which makes use of the Apple IOKit framework to read
undocumented registers containing CPU performance data. Currently working
on getting that functionality merged upstream into gopsutil, but gopsutil
would still not support detecting P vs E cores like this PR does.

Also refactors the CPUFingerprinter code to handle the mixed core
types, now setting power vs efficiency cpu attributes.

For now the scheduler is still unaware of mixed core types - on Apple
platforms tasks cannot reserve cores anyway so it doesn't matter, but
at least now the total CPU shares available will be correct.

Future work should include adding support for detecting P/E cores on
the latest and upcoming Intel chips, where computation of total cpu shares
is currently incorrect. For that, we should also include updating the
scheduler to be core-type aware, so that tasks of resources.cores on Linux
platforms can be assigned the correct number of CPU shares for the core
type(s) they have been assigned.

node attributes before

cpu.arch                  = arm64
cpu.modelname             = Apple M2 Pro
cpu.numcores              = 12
cpu.reservablecores       = 0
cpu.totalcompute          = 1000

node attributes after

cpu.arch                  = arm64
cpu.frequency.efficiency  = 2424
cpu.frequency.power       = 3504
cpu.modelname             = Apple M2 Pro
cpu.numcores.efficiency   = 4
cpu.numcores.power        = 8
cpu.reservablecores       = 0
cpu.totalcompute          = 37728

* fingerprint/cpu: follow up cr items
2023-03-28 08:27:58 -05:00
..
args address review comments 2018-10-30 13:58:52 -04:00
boltdd deps: update set and test (#14680) 2022-09-26 08:28:03 -05:00
broker core: allow pausing and un-pausing of leader broker routine (#13045) 2022-07-06 16:13:48 +02:00
bufconndialer test: test the buffered pipe used by nsd (#12563) 2022-04-14 08:38:25 -07:00
codec Provide mock secure variables implementation (#12980) 2022-07-11 13:34:03 -04:00
constraints/semver chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
crypto keyring: wrap root key in key encryption key (#14388) 2022-08-30 10:59:25 -04:00
discover chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
envoy ci: swap ci parallelization for unconstrained gomaxprocs 2022-03-15 12:58:52 -05:00
escapingfs Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
escapingio build: run gofmt on all go source files 2022-08-16 11:14:11 -05:00
fields goimports 2019-01-22 15:44:31 -08:00
flags ci: swap ci parallelization for unconstrained gomaxprocs 2022-03-15 12:58:52 -05:00
flatmap Add gosimple linter (#9590) 2020-12-09 11:05:18 -08:00
gated-writer gatedwriter: Fix race condition (#9791) 2021-01-14 12:43:14 -08:00
grpc-middleware/logging Add gosimple linter (#9590) 2020-12-09 11:05:18 -08:00
ipaddr helper: add ipaddr pkg to check for any IP addresses. 2022-03-03 11:24:50 +01:00
logging cli Ui implementation that logs to a hclogger 2019-02-19 17:53:14 -06:00
mount deps: upgrade docker and runc 2022-01-18 08:35:26 -06:00
noxssrw lint: mark false positive or fix gocritic append lint errors. 2021-09-06 10:49:44 +02:00
pluginutils Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
pointer pointer: add Merge helper function for merging pointers (#15499) 2022-12-08 11:09:22 -06:00
pool ci: swap freeport for portal in packages (#15661) 2023-01-03 11:25:20 -06:00
raftutil acl: add binding rule object state schema and functionality. (#15511) 2022-12-14 08:48:18 +01:00
snapshot Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
stats client/fingerprint: correctly fingerprint E/P cores of Apple Silicon chips (#16672) 2023-03-28 08:27:58 -05:00
subproc client: sandbox go-getter subprocess with landlock (#15328) 2022-12-07 16:02:25 -06:00
testlog tests: add a space between node name and timestamp (#13750) 2022-07-13 16:23:03 -04:00
testtask Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
tlsutil Pre forwarding authentication (#15417) 2022-12-06 14:44:03 -05:00
useragent services: Set Nomad's User-Agent by default on HTTP checks for nomad services (#16248) 2023-02-23 08:10:42 -06:00
users users: create cache for user lookups (#16100) 2023-02-09 08:37:50 -06:00
uuid keyring: wrap root key in key encryption key (#14388) 2022-08-30 10:59:25 -04:00
winsvc gofmt all the files 2021-10-01 10:14:28 -04:00
cluster.go helper: guard against negative inputs into random stagger 2022-09-08 09:17:48 -05:00
cluster_test.go deps: update set and test (#14680) 2022-09-26 08:28:03 -05:00
eof.go feat: remove dependency to consul/lib 2022-04-09 13:22:44 +02:00
funcs.go acl: modify update endpoints behavior (#15580) 2022-12-20 11:22:19 +01:00
funcs_test.go client: avoid unconsumed channel in timer construction (#15215) 2022-11-11 09:31:34 -06:00
opaque.go scheduler: annotate tasksUpdated with reason and purge DeepEquals (#16421) 2023-03-14 09:46:00 -05:00
opaque_test.go scheduler: annotate tasksUpdated with reason and purge DeepEquals (#16421) 2023-03-14 09:46:00 -05:00
warning.go Add warnings to var put for non-alphanumeric keys. (#15933) 2023-02-13 16:14:59 -05:00
warning_test.go Add warnings to var put for non-alphanumeric keys. (#15933) 2023-02-13 16:14:59 -05:00