Skip to contentSkip to conversation

powercap: intel_rapl_tpmi: Handle PMU registration failure during probe

PATCH Applied Sumeet Pawnikar 2 participants 2 messages Jul 23 – Jul 27 Power management core

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 powercap: intel_rapl_tpmi: Handle PMU registration failure during probe

intel_rapl_tpmi_probe() invokes rapl_package_add_pmu() but ignores its return value, so a PMU registration failure would leave the driver reporting probe success despite the PMU being absent, with no log trace.

Since PMU registration is an optional auxiliary feature for perf energy counters, its failure should not break the primary powercap functionality. Check the return value and log a warning to ensure graceful degradation.

Fixes 963a9ad3c589 ("powercap: intel_rapl_tpmi: Enable PMU support")

---
v2->v3:
* Fix the format string as per the Sashiko comment:

    https://sashiko.dev/#/patchset/20260719085100.145555-1-sumeet4linux%40gmail.com)

v1->v2:
* Since PMU registration is an optional auxiliary feature here, treat it's failure as a non fatal error and log a warning and continue, similar to other RAPL drivers like intel_rapl_msr, to ensure graceful degradation (Based on Sashiko feedback:
https://sashiko.dev/#/patchset/20260515184250.228062-1-sumeet4linux%40gmail.com)
* Add Fixes tag in changelog.

---
 drivers/powercap/intel_rapl_tpmi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/powercap/intel_rapl_tpmi.c +4 -1
index 7f41491d9cd1..a870199a9272 100644
@@ -414,7 +414,10 @@ static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev,
 		goto err;
 	}
 
-	rapl_package_add_pmu(trp->rp);
+	ret = rapl_package_add_pmu(trp->rp);
+	if (ret)
+		dev_warn(&auxdev->dev, "Failed to add RAPL PMU for Package%d, %d\n",
+			info->package_id, ret);
 
 	auxiliary_set_drvdata(auxdev, trp);
 
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 35 lines · Sumeet Pawnikar

intel_rapl_tpmi_probe() invokes rapl_package_add_pmu() but ignores its return value, so a PMU registration failure would leave the driver reporting probe success despite the PMU being absent, with no log trace.

Since PMU registration is an optional auxiliary feature for perf energy counters, its failure should not break the primary powercap functionality. Check the return value and log a warning to ensure graceful degradation.

Fixes 963a9ad3c589 ("powercap: intel_rapl_tpmi: Enable PMU support")

---
v2->v3:
* Fix the format string as per the Sashiko comment:

    https://sashiko.dev/#/patchset/20260719085100.145555-1-sumeet4linux%40gmail.com)

v1->v2:
* Since PMU registration is an optional auxiliary feature here, treat it's failure as a non fatal error and log a warning and continue, similar to other RAPL drivers like intel_rapl_msr, to ensure graceful degradation (Based on Sashiko feedback:
https://sashiko.dev/#/patchset/20260515184250.228062-1-sumeet4linux%40gmail.com)
* Add Fixes tag in changelog.

---
 drivers/powercap/intel_rapl_tpmi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/powercap/intel_rapl_tpmi.c +0 -0
index 7f41491d9cd1..a870199a9272 100644
@@ -414,7 +414,10 @@ static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev,
                goto err;
        }

drivers/powercap/intel_rapl_tpmi.c static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev,

Quoted 10 lines
drivers/powercap/intel_rapl_tpmi.c +4 -2
 
-       rapl_package_add_pmu(trp->rp);
+       ret = rapl_package_add_pmu(trp->rp);
+       if (ret)
+               dev_warn(&auxdev->dev, "Failed to add RAPL PMU for Package%d, %d\n",
+                       info->package_id, ret);
 
        auxiliary_set_drvdata(auxdev, trp);
 
--

Applied as 7.3 material, but I've changed the log level of the new message to "info".

Thanks!