From 488f643da42627e1bb3e35cc70443abcebbca9bb Mon Sep 17 00:00:00 2001 From: Daniel Dao Date: Thu, 27 Aug 2026 12:28:53 +0100 Subject: [PATCH] resctrl: return 0 for AMD when we get Unavailable stats AMD can return Unavailable for groups that was just initialized and didn't have any data i.e. no tasks ran on the group. For example > cat mon_data/mon_L3_*/mbm_total_bytes 1536320 Unavailable Unavailable Unavailable There isn't anything really wrong with Unavailable here, so we should assume 0 and continue with the collection. See also the original report https://bugzilla.kernel.org/show_bug.cgi?id=213311 --- resctrl/intel/utils.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/resctrl/intel/utils.go b/resctrl/intel/utils.go index 860a684d44..13ee48631a 100644 --- a/resctrl/intel/utils.go +++ b/resctrl/intel/utils.go @@ -307,12 +307,14 @@ func readStatFrom(path string, vendorID string) (uint64, error) { contextString := string(bytes.TrimSpace(context)) if contextString == unavailable { - err := fmt.Errorf("\"Unavailable\" value from file %q", path) if vendorID == "AuthenticAMD" { - kernelBugzillaLink := "https://bugzilla.kernel.org/show_bug.cgi?id=213311" - err = fmt.Errorf("%v, possible bug: %q", err, kernelBugzillaLink) + // AMD can return Unavailable when it does not have any data (i.e. no tasks ran on the group) + // It's better to return 0 and let user have metrics/deal with it rather + // than return errors and failing the collection + // See https://bugzilla.kernel.org/show_bug.cgi?id=213311 + return 0, nil } - return 0, err + return 0, fmt.Errorf("\"Unavailable\" value from file %q", path) } stat, err := strconv.ParseUint(contextString, 10, 64)