All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Clean up mwait_play_dead
@ 2011-04-13 16:11 Frank Arnold
  2011-04-13 16:52 ` H. Peter Anvin
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Arnold @ 2011-04-13 16:11 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Thomas Gleixner; +Cc: linux-kernel

From: Frank Arnold <frank.arnold@amd.com>

Commit 93789b32dbf355e70f18b17a82e8661677a7f7fb introduced
cpuinfo_x86 *c for brevity. It is used to check for the
mwait feature flag. The same can be done with a subsequent
check for clflsh and save us a second per-cpu pointer
dereference.

Signed-off-by: Frank Arnold <frank.arnold@amd.com>
Acked-by: Borislav Petkov <borislav.petkov@amd.com>
---
 arch/x86/kernel/smpboot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index c2871d3..93a0066 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1334,7 +1334,7 @@ static inline void mwait_play_dead(void)
 
 	if (!(cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)))
 		return;
-	if (!cpu_has(__this_cpu_ptr(&cpu_info), X86_FEATURE_CLFLSH))
+	if (!cpu_has(c, X86_FEATURE_CLFLSH))
 		return;
 	if (__this_cpu_read(cpu_info.cpuid_level) < CPUID_MWAIT_LEAF)
 		return;
-- 
1.7.3.4


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

* Re: [PATCH] x86: Clean up mwait_play_dead
  2011-04-13 16:11 [PATCH] x86: Clean up mwait_play_dead Frank Arnold
@ 2011-04-13 16:52 ` H. Peter Anvin
  2011-04-13 17:36   ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: H. Peter Anvin @ 2011-04-13 16:52 UTC (permalink / raw)
  To: Frank Arnold; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel

On 04/13/2011 09:11 AM, Frank Arnold wrote:
> From: Frank Arnold <frank.arnold@amd.com>
> 
> Commit 93789b32dbf355e70f18b17a82e8661677a7f7fb introduced
> cpuinfo_x86 *c for brevity. It is used to check for the
> mwait feature flag. The same can be done with a subsequent
> check for clflsh and save us a second per-cpu pointer
> dereference.
> 
> Signed-off-by: Frank Arnold <frank.arnold@amd.com>
> Acked-by: Borislav Petkov <borislav.petkov@amd.com>
> ---
>  arch/x86/kernel/smpboot.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 

This should be using this_cpu_has()... if that's not in the tree yet we
should add it.

Creating an absolute pointer for a percpu references is a big lose.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [PATCH] x86: Clean up mwait_play_dead
  2011-04-13 16:52 ` H. Peter Anvin
@ 2011-04-13 17:36   ` Borislav Petkov
  2011-04-13 17:38     ` H. Peter Anvin
  2011-04-13 17:49     ` Ingo Molnar
  0 siblings, 2 replies; 6+ messages in thread
From: Borislav Petkov @ 2011-04-13 17:36 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Frank Arnold, Ingo Molnar, Thomas Gleixner, linux-kernel

On Wed, Apr 13, 2011 at 09:52:40AM -0700, H. Peter Anvin wrote:
> On 04/13/2011 09:11 AM, Frank Arnold wrote:
> > From: Frank Arnold <frank.arnold@amd.com>
> > 
> > Commit 93789b32dbf355e70f18b17a82e8661677a7f7fb introduced
> > cpuinfo_x86 *c for brevity. It is used to check for the
> > mwait feature flag. The same can be done with a subsequent
> > check for clflsh and save us a second per-cpu pointer
> > dereference.
> > 
> > Signed-off-by: Frank Arnold <frank.arnold@amd.com>
> > Acked-by: Borislav Petkov <borislav.petkov@amd.com>
> > ---
> >  arch/x86/kernel/smpboot.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> 
> This should be using this_cpu_has()... if that's not in the tree yet we
> should add it.

Looks like it is still in tip/x86/mm.

We could either redo the patch properly when this_cpu_has() is merged or
add the change against that branch.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

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

* Re: [PATCH] x86: Clean up mwait_play_dead
  2011-04-13 17:36   ` Borislav Petkov
@ 2011-04-13 17:38     ` H. Peter Anvin
  2011-04-13 17:49     ` Ingo Molnar
  1 sibling, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2011-04-13 17:38 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Frank Arnold, Ingo Molnar, Thomas Gleixner, linux-kernel

On 04/13/2011 10:36 AM, Borislav Petkov wrote:
>>
>> This should be using this_cpu_has()... if that's not in the tree yet we
>> should add it.
> 
> Looks like it is still in tip/x86/mm.
> 
> We could either redo the patch properly when this_cpu_has() is merged or
> add the change against that branch.
> 

It really should probably have been in tip:x86/cpu not x86/mm, but since
this is so simple we can just add it to the branch.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [PATCH] x86: Clean up mwait_play_dead
  2011-04-13 17:36   ` Borislav Petkov
  2011-04-13 17:38     ` H. Peter Anvin
@ 2011-04-13 17:49     ` Ingo Molnar
  2011-04-14 11:44       ` Frank Arnold
  1 sibling, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2011-04-13 17:49 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: H. Peter Anvin, Frank Arnold, Thomas Gleixner, linux-kernel


* Borislav Petkov <bp@amd64.org> wrote:

> On Wed, Apr 13, 2011 at 09:52:40AM -0700, H. Peter Anvin wrote:
> > On 04/13/2011 09:11 AM, Frank Arnold wrote:
> > > From: Frank Arnold <frank.arnold@amd.com>
> > > 
> > > Commit 93789b32dbf355e70f18b17a82e8661677a7f7fb introduced
> > > cpuinfo_x86 *c for brevity. It is used to check for the
> > > mwait feature flag. The same can be done with a subsequent
> > > check for clflsh and save us a second per-cpu pointer
> > > dereference.
> > > 
> > > Signed-off-by: Frank Arnold <frank.arnold@amd.com>
> > > Acked-by: Borislav Petkov <borislav.petkov@amd.com>
> > > ---
> > >  arch/x86/kernel/smpboot.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > 
> > 
> > This should be using this_cpu_has()... if that's not in the tree yet we
> > should add it.
> 
> Looks like it is still in tip/x86/mm.

Yeah - that patch was sent at around the beginning of the merge window, so it 
was too late for .39.

> We could either redo the patch properly when this_cpu_has() is merged or add 
> the change against that branch.

Yeah - please do one against tip:master and we'll put it into the right topic 
branch.

Thanks,

	Ingo

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

* Re: [PATCH] x86: Clean up mwait_play_dead
  2011-04-13 17:49     ` Ingo Molnar
@ 2011-04-14 11:44       ` Frank Arnold
  0 siblings, 0 replies; 6+ messages in thread
From: Frank Arnold @ 2011-04-14 11:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Borislav Petkov, H. Peter Anvin, Frank Arnold, Thomas Gleixner,
	linux-kernel@vger.kernel.org

On Wed, 2011-04-13 at 13:49 -0400, Ingo Molnar wrote:
> * Borislav Petkov <bp@amd64.org> wrote:
> 
> > On Wed, Apr 13, 2011 at 09:52:40AM -0700, H. Peter Anvin wrote:
> > > On 04/13/2011 09:11 AM, Frank Arnold wrote:
> > > > From: Frank Arnold <frank.arnold@amd.com>
> > > > 
> > > > Commit 93789b32dbf355e70f18b17a82e8661677a7f7fb introduced
> > > > cpuinfo_x86 *c for brevity. It is used to check for the
> > > > mwait feature flag. The same can be done with a subsequent
> > > > check for clflsh and save us a second per-cpu pointer
> > > > dereference.
> > > > 
> > > > Signed-off-by: Frank Arnold <frank.arnold@amd.com>
> > > > Acked-by: Borislav Petkov <borislav.petkov@amd.com>
> > > > ---
> > > >  arch/x86/kernel/smpboot.c |    2 +-
> > > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > > 
> > > 
> > > This should be using this_cpu_has()... if that's not in the tree yet we
> > > should add it.
> > 
> > Looks like it is still in tip/x86/mm.
> 
> Yeah - that patch was sent at around the beginning of the merge window, so it 
> was too late for .39.
> 
> > We could either redo the patch properly when this_cpu_has() is merged or add 
> > the change against that branch.
> 
> Yeah - please do one against tip:master and we'll put it into the right topic 
> branch.

It's already fixed in tip:master with the proper use of this_cpu_has().
commit 349c004e3d31fda23ad225b61861be38047fff16

Sorry for the noise.

-- 
Frank.

Advanced Micro Devices GmbH
Sitz: Dornach, Gemeinde Aschheim,
Landkreis München Registergericht München,
HRB Nr. 43632 - WEEE Registrierungsnummer 129 19551
Geschäftsführer: Alberto Bozzo, Andrew Bowd



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

end of thread, other threads:[~2011-04-14 11:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-13 16:11 [PATCH] x86: Clean up mwait_play_dead Frank Arnold
2011-04-13 16:52 ` H. Peter Anvin
2011-04-13 17:36   ` Borislav Petkov
2011-04-13 17:38     ` H. Peter Anvin
2011-04-13 17:49     ` Ingo Molnar
2011-04-14 11:44       ` Frank Arnold

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.