Skip to content

Add support to detect ARM variant on Windows#2700

Merged
dmcgowan merged 1 commit intocontainerd:masterfrom
jiria:jiria/add-windows-arm-support
Oct 10, 2018
Merged

Add support to detect ARM variant on Windows#2700
dmcgowan merged 1 commit intocontainerd:masterfrom
jiria:jiria/add-windows-arm-support

Conversation

@jiria
Copy link
Copy Markdown
Contributor

@jiria jiria commented Oct 4, 2018

Opening PR as per #2693.

We are working on enabling support for ARM on Windows. As part of that, we have hit an issue when getCPUVariant gets called. getCPUVariant calls into getCPUInfo which expects Linux OS and as such it fails for Windows. This change uses GOARM global for Windows and Linux path is unaltered.

@estesp FYI

@estesp
Copy link
Copy Markdown
Member

estesp commented Oct 4, 2018

Thanks @jiria ; you will need to add a Signed-off-by: line to your git commit; see here for details.

@jiria jiria force-pushed the jiria/add-windows-arm-support branch from 353fe30 to a6f0596 Compare October 4, 2018 21:52
@jiria
Copy link
Copy Markdown
Contributor Author

jiria commented Oct 4, 2018

Thanks for the pointer @estesp , I have amended the commit message based on the guidelines.

@jiria jiria force-pushed the jiria/add-windows-arm-support branch 2 times, most recently from c6c4f4c to ca985aa Compare October 5, 2018 01:17
@codecov-io
Copy link
Copy Markdown

codecov-io commented Oct 5, 2018

Codecov Report

Merging #2700 into master will decrease coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2700      +/-   ##
==========================================
- Coverage   43.59%   43.54%   -0.05%     
==========================================
  Files         101      101              
  Lines       10722    10733      +11     
==========================================
  Hits         4674     4674              
- Misses       5314     5325      +11     
  Partials      734      734
Flag Coverage Δ
#linux 47.21% <0%> (-0.07%) ⬇️
#windows 40.67% <0%> (-0.05%) ⬇️
Impacted Files Coverage Δ
platforms/cpuinfo.go 4.68% <0%> (-0.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 15f19d7...0f729f8. Read the comment docs.

@jiria
Copy link
Copy Markdown
Contributor Author

jiria commented Oct 8, 2018

@jterry75 FYI

Please let me know if there is anything else you need from me to complete this PR.

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

seems reasonable; just one question about the go linkage to runtime.goarm

Comment thread platforms/cpuinfo.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this linkage require a certain version of Go? I know the Windows ARM support was recently merged, but wasn't sure if this runtime.goarm predates these patches and has always been available when GOARCH == arm

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems to me that runtime.goarm has been in runtime/runtime2.go for at least two years.

@jordanrh1 in case he has some additional context.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Correct, runtime.goarm has been around for a while. However, runtime.goarm does not necessarily match the instruction set of the CPU. GOARM could be less than the version of the CPU.

Windows only supports ARMv7 for arm32 platforms, and ARMv8 for aarch64. So if the architecture is "arm", you know the architecture version is at least v7, and if the architecture is "arm64", you know the architecture version is at least v8. You could use the following logic to avoid runtime.goarm.

switch runtime.GOARCH {
default:
    variant = "unknown"
case "arm":
    variant = "v7"
case "arm64":
    variant = "v8"
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated based on recommendation of @jordanrh1 , our Go expert.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good.

@jiria jiria force-pushed the jiria/add-windows-arm-support branch from ca985aa to 0f729f8 Compare October 10, 2018 18:42
Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

Two fairly minor things to resolve; otherwise looks good

Comment thread platforms/cpuinfo.go Outdated
Comment thread platforms/cpuinfo.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

one final thing (from me): an early return at the end of the GOOS == windows section means the rest (all prior lines) can remain outside of a large if section.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Amended

ARM variant detection logic was authored originally with
POSIX OS in mind. This change leaves POSIX code path unaltered
and adds support to detect ARM variant on Windows by leveraging
runtime.goarch.

Signed-off-by: Jiri Appl <[email protected]>
@jiria jiria force-pushed the jiria/add-windows-arm-support branch from 0f729f8 to e6529f4 Compare October 10, 2018 21:17
@estesp
Copy link
Copy Markdown
Member

estesp commented Oct 10, 2018

LGTM

@jiria
Copy link
Copy Markdown
Contributor Author

jiria commented Oct 10, 2018

Thanks @estesp

What needs to further happen in order for this PR to be completed?

And second question, what needs to happen to get containerd revendored into moby?

@dmcgowan dmcgowan added this to the 1.2 milestone Oct 10, 2018
@dmcgowan
Copy link
Copy Markdown
Member

LGTM

@dmcgowan dmcgowan merged commit f674599 into containerd:master Oct 10, 2018
@jiria
Copy link
Copy Markdown
Contributor Author

jiria commented Oct 11, 2018

Thanks @dmcgowan .

@estesp @dmcgowan what needs to happen and/or what is the ETA for containerd to get revendored into moby/moby?

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.

5 participants