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.
This commit is contained in:
Markus Lehtonen 2022-10-13 14:56:49 +03:00
parent 796403aa85
commit 98fd07b117
4 changed files with 12 additions and 12 deletions

View file

@ -98,8 +98,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

@ -185,15 +185,15 @@ func getCpuidFlags() []string {
hwcap2 := uint64(C.gethwcap2())
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)
}
}
for i := uint(0); i < 64; i++ {
key := uint64(1 << i)
val := flag2Names_arm64[key]
if hwcap2&key != 0 {
val, ok := flag2Names_arm64[key]
if hwcap2&key != 0 && ok {
r = append(r, val)
}
}

View file

@ -139,15 +139,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

@ -88,8 +88,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)
}
}