All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] powercap, intel_rapl.c, fix BIOS lock check
@ 2015-12-09 13:31 Prarit Bhargava
  2015-12-09 16:53 ` Jacob Pan
  0 siblings, 1 reply; 7+ messages in thread
From: Prarit Bhargava @ 2015-12-09 13:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Prarit Bhargava, Rafael J. Wysocki, Jacob Pan,
	Radivoje Jovanovic, Seiichi Ikarashi, Mathias Krause,
	Ajay Thomas

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" <rafael.j.wysocki@intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Radivoje Jovanovic <radivoje.jovanovic@intel.com>
Cc: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
Cc: Mathias Krause <minipli@googlemail.com>
Cc: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com>
Signed-off-by: Prarit Bhargava <prarit@redhat.com>

[v2]: fix brackets
---
 drivers/powercap/intel_rapl.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index cc97f08..48747c2 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -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;
 		}
 	}
 
-- 
1.7.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] powercap, intel_rapl.c, fix BIOS lock check
  2015-12-09 13:31 [PATCH v2] powercap, intel_rapl.c, fix BIOS lock check Prarit Bhargava
@ 2015-12-09 16:53 ` Jacob Pan
  2015-12-09 23:38   ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Jacob Pan @ 2015-12-09 16:53 UTC (permalink / raw)
  To: Prarit Bhargava
  Cc: linux-kernel, Rafael J. Wysocki, Radivoje Jovanovic,
	Seiichi Ikarashi, Mathias Krause, Ajay Thomas, jacob.jun.pan

On Wed,  9 Dec 2015 08:31:12 -0500
Prarit Bhargava <prarit@redhat.com> 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" <rafael.j.wysocki@intel.com>
> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Cc: Radivoje Jovanovic <radivoje.jovanovic@intel.com>
> Cc: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
> Cc: Mathias Krause <minipli@googlemail.com>
> Cc: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> 
> [v2]: fix brackets

Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>

Good catch by Seiichi, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] powercap, intel_rapl.c, fix BIOS lock check
  2015-12-09 23:38   ` Rafael J. Wysocki
@ 2015-12-09 23:31     ` Jacob Pan
  2015-12-10  0:52       ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Jacob Pan @ 2015-12-09 23:31 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Prarit Bhargava, linux-kernel, Rafael J. Wysocki,
	Radivoje Jovanovic, Seiichi Ikarashi, Mathias Krause,
	Ajay Thomas, jacob.jun.pan

On Thu, 10 Dec 2015 00:38:27 +0100
"Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:

> 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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] powercap, intel_rapl.c, fix BIOS lock check
  2015-12-09 16:53 ` Jacob Pan
@ 2015-12-09 23:38   ` Rafael J. Wysocki
  2015-12-09 23:31     ` Jacob Pan
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2015-12-09 23:38 UTC (permalink / raw)
  To: Jacob Pan
  Cc: Prarit Bhargava, linux-kernel, Rafael J. Wysocki,
	Radivoje Jovanovic, Seiichi Ikarashi, Mathias Krause,
	Ajay Thomas

On Wednesday, December 09, 2015 08:53:55 AM Jacob Pan wrote:
> On Wed,  9 Dec 2015 08:31:12 -0500
> Prarit Bhargava <prarit@redhat.com> 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" <rafael.j.wysocki@intel.com>
> > Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> > Cc: Radivoje Jovanovic <radivoje.jovanovic@intel.com>
> > Cc: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
> > Cc: Mathias Krause <minipli@googlemail.com>
> > Cc: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com>
> > Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> > 
> > [v2]: fix brackets
> 
> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] powercap, intel_rapl.c, fix BIOS lock check
  2015-12-09 23:31     ` Jacob Pan
@ 2015-12-10  0:52       ` Rafael J. Wysocki
  2015-12-10 11:04         ` Prarit Bhargava
  2015-12-11 16:39         ` Jacob Pan
  0 siblings, 2 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2015-12-10  0:52 UTC (permalink / raw)
  To: Jacob Pan
  Cc: Prarit Bhargava, linux-kernel, Rafael J. Wysocki,
	Radivoje Jovanovic, Seiichi Ikarashi, Mathias Krause,
	Ajay Thomas

On Wednesday, December 09, 2015 03:31:23 PM Jacob Pan wrote:
> On Thu, 10 Dec 2015 00:38:27 +0100
> "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:
> 
> > 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] powercap, intel_rapl.c, fix BIOS lock check
  2015-12-10  0:52       ` Rafael J. Wysocki
@ 2015-12-10 11:04         ` Prarit Bhargava
  2015-12-11 16:39         ` Jacob Pan
  1 sibling, 0 replies; 7+ messages in thread
From: Prarit Bhargava @ 2015-12-10 11:04 UTC (permalink / raw)
  To: Rafael J. Wysocki, Jacob Pan
  Cc: linux-kernel, Rafael J. Wysocki, Radivoje Jovanovic,
	Seiichi Ikarashi, Mathias Krause, Ajay Thomas



On 12/09/2015 07:52 PM, Rafael J. Wysocki wrote:
> On Wednesday, December 09, 2015 03:31:23 PM Jacob Pan wrote:
>> On Thu, 10 Dec 2015 00:38:27 +0100
>> "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:
>>
>>> 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.

> Thanks,
> Rafael
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] powercap, intel_rapl.c, fix BIOS lock check
  2015-12-10  0:52       ` Rafael J. Wysocki
  2015-12-10 11:04         ` Prarit Bhargava
@ 2015-12-11 16:39         ` Jacob Pan
  1 sibling, 0 replies; 7+ messages in thread
From: Jacob Pan @ 2015-12-11 16:39 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Prarit Bhargava, linux-kernel, Rafael J. Wysocki,
	Radivoje Jovanovic, Seiichi Ikarashi, Mathias Krause,
	Ajay Thomas, jacob.jun.pan

On Thu, 10 Dec 2015 01:52:37 +0100
"Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:

> So which "stable" series in particular should it go to?  All
> applicable?
yes. rapl is there since SNB, quite some time.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-11 16:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 13:31 [PATCH v2] powercap, intel_rapl.c, fix BIOS lock check Prarit Bhargava
2015-12-09 16:53 ` Jacob Pan
2015-12-09 23:38   ` Rafael J. Wysocki
2015-12-09 23:31     ` Jacob Pan
2015-12-10  0:52       ` Rafael J. Wysocki
2015-12-10 11:04         ` Prarit Bhargava
2015-12-11 16:39         ` Jacob Pan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.