Add GNU/Linux kernel patch to allow us to read RAPL sysfs interface

Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
2024-09-13 19:34:58 +07:00
parent 247f7cb3a2
commit 41691b01ba

View File

@@ -0,0 +1,30 @@
From bcc037a5b2de3de47900afd609232878742f7843 Mon Sep 17 00:00:00 2001
From: MOVZX <movzx@yahoo.com>
Date: Wed, 1 Jun 2022 23:48:23 +0700
Subject: [PATCH] powercap: Set proper permission to allow user acquiring
realtime CPU Power usage
Signed-off-by: MOVZX <movzx@yahoo.com>
---
drivers/powercap/powercap_sys.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
index f0654a932b37..d4ad670de8e3 100644
--- a/drivers/powercap/powercap_sys.c
+++ b/drivers/powercap/powercap_sys.c
@@ -366,9 +366,9 @@ static void create_power_zone_common_attributes(
&dev_attr_max_energy_range_uj.attr;
if (power_zone->ops->get_energy_uj) {
if (power_zone->ops->reset_energy_uj)
- dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUSR;
+ dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUSR | S_IROTH;
else
- dev_attr_energy_uj.attr.mode = S_IRUSR;
+ dev_attr_energy_uj.attr.mode = S_IRUSR | S_IROTH;
power_zone->zone_dev_attrs[count++] =
&dev_attr_energy_uj.attr;
}
--
GitLab