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: define platform.variant for arm #650

Merged
merged 1 commit into from
May 17, 2017

Conversation

AkihiroSuda
Copy link
Member

Please refer to #632 for previous discussion.

In this PR, I avoided to use Linux-specific uname values for ease of porting to non-Linux.
#632 (comment)

Signed-off-by: Akihiro Suda [email protected]

@AkihiroSuda
Copy link
Member Author

CI failed but locally passes
https://travis-ci.org/opencontainers/image-spec/builds/225111253

$ make lint
checking lint
WARNING: deadline exceeded by linter staticcheck on schema (try increasing --deadline)
WARNING: deadline exceeded by linter errcheck on schema (try increasing --deadline)
make: *** [lint] Error 2
The command "make lint" exited with 2.

image-index.md Outdated
@@ -63,7 +63,9 @@ For the media type(s) that this document is compatible with, see the [matrix][ma

- **`variant`** *string*

This OPTIONAL property specifies the variant of the CPU, for example `armv6l` to specify a particular CPU variant of the ARM CPU.
This OPTIONAL property specifies the variant of the CPU.
When `architecture` is `arm`, values for arch SHOULD use, and runtimes SHOULD understand, arch entries listed in the Go Language document for [`$GOARM`](go-arm). i.e. `5`, `6`, or `7`.
Copy link
Contributor

Choose a reason for hiding this comment

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

“values for arch” → “values for variant”. And maybe “arch entries” → “architecture versions” to match Go's wording.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -100,8 +100,7 @@ func TestBackwardsCompatibilityImageIndex(t *testing.T) {
"digest": "sha256:fb2fc0707b86dafa9959fe3d29e66af8787aee4d9a23581714be65db4265ad8a",
"platform": {
"architecture": "arm64",
"os": "linux",
"variant": "armv8"
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to see "variant": "8" here for completeness.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we should add it until upstream Go adds "8".

Note that there is no guarantee Go adds "8".
It can be "8-foo" depending on the future extension, or maybe completely different name depending on the future ARM versioning scheme.

Copy link
Contributor

Choose a reason for hiding this comment

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

A question then - is the OCI specification subordinate to go with respect to the value of attributes here? Would this not make the implementation of this specification sensitive to changes in go?
I thought that the metadata in this specification was to define the compatibility of the images - in which case we ought to be complete in our definition here. The full definition in this instance would be { "arch": "arm64", "variant": "8" }?

Copy link
Member Author

Choose a reason for hiding this comment

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

@stevvooe WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

another idea is to use Linux utsname (armv8l, armv7l) across all the platforms, although Linux-specific #632 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

I have been chatting with the kernel/toolchain and disto teams here within ARM, and the consensus is that there is currently no reliable way of runtime detecting the underlying architecture.

To quote our kernel team when asked about runtime detection
"As an example, Linux reports ARMv7 for ARM11MPCore or ARM1176 (and I think newer revisions of ARM1136). The architecture versions are just some milestones or new baselines without a dedicated ID. The architected CPUID registers only expose features and not architecture versions. However, since some features are "back-ported" to previous
architecture versions, the kernel gets confused (the ARMv7 MMU features have been built into ARM11MPCore, hence Linux reporting v7).

The "armv8l" is only reported by an AArch64 kernel when running a task with the PER_LINUX32 personality. Otherwise the utsname is "aarch64". If you run an AArch32 kernel on ARMv8, it will report armv7l.

I doubt the above helps but I think we should just avoid such run-time
detection at the architecture version. If the hardware does not provide
this information, the OS cannot reliably infer it."

I know this is not very helpful at the moment, but it is a statement of where we are today. There is talk about ARM potentially investing time in 'lscpu' with the help of a LUT to correctly identify architecture.

Copy link
Contributor

Choose a reason for hiding this comment

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

The full definition in this instance would be { "arch": "arm64", "variant": "8" }?

This example was only effort put forth on this particular pull request. The actual usage current looks like this:

      {
         "mediaType": "application/vnd.docker.distribution.manifest.v1+json",
         "size": 2084,
         "digest": "sha256:07ebe243465ef4a667b78154ae6c3ea46fdb1582936aac3ac899ea311a701b40",
         "platform": {
            "architecture": "arm",
            "os": "linux",
            "variant": "armv7"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v1+json",
         "size": 2090,
         "digest": "sha256:fb2fc0707b86dafa9959fe3d29e66af8787aee4d9a23581714be65db4265ad8a",
         "platform": {
            "architecture": "arm64",
            "os": "linux",
            "variant": "armv8"
         }
      }

@@ -91,7 +91,7 @@ func TestBackwardsCompatibilityImageIndex(t *testing.T) {
"platform": {
"architecture": "arm",
Copy link
Contributor

@mattspencer-arm mattspencer-arm Apr 27, 2017

Choose a reason for hiding this comment

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

I understand that "arm" is what gets expressed by GOARCH, which is why it is used here. But would it not be better to disambiguate the property by calling it "arm32"?

I am not sure if this is the right place to add this, but I also think that for completeness we ought to have arch entries for "arm32", "arm64" and "arm64ilp32"?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is defined by runtime-spec, and I don't think we can change anymore.
https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc3/config.md#platform

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine, and as a result of a historical decisions.
ARM would rather see the use of arm32 to reference their 32 bit instruction set rather than the company name - which could be considered ambiguous?

Copy link
Contributor

Choose a reason for hiding this comment

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

ARM would rather see the use of arm32 to reference their 32 bit instruction set rather than the company name - which could be considered ambiguous?

Please take this up with the Go team.

@wking wking mentioned this pull request Apr 28, 2017
@stevvooe
Copy link
Contributor

After looking into this further, mapping variant to GOARM is incorrect. The variant field must have the abi+isa within it. For example, arm64ipl32 would be the variant.

@AkihiroSuda
Copy link
Member Author

@mattspencer-arm PTAL about @stevvooe 's comment?
#650 (comment)

Also, I think it would be better to add an implementator's note about how to check supported abi and isa.
With regarding to arm64ilp32, https://wiki.linaro.org/Platform/arm64-ilp32 might be useful, but couldn't get what is the standard way

@AkihiroSuda
Copy link
Member Author

Can we remove and reserve this field as in platform.features #672?

cc @estesp

@AkihiroSuda
Copy link
Member Author

Uh, I just received email from stevvooe to make this forward, +1

https://groups.google.com/a/opencontainers.org/forum/m/#!topic/dev/Eht-i5UbUvo

@stevvooe
Copy link
Contributor

@AkihiroSuda Was just coming here to post that!

@stevvooe
Copy link
Contributor

stevvooe commented May 12, 2017

@AkihiroSuda Would you mind updating this PR in the vein of that proposal? They are quite compatible, but I'd like to create a table, as is in the proposal. I'll paste that table into #661.

@AkihiroSuda AkihiroSuda force-pushed the platform-variant branch 2 times, most recently from 8e0e38b to a818d88 Compare May 14, 2017 09:45
@AkihiroSuda
Copy link
Member Author

done

image-index.md Outdated
| ISA/ABI | `architecture` | `variant` |
|--------------------------------------|----------------|-------------|
| ARM 32-bit, v5 and earlier | Unsupported | Unsupported |
| ARM 32-bit, v6 (non-Raspberry Pi 1) | Unsupported | Unsupported |
Copy link
Contributor

Choose a reason for hiding this comment

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

Leave these lines off. Nothing is explicitly unsupported.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree - but I would replace 'unsupported' with 'out of scope' to make it explicit that this spec does not cover older ARM ISAs.

image-index.md Outdated
|--------------------------------------|----------------|-------------|
| ARM 32-bit, v5 and earlier | Unsupported | Unsupported |
| ARM 32-bit, v6 (non-Raspberry Pi 1) | Unsupported | Unsupported |
| ARM 32-bit, v6 (Raspberry Pi 1) | `arm` |`v6` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Leave "Raspberry Pi 1". That was just a note in the proposal.

@AkihiroSuda
Copy link
Member Author

done

@mattspencer-arm
Copy link
Contributor

mattspencer-arm commented May 16, 2017 via email

@stevvooe
Copy link
Contributor

Can I suggest that we don't use the word 'Unsupported' but replace it with 'Out of scope'. I think this better reflects the position?

I don't think these lines are even needed. If someone wants to build ARM support for pre-v6, they are within their right, but it won't be specified and if it conflicts, it conflicts.

@AkihiroSuda Let's just remove those lines.

@AkihiroSuda
Copy link
Member Author

already removed

| ARM 32-bit, v6 | `arm` | `v6` |
| ARM 32-bit, v7 | `arm` | `v7` |
| ARM 32-bit, v8 | `arm` | `v8` |
| ARM 64-bit, v8 | `arm64` | `v8` |
Copy link
Contributor

Choose a reason for hiding this comment

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

If we scope arch and variant with this table, and remove features, we can't identify platforms with ilp32 support, are there other issues tracing this?

And is variant really ARM specific property?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please see https://golang.org/src/go/build/syslist.go for extra architecture values. I think ilp32 will be arm64p32. It is not here because it has low adoption at this point.

And is variant really ARM specific property?

It is not. Where did you see this implied?

Copy link

Choose a reason for hiding this comment

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

Would it be possible to include a v5 variant? armv5/armel is still supported by go, and would be great to cover all options (and it's in use for some devices at us at resin.io)

@stevvooe stevvooe added this to the v1.0.0-rc6 milestone May 17, 2017
@stevvooe
Copy link
Contributor

stevvooe commented May 17, 2017

LGTM

Approved with PullApprove

1 similar comment
@vbatts
Copy link
Member

vbatts commented May 17, 2017

LGTM

Approved with PullApprove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants