lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-4a6162f9e1c140c7436818983065365168075b0c@git.kernel.org>
Date:   Mon, 21 Nov 2016 07:49:14 -0800
From:   tip-bot for Thomas Gleixner <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     bigeasy@...utronix.de, tglx@...utronix.de, rjw@...ysocki.net,
        mingo@...nel.org, hpa@...or.com, linux-kernel@...r.kernel.org
Subject: [tip:smp/hotplug] powercap/intel_rapl: Add missing domain data
 update on hotplug

Commit-ID:  4a6162f9e1c140c7436818983065365168075b0c
Gitweb:     http://git.kernel.org/tip/4a6162f9e1c140c7436818983065365168075b0c
Author:     Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Thu, 17 Nov 2016 19:35:29 +0100
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Mon, 21 Nov 2016 16:37:06 +0100

powercap/intel_rapl: Add missing domain data update on hotplug

The domain data of packages is only updated at init time, but new packages
created by hotplug miss that treatment.

Add it there and remove the global update at init time, because it's now
obsolete.

Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: rt@...uxtronix.de
Cc: linux-pm@...r.kernel.org
Link: http://lkml.kernel.org/r/20161117183541.8588-9-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>

---
 drivers/powercap/intel_rapl.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index 243b233..44b12e2 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -1164,24 +1164,20 @@ static const struct x86_cpu_id rapl_ids[] __initconst = {
 };
 MODULE_DEVICE_TABLE(x86cpu, rapl_ids);
 
-/* read once for all raw primitive data for all packages, domains */
-static void rapl_update_domain_data(void)
+/* Read once for all raw primitive data for domains */
+static void rapl_update_domain_data(struct rapl_package *rp)
 {
 	int dmn, prim;
 	u64 val;
-	struct rapl_package *rp;
 
-	list_for_each_entry(rp, &rapl_packages, plist) {
-		for (dmn = 0; dmn < rp->nr_domains; dmn++) {
-			pr_debug("update package %d domain %s data\n", rp->id,
-				rp->domains[dmn].name);
+	for (dmn = 0; dmn < rp->nr_domains; dmn++) {
+		pr_debug("update package %d domain %s data\n", rp->id,
+			 rp->domains[dmn].name);
 			/* exclude non-raw primitives */
-			for (prim = 0; prim < NR_RAW_PRIMITIVES; prim++)
-				if (!rapl_read_data_raw(&rp->domains[dmn], prim,
-								rpi[prim].unit,
-								&val))
-					rp->domains[dmn].rdd.primitives[prim] =
-									val;
+		for (prim = 0; prim < NR_RAW_PRIMITIVES; prim++) {
+			if (!rapl_read_data_raw(&rp->domains[dmn], prim,
+						rpi[prim].unit,	&val))
+				rp->domains[dmn].rdd.primitives[prim] = val;
 		}
 	}
 
@@ -1239,6 +1235,9 @@ static int rapl_package_register_powercap(struct rapl_package *rp)
 	struct powercap_zone *power_zone = NULL;
 	int nr_pl;
 
+	/* Update the domain data of the new package */
+	rapl_update_domain_data(rp);
+
 	/* first we register package domain as the parent zone*/
 	for (rd = rp->domains; rd < rp->domains + rp->nr_domains; rd++) {
 		if (rd->id == RAPL_DOMAIN_PACKAGE) {
@@ -1357,8 +1356,7 @@ static int rapl_register_powercap(void)
 		pr_debug("failed to register powercap control_type.\n");
 		return PTR_ERR(control_type);
 	}
-	/* read the initial data */
-	rapl_update_domain_data();
+
 	list_for_each_entry(rp, &rapl_packages, plist)
 		if (rapl_package_register_powercap(rp))
 			goto err_cleanup_package;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ