1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

cpu: ignore unknown cpuid flags on non-x86

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

(cherry picked from commit 98fd07b117)
This commit is contained in:
Markus Lehtonen 2022-10-13 14:56:49 +03:00
parent 5741fc92e3
commit 1a3bf8423b
4 changed files with 10 additions and 10 deletions

View file

@ -95,8 +95,8 @@ func getCpuidFlags() []string {
hwcap := uint64(C.gethwcap())
for i := uint(0); i < 64; i++ {
key := uint64(1 << i)
val := flagNames_arm[key]
if hwcap&key != 0 {
val, ok := flagNames_arm[key]
if hwcap&key != 0 && ok {
r = append(r, val)
}
}

View file

@ -85,8 +85,8 @@ func getCpuidFlags() []string {
hwcap := uint64(C.gethwcap())
for i := uint(0); i < 64; i++ {
key := uint64(1 << i)
val := flagNames_arm64[key]
if hwcap&key != 0 {
val, ok := flagNames_arm64[key]
if hwcap&key != 0 && ok {
r = append(r, val)
}
}

View file

@ -132,15 +132,15 @@ func getCpuidFlags() []string {
hwcap2 := uint64(C.gethwcap2())
for i := uint(0); i < 64; i++ {
key := uint64(1 << i)
val := flagNames_ppc64le[key]
if hwcap&key != 0 {
val, ok := flagNames_ppc64le[key]
if hwcap&key != 0 && ok {
r = append(r, val)
}
}
for i := uint(0); i < 64; i++ {
key := uint64(1 << i)
val := flag2Names_ppc64le[key]
if hwcap2&key != 0 {
val, ok := flag2Names_ppc64le[key]
if hwcap2&key != 0 && ok {
r = append(r, val)
}
}

View file

@ -84,8 +84,8 @@ func getCpuidFlags() []string {
hwcap := uint64(C.gethwcap())
for i := uint(0); i < 64; i++ {
key := uint64(1 << i)
val := flagNames_s390x[key]
if hwcap&key != 0 {
val, ok := flagNames_s390x[key]
if hwcap&key != 0 && ok {
r = append(r, val)
}
}