Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image-index: Document Linux cpuinfo flags (on x86) for platform.features #631

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions image-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ For the media type(s) that this document is compatible with, see the [matrix][ma

- **`features`** *array of strings*

This OPTIONAL property specifies an array of strings, each specifying a mandatory CPU feature (for example `sse4` or `aes`).
This OPTIONAL property specifies an array of strings, each specifying a mandatory CPU feature.

When `architecture` is `386` or `amd64`, image indexes SHOULD use, and implementations SHOULD understand, values [supported by Linux][cpufeatures.h] with the `X86_FEATURE_` prefix removed and the remainder lowercased.
For example, include `vmx` (for `X86_FEATURE_VMX`) if the image contains an executable compiled to use `VMXON` and related instructions with no fallback.
On Linux on these architectures, the features supported by host CPUs can be found in the `flags` entries in the `cpuinfo` file provided by the [proc filesystem][proc.5].

When `architecture` is neither `386` nor `amd64`, values are implementation-defined and SHOULD be submitted to this specification for standardization.

- **`annotations`** *string-string map*

Expand Down Expand Up @@ -99,8 +105,8 @@ For the media type(s) that this document is compatible with, see the [matrix][ma
"platform": {
"architecture": "amd64",
"os": "linux",
"os.features": [
"sse4"
"features": [
"vmx"
]
}
}
Expand All @@ -112,5 +118,7 @@ For the media type(s) that this document is compatible with, see the [matrix][ma
}
```

[cpufeatures.h]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/include/asm/cpufeatures.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For L108 (GitHub doesn't allow me to directly comment there)

  • os.features -> features
  • sse4 -> sse4_2 (please grep and update other files as well)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed “os.features” → “features” in dc5e4a0e1045bf. Also replaced the old sse4 instances, although I replaced them with fpu since I was using fpu and vme since those are the first two entries in cpufeatures.h. I don't really care what features we use as examples though; if there's a strong preference for sse4_2, I can switch to that instead.

[proc.5]: http://man7.org/linux/man-pages/man5/proc.5.html
[runtime-platform2]: https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc3/config.md#platform
[matrix]: media-types.md#compatibility-matrix
10 changes: 5 additions & 5 deletions schema/imageindex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestImageIndex(t *testing.T) {
"architecture": "amd64",
"os": "linux",
"features": [
"sse4"
"vmx"
]
}
}
Expand All @@ -84,7 +84,7 @@ func TestImageIndex(t *testing.T) {
"architecture": "amd64",
"os": "linux",
"features": [
"sse4"
"vmx"
]
}
}
Expand Down Expand Up @@ -128,7 +128,7 @@ func TestImageIndex(t *testing.T) {
"architecture": "amd64",
"os": "linux",
"features": [
"sse4"
"vmx"
]
}
}
Expand All @@ -152,7 +152,7 @@ func TestImageIndex(t *testing.T) {
"architecture": "amd64",
"os": "linux",
"features": [
"sse4"
"vmx"
]
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@ func TestImageIndex(t *testing.T) {
"architecture": "amd64",
"os": "linux",
"features": [
"sse4"
"vmx"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion specs-go/v1/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Platform struct {
Variant string `json:"variant,omitempty"`

// Features is an optional field specifying an array of strings, each
// listing a required CPU feature (for example `sse4` or `aes`).
// listing a required CPU feature.
Features []string `json:"features,omitempty"`
}

Expand Down