mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
cpu: support for detecting nx-gzip coprocessor feature
Nest accelerator gzip support for IBM Power systems. Signed-off-by: Chandan Abhyankar <Chandan.Abhyankar@ibm.com>
This commit is contained in:
parent
080105c772
commit
d66096a491
5 changed files with 89 additions and 10 deletions
|
@ -621,6 +621,8 @@ The following features are available for matching:
|
|||
| | | **`enabled`** | bool | **DEPRECATED**: use **`se.enabled`** from **`cpu.security`** instead
|
||||
| **`cpu.topology`** | attribute | | | CPU topology related features
|
||||
| | | **`hardware_multithreading`** | bool | Hardware multithreading, such as Intel HTT, is enabled
|
||||
| **`cpu.coprocessor`** | attribute | | | CPU Coprocessor related features
|
||||
| | | **`nx_gzip`** | bool | Nest Accelerator GZIP support is enabled
|
||||
| **`kernel.config`** | attribute | | | Kernel configuration options
|
||||
| | | **`<config-flag>`** | string | Value of the kconfig option
|
||||
| **`kernel.loadedmodule`** | flag | | | Loaded kernel modules
|
||||
|
|
|
@ -48,6 +48,7 @@ option of nfd-worker.
|
|||
| ----------------------- | ------------ | -----------
|
||||
| **`cpu-cpuid.<cpuid-flag>`** | true | CPU capability is supported. **NOTE:** the capability might be supported but not enabled.
|
||||
| **`cpu-hardware_multithreading`** | true | Hardware multithreading, such as Intel HTT, enabled (number of logical CPUs is greater than physical CPUs)
|
||||
| **`cpu-coprocessor.nx_gzip`** | true | Nest Accelerator for GZIP is supported(Power).
|
||||
| **`cpu-power.sst_bf.enabled`** | true | Intel SST-BF ([Intel Speed Select Technology][intel-sst] - Base frequency) enabled
|
||||
| **`cpu-pstate.status`** | string | The status of the [Intel pstate][intel-pstate] driver when in use and enabled, either 'active' or 'passive'.
|
||||
| **`cpu-pstate.turbo`** | bool | Set to 'true' if turbo frequencies are enabled in Intel pstate driver, set to 'false' if they have been disabled.
|
||||
|
|
43
source/cpu/coprocessor_ppc64le.go
Normal file
43
source/cpu/coprocessor_ppc64le.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
//go:build ppc64le
|
||||
// +build ppc64le
|
||||
|
||||
/*
|
||||
Copyright 2023 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cpu
|
||||
|
||||
import (
|
||||
"k8s.io/klog/v2"
|
||||
"os"
|
||||
"sigs.k8s.io/node-feature-discovery/pkg/utils/hostpath"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
/* Detect NX_GZIP */
|
||||
func discoverCoprocessor() map[string]string {
|
||||
features := make(map[string]string)
|
||||
|
||||
nxGzipPath := hostpath.SysfsDir.Path("devices/vio/ibm,compression-v1/nx_gzip_caps")
|
||||
|
||||
_, err := os.Stat(nxGzipPath)
|
||||
if err != nil {
|
||||
klog.V(5).Infof("Failed to detect nx_gzip for Nest Accelerator: %v", err)
|
||||
} else {
|
||||
features["nx_gzip"] = strconv.FormatBool(true)
|
||||
}
|
||||
|
||||
return features
|
||||
}
|
24
source/cpu/coprocessor_stub.go
Normal file
24
source/cpu/coprocessor_stub.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
//go:build !ppc64le
|
||||
// +build !ppc64le
|
||||
|
||||
/*
|
||||
Copyright 2023 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package cpu
|
||||
|
||||
func discoverCoprocessor() map[string]string {
|
||||
return nil
|
||||
}
|
|
@ -34,16 +34,17 @@ import (
|
|||
const Name = "cpu"
|
||||
|
||||
const (
|
||||
CpuidFeature = "cpuid"
|
||||
Cpumodel = "model"
|
||||
CstateFeature = "cstate"
|
||||
PstateFeature = "pstate"
|
||||
RdtFeature = "rdt"
|
||||
SeFeature = "se" // DEPRECATED in v0.12: will be removed in the future
|
||||
SecurityFeature = "security"
|
||||
SgxFeature = "sgx" // DEPRECATED in v0.12: will be removed in the future
|
||||
SstFeature = "sst"
|
||||
TopologyFeature = "topology"
|
||||
CpuidFeature = "cpuid"
|
||||
Cpumodel = "model"
|
||||
CstateFeature = "cstate"
|
||||
PstateFeature = "pstate"
|
||||
RdtFeature = "rdt"
|
||||
SeFeature = "se" // DEPRECATED in v0.12: will be removed in the future
|
||||
SecurityFeature = "security"
|
||||
SgxFeature = "sgx" // DEPRECATED in v0.12: will be removed in the future
|
||||
SstFeature = "sst"
|
||||
TopologyFeature = "topology"
|
||||
CoprocessorFeature = "coprocessor"
|
||||
)
|
||||
|
||||
// Configuration file options
|
||||
|
@ -192,6 +193,11 @@ func (s *cpuSource) GetLabels() (source.FeatureLabels, error) {
|
|||
labels["hardware_multithreading"] = v
|
||||
}
|
||||
|
||||
// NX
|
||||
if v, ok := features.Attributes[CoprocessorFeature].Elements["nx_gzip"]; ok {
|
||||
labels["coprocessor.nx_gzip"] = v
|
||||
}
|
||||
|
||||
return labels, nil
|
||||
}
|
||||
|
||||
|
@ -246,6 +252,9 @@ func (s *cpuSource) Discover() error {
|
|||
// Detect hyper-threading
|
||||
s.features.Attributes[TopologyFeature] = nfdv1alpha1.NewAttributeFeatures(discoverTopology())
|
||||
|
||||
// Detect Coprocessor features
|
||||
s.features.Attributes[CoprocessorFeature] = nfdv1alpha1.NewAttributeFeatures(discoverCoprocessor())
|
||||
|
||||
utils.KlogDump(3, "discovered cpu features:", " ", s.features)
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue