Skip to content

Commit

Permalink
x86: Optimize cmpxchg64() at build-time some more
Browse files Browse the repository at this point in the history
Try to avoid the 'alternates()' code when we can statically
determine that cmpxchg8b is fine. We already have that
CONFIG_x86_CMPXCHG64 (enabled by PAE support), and we could easily
also enable it for some of the CPU cases.

Note, this patch only adds CMPXCHG8B for the obvious Intel CPU's,
not for others. (There was something really messy about cmpxchg8b
and clone CPU's, so if you enable it on other CPUs later, do it
carefully.)

If we avoid that asm-alternative thing when we can assume the
instruction exists, we'll generate less support crud, and we'll
avoid the whole issue with that extra 'nop' for padding instruction
sizes etc.

LKML-Reference: <alpine.LFD.2.01.0909301743150.6996@localhost.localdomain>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Linus Torvalds authored and Ingo Molnar committed Oct 1, 2009
1 parent 84d88d5 commit 982d007
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/x86/Kconfig.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ config X86_TSC

config X86_CMPXCHG64
def_bool y
depends on X86_PAE || X86_64
depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MATOM

# this should be set for all -march=.. options where the compiler
# generates cmov.
Expand All @@ -412,6 +412,7 @@ config X86_MINIMUM_CPU_FAMILY
int
default "64" if X86_64
default "6" if X86_32 && X86_P6_NOP
default "5" if X86_32 && X86_CMPXCHG64
default "4" if X86_32 && (X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK)
default "3"

Expand Down

0 comments on commit 982d007

Please sign in to comment.