-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Fix cpu architecture detection issue on linux/arm #7636
Fix cpu architecture detection issue on linux/arm #7636
Conversation
Hi @fangn2. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
0a3ea31
to
df1b4bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow https://github.com/containerd/project/blob/main/CONTRIBUTING.md#commit-messages regarding commit messages. Some of the information you put in the PR should be in the commit message too.
913825a
to
c024ef7
Compare
A more generic question: Isn't the Just wonder if we are actually trying to work around an issue that should be fixed at some lower level. Or did I misunderstand something? |
d9d02fe
to
3454bc2
Compare
9fc133b
to
bec21d5
Compare
c69ad08
to
9bfec67
Compare
8c7ff37
to
12169f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks almost good!
5c58cc4
to
01f1598
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good. Can you clean up the commit history?
When images/containers in ARM arch were built/executed on x86 host, getCPUVariant will fail as it tries to look for /proc/cpuinfo, whose content is from the host. Adding a new method as fallback to check uname machine when it happens. Signed-off-by: Tony Fang <[email protected]>
Add unit test to function GetCPUVariantFromArch Fix import issue on non-linux platforms Fix some style issue Signed-off-by: Tony Fang <[email protected]>
01f1598
to
6e55234
Compare
Done, commit history cleaned up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I'm fine merging the two commits. If we revert the first commit, we have to revert the second as well, so they are not logically separated. But not a blocker.
Any (rough) idea when this will make it into a release? Seems like it didn't make 1.6.15... |
It's part of the coming 1.7 release. I am not sure if maintainers are ok to backport this change to 1.6. Open for suggestions. |
This PR is to fix cpu architecture detection issues #4109, #21, #1146 when images/containers in ARM arch were built/executed on x86 host. The root cause of the issue is the getCPUVariant function looks for "Cpu architecture" field in /proc/cpuinfo to determine the actual ARM variant. The function will fail if the ARM containers/images ran in a user-mode emulated environment(like qemu) on a x86 host whose /proc/cpuinfo doesn't have "Cpu architecture" field and whose content is shared with ARM containers.
The PR adds a fall back func to get cpu variant from uname machine field through a system call if the previous method failed.
This PR is inspired by the closed PR.
This PR also splits different platforms(Linux and ! Linux) into different go files.
Test method: local unit test(we don't have the test infrastructure(x86 host with ARM qemu) required in CI
Test environment setup: