linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/ACPI/cstate: Output AMD on APCI C1 FFH MWAIT AMD systems
@ 2018-08-08 17:47 Prarit Bhargava
  2018-08-08 19:58 ` Pavel Machek
  0 siblings, 1 reply; 6+ messages in thread
From: Prarit Bhargava @ 2018-08-08 17:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Prarit Bhargava, Len Brown, Rafael J. Wysocki, Pavel Machek,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, linux-pm

commit 5209654a46ee ("x86/ACPI/cstate: Allow ACPI C1 FFH MWAIT use on AMD
systems") allows use of FFH for ACPI C1 but tools like cpupower and turbostat
display INTEL for the cstate description.

Output "AMD" for AMD systems with FFH for ACPI C1.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Len Brown <lenb@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: linux-pm@vger.kernel.org
---
 arch/x86/kernel/acpi/cstate.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index dde437f5d14f..f10d3c673519 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -76,6 +76,7 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
 	unsigned int edx_part;
 	unsigned int cstate_type; /* C-state type and not ACPI C-state type */
 	unsigned int num_cstate_subtype;
+	struct cpuinfo_x86 *c = &boot_cpu_data;
 
 	cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
 
@@ -107,9 +108,14 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
 			"Monitor-Mwait will be used to enter C-%d state\n",
 			cx->type);
 	}
-	snprintf(cx->desc,
-			ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
-			cx->address);
+	if (c->x86_vendor == X86_VENDOR_INTEL)
+		snprintf(cx->desc,
+			 ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
+			 cx->address);
+	else
+		snprintf(cx->desc,
+			 ACPI_CX_DESC_LEN, "ACPI FFH AMD MWAIT 0x%x",
+			 cx->address);
 out:
 	return retval;
 }
-- 
2.14.4


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

* Re: [PATCH] x86/ACPI/cstate: Output AMD on APCI C1 FFH MWAIT AMD systems
  2018-08-08 17:47 [PATCH] x86/ACPI/cstate: Output AMD on APCI C1 FFH MWAIT AMD systems Prarit Bhargava
@ 2018-08-08 19:58 ` Pavel Machek
  2018-08-08 20:01   ` Len Brown
  2018-08-09 11:43   ` Prarit Bhargava
  0 siblings, 2 replies; 6+ messages in thread
From: Pavel Machek @ 2018-08-08 19:58 UTC (permalink / raw)
  To: Prarit Bhargava
  Cc: linux-kernel, Len Brown, Rafael J. Wysocki, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, linux-pm

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

On Wed 2018-08-08 13:47:35, Prarit Bhargava wrote:
> commit 5209654a46ee ("x86/ACPI/cstate: Allow ACPI C1 FFH MWAIT use on AMD
> systems") allows use of FFH for ACPI C1 but tools like cpupower and turbostat
> display INTEL for the cstate description.
> 
> Output "AMD" for AMD systems with FFH for ACPI C1.

Um, is it good idea?

First, you are changing kernel API.

> @@ -107,9 +108,14 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
>  			"Monitor-Mwait will be used to enter C-%d state\n",
>  			cx->type);
>  	}
> -	snprintf(cx->desc,
> -			ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
> -			cx->address);
> +	if (c->x86_vendor == X86_VENDOR_INTEL)
> +		snprintf(cx->desc,
> +			 ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
> +			 cx->address);
> +	else
> +		snprintf(cx->desc,
> +			 ACPI_CX_DESC_LEN, "ACPI FFH AMD MWAIT 0x%x",
> +			 cx->address);

Second, I read it as "Intel MWAIT" instruction is used. Yes, AMD cpu can
use Intel MWAIT, too...

Third, there are more CPU vendors out there.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH] x86/ACPI/cstate: Output AMD on APCI C1 FFH MWAIT AMD systems
  2018-08-08 19:58 ` Pavel Machek
@ 2018-08-08 20:01   ` Len Brown
  2018-08-08 21:06     ` Pavel Machek
  2018-08-09 11:43   ` Prarit Bhargava
  1 sibling, 1 reply; 6+ messages in thread
From: Len Brown @ 2018-08-08 20:01 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Prarit Bhargava, linux-kernel, Rafael J. Wysocki,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, X86 ML,
	Linux PM list

I think it is sufficient to simply delete the "INTEL" in that string.

In the unlikely event that this "change to a kernel API" breaks
something, we can add it back.

-Len

On Wed, Aug 8, 2018 at 3:59 PM Pavel Machek <pavel@ucw.cz> wrote:
>
> On Wed 2018-08-08 13:47:35, Prarit Bhargava wrote:
> > commit 5209654a46ee ("x86/ACPI/cstate: Allow ACPI C1 FFH MWAIT use on AMD
> > systems") allows use of FFH for ACPI C1 but tools like cpupower and turbostat
> > display INTEL for the cstate description.
> >
> > Output "AMD" for AMD systems with FFH for ACPI C1.
>
> Um, is it good idea?
>
> First, you are changing kernel API.
>
> > @@ -107,9 +108,14 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
> >                       "Monitor-Mwait will be used to enter C-%d state\n",
> >                       cx->type);
> >       }
> > -     snprintf(cx->desc,
> > -                     ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
> > -                     cx->address);
> > +     if (c->x86_vendor == X86_VENDOR_INTEL)
> > +             snprintf(cx->desc,
> > +                      ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
> > +                      cx->address);
> > +     else
> > +             snprintf(cx->desc,
> > +                      ACPI_CX_DESC_LEN, "ACPI FFH AMD MWAIT 0x%x",
> > +                      cx->address);
>
> Second, I read it as "Intel MWAIT" instruction is used. Yes, AMD cpu can
> use Intel MWAIT, too...
>
> Third, there are more CPU vendors out there.
>
>                                                                         Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html



-- 
Len Brown, Intel Open Source Technology Center

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

* Re: [PATCH] x86/ACPI/cstate: Output AMD on APCI C1 FFH MWAIT AMD systems
  2018-08-08 20:01   ` Len Brown
@ 2018-08-08 21:06     ` Pavel Machek
  0 siblings, 0 replies; 6+ messages in thread
From: Pavel Machek @ 2018-08-08 21:06 UTC (permalink / raw)
  To: Len Brown
  Cc: Prarit Bhargava, linux-kernel, Rafael J. Wysocki,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, X86 ML,
	Linux PM list

[-- Attachment #1: Type: text/plain, Size: 2067 bytes --]

On Wed 2018-08-08 16:01:41, Len Brown wrote:
> I think it is sufficient to simply delete the "INTEL" in that string.
> 
> In the unlikely event that this "change to a kernel API" breaks
> something, we can add it back.

I'd just leave it alone. But yes, just deleting INTEL is better than
patch below.
								Pavel

> > On Wed 2018-08-08 13:47:35, Prarit Bhargava wrote:
> > > commit 5209654a46ee ("x86/ACPI/cstate: Allow ACPI C1 FFH MWAIT use on AMD
> > > systems") allows use of FFH for ACPI C1 but tools like cpupower and turbostat
> > > display INTEL for the cstate description.
> > >
> > > Output "AMD" for AMD systems with FFH for ACPI C1.
> >
> > Um, is it good idea?
> >
> > First, you are changing kernel API.
> >
> > > @@ -107,9 +108,14 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
> > >                       "Monitor-Mwait will be used to enter C-%d state\n",
> > >                       cx->type);
> > >       }
> > > -     snprintf(cx->desc,
> > > -                     ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
> > > -                     cx->address);
> > > +     if (c->x86_vendor == X86_VENDOR_INTEL)
> > > +             snprintf(cx->desc,
> > > +                      ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
> > > +                      cx->address);
> > > +     else
> > > +             snprintf(cx->desc,
> > > +                      ACPI_CX_DESC_LEN, "ACPI FFH AMD MWAIT 0x%x",
> > > +                      cx->address);
> >
> > Second, I read it as "Intel MWAIT" instruction is used. Yes, AMD cpu can
> > use Intel MWAIT, too...
> >
> > Third, there are more CPU vendors out there.
> >
> >                                                                         Pavel
> > --
> > (english) http://www.livejournal.com/~pavelmachek
> > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
> 
> 
> 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH] x86/ACPI/cstate: Output AMD on APCI C1 FFH MWAIT AMD systems
  2018-08-08 19:58 ` Pavel Machek
  2018-08-08 20:01   ` Len Brown
@ 2018-08-09 11:43   ` Prarit Bhargava
  2018-08-09 16:25     ` Len Brown
  1 sibling, 1 reply; 6+ messages in thread
From: Prarit Bhargava @ 2018-08-09 11:43 UTC (permalink / raw)
  To: Pavel Machek
  Cc: linux-kernel, Len Brown, Rafael J. Wysocki, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, linux-pm



On 08/08/2018 03:58 PM, Pavel Machek wrote:
> On Wed 2018-08-08 13:47:35, Prarit Bhargava wrote:
>> commit 5209654a46ee ("x86/ACPI/cstate: Allow ACPI C1 FFH MWAIT use on AMD
>> systems") allows use of FFH for ACPI C1 but tools like cpupower and turbostat
>> display INTEL for the cstate description.
>>
>> Output "AMD" for AMD systems with FFH for ACPI C1.
> 
> Um, is it good idea?
>> First, you are changing kernel API.

I thought about that and the AMD support was only added a year ago so I think it
is okay to change.  Secondly, I did a grep for the use of the desc file in the
Fedora sources and only found a few places where the file is referenced.  They
all *report* the data but do not use it to make a decision.

For example, turbostat and cpupower only return the data to the console.

> 
>> @@ -107,9 +108,14 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
>>  			"Monitor-Mwait will be used to enter C-%d state\n",
>>  			cx->type);
>>  	}
>> -	snprintf(cx->desc,
>> -			ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
>> -			cx->address);
>> +	if (c->x86_vendor == X86_VENDOR_INTEL)
>> +		snprintf(cx->desc,
>> +			 ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
>> +			 cx->address);
>> +	else
>> +		snprintf(cx->desc,
>> +			 ACPI_CX_DESC_LEN, "ACPI FFH AMD MWAIT 0x%x",
>> +			 cx->address);
> 
> Second, I read it as "Intel MWAIT" instruction is used. Yes, AMD cpu can
> use Intel MWAIT, too...

That's true but the weirdness of seeing INTEL on an AMD box there made me push
this patch.

> 
> Third, there are more CPU vendors out there.

Not in this code.  It is AMD & Intel only.  I thought about dropping INTEL, and
also switching to X86.

Should we drop INTEL from the above or not (as suggested later in this thread)?
It feels like everyone is on the fence about it.

P.

> 
> 									Pavel
> 

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

* Re: [PATCH] x86/ACPI/cstate: Output AMD on APCI C1 FFH MWAIT AMD systems
  2018-08-09 11:43   ` Prarit Bhargava
@ 2018-08-09 16:25     ` Len Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Len Brown @ 2018-08-09 16:25 UTC (permalink / raw)
  To: Prarit Bhargava
  Cc: Pavel Machek, linux-kernel, Rafael J. Wysocki, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, X86 ML, Linux PM list

>> "ACPI FFH INTEL MWAIT 0x%x"

> Should we drop INTEL from the above or not (as suggested later in this thread)?
> It feels like everyone is on the fence about it.

Okay with me to drop the "INTEL" part of this string -- it actually
doesn't add any information.

thanks,
-Len

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

end of thread, other threads:[~2018-08-09 16:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-08 17:47 [PATCH] x86/ACPI/cstate: Output AMD on APCI C1 FFH MWAIT AMD systems Prarit Bhargava
2018-08-08 19:58 ` Pavel Machek
2018-08-08 20:01   ` Len Brown
2018-08-08 21:06     ` Pavel Machek
2018-08-09 11:43   ` Prarit Bhargava
2018-08-09 16:25     ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).