mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Added more Intel RDT capability discovery: CMT,MBM,MBA (#120)
Added Memory Bandwith Allocation (MBA) capability discovery. Refined RDT monitoring capability detection; Cache Monitoring Technology (CMT) and Memory Bandwidth Monitoring (MBM) capabilities can be detected separately.
This commit is contained in:
parent
01e2110a5c
commit
e984154090
6 changed files with 105 additions and 1 deletions
|
@ -105,9 +105,12 @@ such as restricting discovered features with the --label-whitelist option._
|
|||
|
||||
| Feature name | Description |
|
||||
| :------------: | :---------------------------------------------------------------------------------: |
|
||||
| RDTMON | Intel Cache Monitoring Technology (CMT) and Intel Memory Bandwidth Monitoring (MBM)
|
||||
| RDTMON | Intel RDT Monitoring Technology
|
||||
| RDTCMT | Intel Cache Monitoring (CMT)
|
||||
| RDTMBM | Intel Memory Bandwidth Monitoring (MBM)
|
||||
| RDTL3CA | Intel L3 Cache Allocation Technology
|
||||
| RDTL2CA | Intel L2 Cache Allocation Technology
|
||||
| RDTMBA | Intel Memory Bandwidth Allocation (MBA) Technology
|
||||
|
||||
### X86 CPUID Features (Partial List)
|
||||
|
||||
|
|
|
@ -10,5 +10,8 @@ default:
|
|||
$(MAKE) all
|
||||
all:
|
||||
$(CC) $(CFLAGS) -o mon-discovery monitoring-discovery.c $(LDFLAGS) $(LDLIBS)
|
||||
$(CC) $(CFLAGS) -o mon-cmt-discovery monitoring-cmt-discovery.c $(LDFLAGS) $(LDLIBS)
|
||||
$(CC) $(CFLAGS) -o mon-mbm-discovery monitoring-mbm-discovery.c $(LDFLAGS) $(LDLIBS)
|
||||
$(CC) $(CFLAGS) -o l3-alloc-discovery l3-allocation-discovery.c $(LDFLAGS) $(LDLIBS)
|
||||
$(CC) $(CFLAGS) -o l2-alloc-discovery l2-allocation-discovery.c $(LDFLAGS) $(LDLIBS)
|
||||
$(CC) $(CFLAGS) -o mem-bandwidth-alloc-discovery mem-bandwidth-allocation-discovery.c $(LDFLAGS) $(LDLIBS)
|
||||
|
|
22
rdt-discovery/mem-bandwidth-allocation-discovery.c
Normal file
22
rdt-discovery/mem-bandwidth-allocation-discovery.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "machine.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
struct cpuid_out res;
|
||||
|
||||
// Logic below from https://github.com/intel/intel-cmt-cat/blob/master/lib/cap.c
|
||||
lcpuid(0x7, 0x0, &res);
|
||||
if (!(res.ebx & (1 << 15))) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
lcpuid(0x10, 0x0, &res);
|
||||
if (!(res.ebx & (1 << 3))) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
// If we are here, then Memory Bandwidth Allocation capability is available.
|
||||
return EXIT_SUCCESS;
|
||||
}
|
26
rdt-discovery/monitoring-cmt-discovery.c
Normal file
26
rdt-discovery/monitoring-cmt-discovery.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "machine.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
struct cpuid_out res;
|
||||
|
||||
// Logic below from https://github.com/01org/intel-cmt-cat/blob/master/lib/host_cap.c
|
||||
lcpuid(0x7, 0x0, &res);
|
||||
if (!(res.ebx & (1 << 12))) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
// check for overall monitoring capability first
|
||||
lcpuid(0xf, 0x0, &res);
|
||||
if (!(res.edx & (1 << 1))) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
// check for more detailed capability, CMT monitoring
|
||||
lcpuid(0xf, 0x1, &res);
|
||||
if (!(res.edx & (1 << 0))) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// If we are here, then CMT cache monitoring capability is available.
|
||||
return EXIT_SUCCESS;
|
||||
}
|
26
rdt-discovery/monitoring-mbm-discovery.c
Normal file
26
rdt-discovery/monitoring-mbm-discovery.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "machine.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
struct cpuid_out res;
|
||||
|
||||
// Logic below from https://github.com/01org/intel-cmt-cat/blob/master/lib/host_cap.c
|
||||
lcpuid(0x7, 0x0, &res);
|
||||
if (!(res.ebx & (1 << 12))) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
// check for overall monitoring capability first
|
||||
lcpuid(0xf, 0x0, &res);
|
||||
if (!(res.edx & (1 << 1))) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
// check for more detailed capability, MBM monitoring
|
||||
lcpuid(0xf, 0x1, &res);
|
||||
if ((res.edx & (3 << 1)) != (3 << 1)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// If we are here, then MBM cache monitoring capability is available.
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -40,6 +40,22 @@ func (s Source) Discover() ([]string, error) {
|
|||
features = append(features, "RDTMON")
|
||||
}
|
||||
|
||||
cmd = exec.Command("bash", "-c", "mon-cmt-discovery")
|
||||
if err := cmd.Run(); err != nil {
|
||||
glog.Errorf("support for RDT CMT monitoring was not detected: %v", err)
|
||||
} else {
|
||||
// RDT CMT monitoring detected.
|
||||
features = append(features, "RDTCMT")
|
||||
}
|
||||
|
||||
cmd = exec.Command("bash", "-c", "mon-mbm-discovery")
|
||||
if err := cmd.Run(); err != nil {
|
||||
glog.Errorf("support for RDT MBM monitoring was not detected: %v", err)
|
||||
} else {
|
||||
// RDT MBM monitoring detected.
|
||||
features = append(features, "RDTMBM")
|
||||
}
|
||||
|
||||
cmd = exec.Command("bash", "-c", "l3-alloc-discovery")
|
||||
if err := cmd.Run(); err != nil {
|
||||
glog.Errorf("support for RDT L3 allocation was not detected: %v", err)
|
||||
|
@ -56,5 +72,13 @@ func (s Source) Discover() ([]string, error) {
|
|||
features = append(features, "RDTL2CA")
|
||||
}
|
||||
|
||||
cmd = exec.Command("bash", "-c", "mem-bandwidth-alloc-discovery")
|
||||
if err := cmd.Run(); err != nil {
|
||||
glog.Errorf("support for RDT Memory bandwidth allocation was not detected: %v", err)
|
||||
} else {
|
||||
// RDT Memory bandwidth allocation detected.
|
||||
features = append(features, "RDTMBA")
|
||||
}
|
||||
|
||||
return features, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue