open-nomad/api
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
..
contexts rename SecureVariables to Variables throughout 2022-08-26 16:06:24 -04:00
internal/testutil deps: update shoenig/test to v0.6.0 (#15715) 2023-01-09 09:37:08 -06:00
acl.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
acl_test.go acl: add validation to binding rule selector on upsert. (#16210) 2023-02-17 15:38:55 +01:00
agent.go Update ioutil library references to os and io respectively for API and Plugins package (#16330) 2023-03-08 10:25:09 -06:00
agent_test.go api: add new test case for force-leave (#16260) 2023-03-03 10:38:40 -05:00
allocations.go client/metadata: fix crasher caused by AllowStale = false (#16549) 2023-03-20 16:32:32 -07:00
allocations_exec.go cleanup: prevent leaks from time.After 2022-02-02 14:32:26 -06:00
allocations_test.go api: set last index and request time on alloc stop (#16319) 2023-03-03 15:52:41 -05:00
api.go client/metadata: fix crasher caused by AllowStale = false (#16549) 2023-03-20 16:32:32 -07:00
api_test.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
compose_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
constraint.go
constraint_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
consul.go Rename fields on proxyConfig (#15541) 2023-01-30 09:31:16 -06:00
consul_test.go Rename fields on proxyConfig (#15541) 2023-01-30 09:31:16 -06:00
csi.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
csi_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
deployments.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
evaluations.go eval delete: move batching of deletes into RPC handler and state (#15117) 2022-11-14 14:08:13 -05:00
evaluations_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
event_stream.go api: add convenience string func to Topic type. (#14843) 2022-10-19 14:12:23 +02:00
event_stream_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
fs.go Update ioutil library references to os and io respectively for API and Plugins package (#16330) 2023-03-08 10:25:09 -06:00
fs_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
go.mod client/fingerprint: correctly fingerprint E/P cores of Apple Silicon chips (#16672) 2023-03-28 08:27:58 -05:00
go.sum client/fingerprint: correctly fingerprint E/P cores of Apple Silicon chips (#16672) 2023-03-28 08:27:58 -05:00
ioutil.go api: use errors.New not fmt.Errorf when error doesn't have format. (#14027) 2022-08-05 17:05:47 +02:00
ioutil_test.go Update ioutil library references to os and io respectively for API and Plugins package (#16330) 2023-03-08 10:25:09 -06:00
jobs.go Allow configurable range of Job priorities (#16084) 2023-02-17 09:23:13 -05:00
jobs_test.go handle FSM.Apply errors in raftApply (#16287) 2023-03-02 13:51:09 -05:00
keyring.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
keyring_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
namespace.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
namespace_test.go api: make api tests fast and more concurrency safe (#15543) 2022-12-16 12:25:28 -06:00
node_meta.go client/metadata: fix crasher caused by AllowStale = false (#16549) 2023-03-20 16:32:32 -07:00
node_meta_test.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
nodes.go api: add new test case for force-leave (#16260) 2023-03-03 10:38:40 -05:00
nodes_test.go handle FSM.Apply errors in raftApply (#16287) 2023-03-02 13:51:09 -05:00
operator.go Update ioutil library references to os and io respectively for API and Plugins package (#16330) 2023-03-08 10:25:09 -06:00
operator_autopilot.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
operator_ent_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
operator_metrics.go Update ioutil library references to os and io respectively for API and Plugins package (#16330) 2023-03-08 10:25:09 -06:00
operator_metrics_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
operator_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
quota.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
quota_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
raw.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
recommendations.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
regions.go cli: ensure -stale flag is respected by nomad operator debug (#11678) 2021-12-15 10:44:03 -05:00
regions_test.go api: cleanup use of deprecated waiter functions (#15608) 2022-12-22 08:21:00 -06:00
resources.go api: remove mapstructure tags fromPort struct (#12916) 2022-11-08 11:26:28 +01:00
resources_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
scaling.go cleanup: replace TypeToPtr helper methods with pointer.Of (#14151) 2022-08-17 18:26:34 +02:00
scaling_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
search.go
search_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
sentinel.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
sentinel_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
services.go cleanup: replace TypeToPtr helper methods with pointer.Of (#14151) 2022-08-17 18:26:34 +02:00
services_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
status.go
status_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
system.go Dynamic Node Metadata (#15844) 2023-02-07 14:42:25 -08:00
system_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
tasks.go cli: job restart command (#16278) 2023-03-23 18:28:26 -04:00
tasks_test.go renamed stanza to block for consistency with other projects (#15941) 2023-01-30 15:48:43 +01:00
util_test.go Add -json flag to quota inspect command (#16478) 2023-03-20 10:40:51 +01:00
utils.go cleanup: replace TypeToPtr helper methods with pointer.Of (#14151) 2022-08-17 18:26:34 +02:00
utils_test.go api: purge testify and pretty dependencies (#15627) 2023-01-01 12:57:26 -06:00
variables.go api: fix a panic and tweak some exported types (#16237) 2023-02-22 08:17:22 -06:00
variables_test.go api: fix a panic and tweak some exported types (#16237) 2023-02-22 08:17:22 -06:00