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

cpu: ignore unknown cpuid flags on non-x86 #914

Merged
merged 1 commit into from
Oct 20, 2022

Conversation

marquiz
Copy link
Contributor

@marquiz marquiz commented Oct 13, 2022

Avoid trying to create empty "cpu-cpuid." labels for cpuid flags that we don't have a description for.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marquiz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 13, 2022
@netlify
Copy link

netlify bot commented Oct 13, 2022

Deploy Preview for kubernetes-sigs-nfd ready!

Name Link
🔨 Latest commit 98fd07b
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-nfd/deploys/634d62321e6c520008fa6b83
😎 Deploy Preview https://deploy-preview-914--kubernetes-sigs-nfd.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@marquiz
Copy link
Contributor Author

marquiz commented Oct 13, 2022

Not verified
/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 13, 2022
@marquiz
Copy link
Contributor Author

marquiz commented Oct 13, 2022

ping @Chandan-Abhyankar @yselkowitz

@yselkowitz
Copy link
Contributor

yselkowitz commented Oct 13, 2022

  1. this should be done for all architectures' code with manually curated lists (arm64, ppc64le, and s390x)
  2. let's also update the cpu flags for POWER 9 and 10, z14/15/16, and ARM v8.latest.

@prb112
Copy link

prb112 commented Oct 13, 2022

  1. this should be done for all architectures' code with manually curated lists (arm64, ppc64le, and s390x)

    1. let's also update the cpu flags for POWER 9 and 10, z14/15/16, and ARM v8.latest.

I think the defensive fix proposed by @marquiz 'future' proofs the code against changes. I do like the referenced PR from Yaakov. It's a great catch/help. Chandan and I can try this out on a p10.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 14, 2022
@marquiz
Copy link
Contributor Author

marquiz commented Oct 14, 2022

/retitle cpu: ignore unknown cpuid flags on non-x86

@k8s-ci-robot k8s-ci-robot changed the title cpu: ignore unknown cpuid flags on ppc64le cpu: ignore unknown cpuid flags on non-x86 Oct 14, 2022
@marquiz
Copy link
Contributor Author

marquiz commented Oct 14, 2022

  1. this should be done for all architectures' code with manually curated lists (arm64, ppc64le, and s390x)

Ach, good point @yselkowitz. I updated the PR to handle other non-x86 architectures.

PTAL @Chandan-Abhyankar @yselkowitz @prb112

@jschintag
Copy link
Contributor

Thank you @marquiz , i don't have time to test it on s390x right now and i will be away next week. However the changes look good to me. Since they are the same for all arches, i'm fine with it if they work on the other arches.

One question unrelated to this PR: When i reviewed the loop, where does the capacity from the string array come from?

	r := make([]string, 0, 20)
	hwcap := uint64(C.gethwcap())
	for i := uint(0); i < 64; i++ {

I mean we have 23 Flags defined for s390x and we check 64 bits. Is there a reason the array only has a cap of 20?

@marquiz
Copy link
Contributor Author

marquiz commented Oct 14, 2022

Thanks @jschintag, I'll then be happy with an ack from the arm and ppc guys 😊

One question unrelated to this PR: When i reviewed the loop, where does the capacity from the string array come from?

	r := make([]string, 0, 20)
	hwcap := uint64(C.gethwcap())
	for i := uint(0); i < 64; i++ {

I mean we have 23 Flags defined for s390x and we check 64 bits. Is there a reason the array only has a cap of 20?

Good question, I'm not the original author of this code. I think it's just a (harmless) leftover from some eariler development stage. The slice capacity will get increased if more than 20 flags are present. This could be fixed in a separate PR though, I think (e.g. set cap to len(flagNames_s390x) or something more meaningful).

@prb112
Copy link

prb112 commented Oct 14, 2022

@marquiz This works on ppc64le. Chandan has tried it out and would resolve #913

Comment on lines +88 to +189
val, ok := flagNames_arm64[key]
if hwcap&key != 0 && ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI this hunk overlaps #919 so whichever is merged first, the second will need to rebase and adapt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

@marquiz
Copy link
Contributor Author

marquiz commented Oct 14, 2022

Any arm64 confirmation? @zvonkok @ArangoGutierrez ?

Avoid trying to create empty "cpu-cpuid." labels for cpuid flags that we
don't have a description for.
@marquiz
Copy link
Contributor Author

marquiz commented Oct 17, 2022

Rebased after #919 was merged
/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 17, 2022
@marquiz
Copy link
Contributor Author

marquiz commented Oct 18, 2022

Verified that images build and unit tests pass on arm64 and s390x

@yselkowitz
Copy link
Contributor

/lgtm

@k8s-ci-robot
Copy link
Contributor

@yselkowitz: changing LGTM is restricted to collaborators

In response to this:

/lgtm

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.

@marquiz
Copy link
Contributor Author

marquiz commented Oct 20, 2022

/lgtm

ping @fmuyassarov @zvonkok

@zvonkok
Copy link
Contributor

zvonkok commented Oct 20, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 20, 2022
@fmuyassarov
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot merged commit 4d153ae into kubernetes-sigs:master Oct 20, 2022
@marquiz marquiz deleted the fixes/cpuid-ppc branch October 20, 2022 07:46
@marquiz marquiz mentioned this pull request Oct 31, 2022
19 tasks
@marquiz marquiz mentioned this pull request Dec 20, 2022
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants