1. 30 8月, 2011 1 次提交
  2. 26 6月, 2011 1 次提交
    • C
      x86: Add support for cmpxchg_double · 3824abd1
      Christoph Lameter 提交于
      A simple implementation that only supports the word size and does not
      have a fallback mode (would require a spinlock).
      
      Add 32 and 64 bit support for cmpxchg_double. cmpxchg double uses
      the cmpxchg8b or cmpxchg16b instruction on x86 processors to compare
      and swap 2 machine words. This allows lockless algorithms to move more
      context information through critical sections.
      
      Set a flag CONFIG_CMPXCHG_DOUBLE to signal that support for double word
      cmpxchg detection has been build into the kernel. Note that each subsystem
      using cmpxchg_double has to implement a fall back mechanism as long as
      we offer support for processors that do not implement cmpxchg_double.
      Reviewed-by: NH. Peter Anvin <hpa@zytor.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: NChristoph Lameter <cl@linux.com>
      Link: http://lkml.kernel.org/r/20110601172614.173427964@linux.comSigned-off-by: NH. Peter Anvin <hpa@zytor.com>
      3824abd1
  3. 29 7月, 2010 2 次提交
    • H
      x86, asm: Merge cmpxchg_486_u64() and cmpxchg8b_emu() · a378d933
      H. Peter Anvin 提交于
      We have two functions for doing exactly the same thing -- emulating
      cmpxchg8b on 486 and older hardware -- with different calling
      conventions, and yet doing the same thing.  Drop the C version and use
      the assembly version, via alternatives, for both the local and
      non-local versions of cmpxchg8b.
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      LKML-Reference: <AANLkTikAmaDPji-TVDarmG1yD=fwbffcsmEU=YEuP+8r@mail.gmail.com>
      a378d933
    • H
      x86, asm: Clean up and simplify <asm/cmpxchg.h> · 4532b305
      H. Peter Anvin 提交于
      Remove the __xg() hack to create a memory barrier near xchg and
      cmpxchg; it has been there since 1.3.11 but should not be necessary
      with "asm volatile" and a "memory" clobber, neither of which were
      there in the original implementation.
      
      However, we *should* make this a volatile reference.
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      LKML-Reference: <AANLkTikAmaDPji-TVDarmG1yD=fwbffcsmEU=YEuP+8r@mail.gmail.com>
      4532b305
  4. 28 7月, 2010 2 次提交
    • H
      x86, asm: Clean up and simplify set_64bit() · 69309a05
      H. Peter Anvin 提交于
      Clean up and simplify set_64bit().  This code is quite old (1.3.11)
      and contains a fair bit of auxilliary machinery that current versions
      of gcc handle just fine automatically.  Worse, the auxilliary
      machinery can actually cause an unnecessary spill to memory.
      
      Furthermore, the loading of the old value inside the loop in the
      32-bit case is unnecessary: if the value doesn't match, the CMPXCHG8B
      instruction will already have loaded the "new previous" value for us.
      
      Clean up the comment, too, and remove page references to obsolete
      versions of the Intel SDM.
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      LKML-Reference: <tip-*@vger.kernel.org>
      69309a05
    • H
      x86: Add memory modify constraints to xchg() and cmpxchg() · 113fc5a6
      H. Peter Anvin 提交于
      xchg() and cmpxchg() modify their memory operands, not merely read
      them.  For some versions of gcc the "memory" clobber has apparently
      dealt with the situation, but not for all.
      Originally-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      Cc: Glauber Costa <glommer@redhat.com>
      Cc: Avi Kivity <avi@redhat.com>
      Cc: Peter Palfrader <peter@palfrader.org>
      Cc: Greg KH <gregkh@suse.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Zachary Amsden <zamsden@redhat.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: <stable@kernel.org>
      LKML-Reference: <4C4F7277.8050306@zytor.com>
      113fc5a6
  5. 26 2月, 2010 1 次提交
  6. 09 10月, 2009 1 次提交
  7. 01 10月, 2009 1 次提交
    • A
      x86: Provide an alternative() based cmpxchg64() · 79e1dd05
      Arjan van de Ven 提交于
      cmpxchg64() today generates, to quote Linus, "barf bag" code.
      
      cmpxchg64() is about to get used in the scheduler to fix a bug there,
      but it's a prerequisite that cmpxchg64() first be made non-sucking.
      
      This patch turns cmpxchg64() into an efficient implementation that
      uses the alternative() mechanism to just use the raw instruction on
      all modern systems.
      
      Note: the fallback is NOT smp safe, just like the current fallback
      is not SMP safe. (Interested parties with i486 based SMP systems
      are welcome to submit fix patches for that.)
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      [ fixed asm constraint bug ]
      Fixed-by: NEric Dumazet <eric.dumazet@gmail.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: John Stultz <johnstul@us.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20090930170754.0886ff2e@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      79e1dd05
  8. 23 10月, 2008 2 次提交
  9. 23 7月, 2008 1 次提交
    • V
      x86: consolidate header guards · 77ef50a5
      Vegard Nossum 提交于
      This patch is the result of an automatic script that consolidates the
      format of all the headers in include/asm-x86/.
      
      The format:
      
      1. No leading underscore. Names with leading underscores are reserved.
      2. Pathname components are separated by two underscores. So we can
         distinguish between mm_types.h and mm/types.h.
      3. Everything except letters and numbers are turned into single
         underscores.
      Signed-off-by: NVegard Nossum <vegard.nossum@gmail.com>
      77ef50a5
  10. 17 4月, 2008 1 次提交
  11. 22 3月, 2008 1 次提交
  12. 30 1月, 2008 1 次提交
    • M
      x86: fall back on interrupt disable in cmpxchg8b on 80386 and 80486 · 2c0b8a75
      Mathieu Desnoyers 提交于
      Actually, on 386, cmpxchg and cmpxchg_local fall back on
      cmpxchg_386_u8/16/32: it disables interruptions around non atomic
      updates to mimic the cmpxchg behavior.
      
      The comment:
      /* Poor man's cmpxchg for 386. Unsuitable for SMP */
      
      already present in cmpxchg_386_u32 tells much about how this cmpxchg
      implementation should not be used in a SMP context. However, the cmpxchg_local
      can perfectly use this fallback, since it only needs to be atomic wrt the local
      cpu.
      
      This patch adds a cmpxchg_486_u64 and uses it as a fallback for cmpxchg64
      and cmpxchg64_local on 80386 and 80486.
      
      Q:
      but why is it called cmpxchg_486 when the other functions are called
      
      A:
      Because the standard cmpxchg is missing only on 386, but cmpxchg8b is
      missing both on 386 and 486.
      
      Citing Intel's Instruction set reference:
      
      cmpxchg:
      This instruction is not supported on Intel processors earlier than the
      Intel486 processors.
      
      cmpxchg8b:
      This instruction encoding is not supported on Intel processors earlier
      than the Pentium processors.
      
      Q:
      What's the reason to have cmpxchg64_local on 32 bit architectures?
      Without that need all this would just be a few simple defines.
      
      A:
      cmpxchg64_local on 32 bits architectures takes unsigned long long
      parameters, but cmpxchg_local only takes longs. Since we have cmpxchg8b
      to execute a 8 byte cmpxchg atomically on pentium and +, it makes sense
      to provide a flavor of cmpxchg and cmpxchg_local using this instruction.
      
      Also, for 32 bits architectures lacking the 64 bits atomic cmpxchg, it
      makes sense _not_ to define cmpxchg64 while cmpxchg could still be
      available.
      
      Moreover, the fallback for cmpxchg8b on i386 for 386 and 486 is a
      
      However, cmpxchg64_local will be emulated by disabling interrupts on all
      architectures where it is not supported atomically.
      
      Therefore, we *could* turn cmpxchg64_local into a cmpxchg_local, but it
      would make the 386/486 fallbacks ugly, make its design different from
      cmpxchg/cmpxchg64 (which really depends on atomic operations and cannot
      be emulated) and require the __cmpxchg_local to be expressed as a macro
      rather than an inline function so the parameters would not be fixed to
      unsigned long long in every case.
      
      So I think cmpxchg64_local makes sense there, but I am open to
      suggestions.
      
      Q:
      Are there any callers?
      
      A:
      I am actually using it in LTTng in my timestamping code. I use it to
      work around CPUs with asynchronous TSCs. I need to update 64 bits
      values atomically on this 32 bits architecture.
      
      Changelog:
      - Ran though checkpatch.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      2c0b8a75
  13. 11 10月, 2007 1 次提交
  14. 23 7月, 2007 1 次提交
  15. 20 7月, 2007 1 次提交
    • A
      i386: Allow KVM on i386 nonpae · 2d9ce177
      Avi Kivity 提交于
      Currently, CONFIG_X86_CMPXCHG64 both enables boot-time checking of
      the cmpxchg64b feature and enables compilation of the set_64bit() family.
      Since the option is dependent on PAE, and since KVM depends on set_64bit(),
      this effectively disables KVM on i386 nopae.
      
      Simplify by removing the config option altogether: the boot check is made
      dependent on CONFIG_X86_PAE directly, and the set_64bit() family is exposed
      without constraints.  It is up to users to check for the feature flag (KVM
      does not as virtualiation extensions imply its existence).
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2d9ce177
  16. 09 5月, 2007 1 次提交
    • J
      x86: create asm/cmpxchg.h · a436ed9c
      Jeff Dike 提交于
      i386:
      
        Rearrange the cmpxchg code to allow atomic.h to get it without needing to
        include system.h.  This kills warnings in the UML build from atomic.h about
        implicit declarations of cmpxchg symbols.  The i386 build presumably isn't
        seeing this because a separate inclusion of system.h is covering it over.
      
        The cmpxchg stuff is moved to asm-i386/cmpxchg.h, with an include left in
        system.h for the benefit of generic code which expects cmpxchg there.
      
        Meanwhile, atomic.h includes cmpxchg.h.
      
        This causes no noticable damage to the i386 build.
      
      x86_64:
      
        Move cmpxchg into its own header.  atomic.h already included system.h, so
        this is changed to include cmpxchg.h.
      
        This is purely cleanup - it's not fixing any warnings - so if the x86_64
        system.h isn't considered as cleanup-worthy as i386, then this can be
        dropped.
      
        It causes no noticable damage to the x86_64 build.
      
      uml:
      
        The i386 and x86_64 cmpxchg patches require an asm-um/cmpxchg.h for the
        UML build.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a436ed9c