Skip to contentSkip to conversation

powercap, intel_rapl.c, fix BIOS lock check

PATCH In review Prarit Bhargava 3 participants 7 messages Dec 9, 2015 – Dec 11, 2015 Power management core

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powercap, intel_rapl.c, fix BIOS lock check

Intel RAPL initialized on several systems where the BIOS lock bit (msr 0x610, bit 63) was set. This occured because the return value of rapl_read_data_raw() was being checked, rather than the value of the variable passed in, locked.

This patch properly implments the rapl_read_data_raw() call to check the variable locked, and now the Intel RAPL driver outputs the warning:

intel_rapl: RAPL package 0 domain package locked by BIOS

and does not initialize for the package.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Jacob Pan <[email protected]>
Cc Radivoje Jovanovic <[email protected]>
Cc Seiichi Ikarashi <[email protected]>
Cc Mathias Krause <[email protected]>
Cc Ajay Thomas <[email protected]>

[v2]: fix brackets

---
 drivers/powercap/intel_rapl.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/powercap/intel_rapl.c +5 -2
index cc97f08..48747c2 100644
@@ -1341,10 +1341,13 @@ static int rapl_detect_domains(struct rapl_package *rp, int cpu)
 
 	for (rd = rp->domains; rd < rp->domains + rp->nr_domains; rd++) {
 		/* check if the domain is locked by BIOS */
-		if (rapl_read_data_raw(rd, FW_LOCK, false, &locked)) {
+		ret = rapl_read_data_raw(rd, FW_LOCK, false, &locked);
+		if (ret)
+			return ret;
+		if (locked) {
 			pr_info("RAPL package %d domain %s locked by BIOS\n",
 				rp->id, rd->name);
-				rd->state |= DOMAIN_STATE_BIOS_LOCKED;
+			rd->state |= DOMAIN_STATE_BIOS_LOCKED;
 		}
 	}
 
Signature · 1 line
1.7.9.3
Acked-by on v2 1/1
#1 lore raw
Quoted 21 lines · On Wed, 9 Dec 2015 08:31:12 -0500 Prarit Bhargava <[email protected]> wrote:

Intel RAPL initialized on several systems where the BIOS lock bit (msr 0x610, bit 63) was set. This occured because the return value of rapl_read_data_raw() was being checked, rather than the value of the variable passed in, locked.

This patch properly implments the rapl_read_data_raw() call to check the variable locked, and now the Intel RAPL driver outputs the warning:

intel_rapl: RAPL package 0 domain package locked by BIOS

and does not initialize for the package.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Jacob Pan <[email protected]>
Cc Radivoje Jovanovic <[email protected]>
Cc Seiichi Ikarashi <[email protected]>
Cc Mathias Krause <[email protected]>
Cc Ajay Thomas <[email protected]>
Quoted 1 line

[v2]: fix brackets

Good catch by Seiichi, thanks.

#2 lore raw
Quoted 24 lines · Jacob Pan
Quoted 21 lines · On Wed, 9 Dec 2015 08:31:12 -0500 Prarit Bhargava <[email protected]> wrote:

Intel RAPL initialized on several systems where the BIOS lock bit (msr 0x610, bit 63) was set. This occured because the return value of rapl_read_data_raw() was being checked, rather than the value of the variable passed in, locked.

This patch properly implments the rapl_read_data_raw() call to check the variable locked, and now the Intel RAPL driver outputs the warning:

intel_rapl: RAPL package 0 domain package locked by BIOS

and does not initialize for the package.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Jacob Pan <[email protected]>
Cc Radivoje Jovanovic <[email protected]>
Cc Seiichi Ikarashi <[email protected]>
Cc Mathias Krause <[email protected]>
Cc Ajay Thomas <[email protected]>
Quoted 3 lines
Quoted 1 line

[v2]: fix brackets

OK, I've put it into my bleeding-edge branch as 4.5 candidate, but do we want it in "stable" and therefore should it be pushed for 4.4?

Thanks,
Rafael

#3 lore raw
Quoted 2 lines · On Thu, 10 Dec 2015 00:38:27 +0100 "Rafael J. Wysocki" <[email protected]>…

OK, I've put it into my bleeding-edge branch as 4.5 candidate, but do we want it in "stable" and therefore should it be pushed for 4.4?

yes, it is a bug fix that may affect many systems locked by BIOS.

#4 lore raw
Quoted 6 lines · Jacob Pan
Quoted 2 lines · On Thu, 10 Dec 2015 00:38:27 +0100 "Rafael J. Wysocki" <[email protected]>…

OK, I've put it into my bleeding-edge branch as 4.5 candidate, but do we want it in "stable" and therefore should it be pushed for 4.4?

yes, it is a bug fix that may affect many systems locked by BIOS.

So which "stable" series in particular should it go to? All applicable?

Thanks,
Rafael

#5 lore raw
Quoted 10 lines · Rafael J. Wysocki
Quoted 6 lines · Jacob Pan
Quoted 2 lines · On Thu, 10 Dec 2015 00:38:27 +0100 "Rafael J. Wysocki" <[email protected]>…

OK, I've put it into my bleeding-edge branch as 4.5 candidate, but do we want it in "stable" and therefore should it be pushed for 4.4?

yes, it is a bug fix that may affect many systems locked by BIOS.

So which "stable" series in particular should it go to? All applicable?

Yes, all applicable IMO.

P.

Quoted 3 lines

Thanks,
Rafael