Skip to content

Commit 9f84df7

Browse files
authored
Merge pull request #4829 from marquiz/devel/rdt-validate
libcontainer/configs/validate: check that intelrdt is enabled
2 parents 67112aa + e846add commit 9f84df7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

libcontainer/configs/validate/validator.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ func sysctl(config *configs.Config) error {
283283

284284
func intelrdtCheck(config *configs.Config) error {
285285
if config.IntelRdt != nil {
286+
if !intelrdt.IsEnabled() {
287+
return fmt.Errorf("intelRdt is specified in config, but Intel RDT is not enabled")
288+
}
289+
286290
if config.IntelRdt.ClosID == "." || config.IntelRdt.ClosID == ".." || strings.Contains(config.IntelRdt.ClosID, "/") {
287291
return fmt.Errorf("invalid intelRdt.ClosID %q", config.IntelRdt.ClosID)
288292
}

libcontainer/intelrdt/intelrdt.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ func WriteIntelRdtTasks(dir string, pid int) error {
416416
return nil
417417
}
418418

419+
// IsEnabled checks if Intel RDT is enabled.
420+
func IsEnabled() bool {
421+
fsroot, err := Root()
422+
return err == nil && fsroot != ""
423+
}
424+
419425
// IsCATEnabled checks if Intel RDT/CAT is enabled.
420426
func IsCATEnabled() bool {
421427
featuresInit()

0 commit comments

Comments
 (0)