1. 04 Jul, 2009 1 commit
    • Eric Dumazet's avatar
      x86: atomic64: Inline atomic64_read() again · a79f0da8
      Eric Dumazet authored
      
      Now atomic64_read() is light weight (no register pressure and
      small icache), we can inline it again.
      
      Also use "=&A" constraint instead of "+A" to avoid warning
      about unitialized 'res' variable. (gcc had to force 0 in eax/edx)
      
        $ size vmlinux.prev vmlinux.after
           text    data     bss     dec     hex filename
        4908667  451676 1684868 7045211  6b805b vmlinux.prev
        4908651  451676 1684868 7045195  6b804b vmlinux.after
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <4A4E1AA2.30002@gmail.com>
      [ Also fix typo in atomic64_set() export ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a79f0da8
  2. 03 Jul, 2009 5 commits
    • Ingo Molnar's avatar
      x86: atomic64: Improve atomic64_xchg() · 3a8d1788
      Ingo Molnar authored
      
      Remove the read-first logic from atomic64_xchg() and simplify
      the loop.
      
      This function was the last user of __atomic64_read() - remove it.
      
      Also, change the 'real_val' assumption from the somewhat quirky
      1ULL << 32 value to the (just as arbitrary, but simpler) value
      of 0.
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <tip-05118ab8859492ac9ddda0154cf90e37b0a4a0b0@git.kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3a8d1788
    • Paul Mackerras's avatar
      x86: atomic64: Code atomic(64)_read and atomic(64)_set in C not CPP · 8e049ef0
      Paul Mackerras authored
      
      Occasionally we get bugs where atomic_read or atomic_set are
      used on atomic64_t variables or vice versa.  These bugs don't
      generate warnings on x86 because atomic_read and atomic_set are
      coded as macros rather than C functions, so we don't get any
      type-checking on their arguments; similarly for atomic64_read
      and atomic64_set in 64-bit kernels.
      
      This converts them to C functions so that the arguments are
      type-checked and bugs like this will get caught more easily. It
      also converts atomic_cmpxchg and atomic_xchg, and
      atomic64_cmpxchg and atomic64_xchg on 64-bit, so we get
      type-checking on their arguments too.
      
      Compiling a typical 64-bit x86 config, this generates no new
      warnings, and the vmlinux text is 86 bytes smaller.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8e049ef0
    • Ingo Molnar's avatar
      x86: atomic64: Make atomic_read() type-safe · 32171208
      Ingo Molnar authored
      
      Linus noticed that atomic64_xchg() uses atomic_read(), which
      happens to work because atomic_read() is a macro so the
      .counter value gets u64-read on 32-bit too - but this is really
      bogus and serious bugs are waiting to happen.
      
      Change atomic_read() to be a type-safe inline, and this exposes
      the atomic64 bogosity as well:
      
        arch/x86/lib/atomic64_32.c: In function ‘atomic64_xchg’:
        arch/x86/lib/atomic64_32.c:39: warning: passing argument 1 of ‘atomic_read’ from incompatible pointer type
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      32171208
    • Ingo Molnar's avatar
      x86: atomic64: Move the 32-bit atomic64_t implementation to a .c file · b7882b7c
      Ingo Molnar authored
      
      Linus noted that the atomic64_t primitives are all inlines
      currently which is crazy because these functions have a large
      register footprint anyway.
      
      Move them to a separate file: arch/x86/lib/atomic64_32.c
      
      Also, while at it, rename all uses of 'unsigned long long' to
      the much shorter u64.
      
      This makes the appearance of the prototypes a lot nicer - and
      it also uncovered a few bugs where (yet unused) API variants
      had 'long' as their return type instead of u64.
      
      [ More intrusive changes are not yet done in this patch. ]
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b7882b7c
    • Eric Dumazet's avatar
      x86: atomic64: The atomic64_t data type should be 8 bytes aligned on 32-bit too · bbf2a330
      Eric Dumazet authored
      
      Locked instructions on two cache lines at once are painful. If
      atomic64_t uses two cache lines, my test program is 10x slower.
      
      The chance for that is significant: 4/32 or 12.5%.
      
      Make sure an atomic64_t is 8 bytes aligned.
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@localhost.localdomain>
      [ changed it to __aligned(8) as per Andrew's suggestion ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      bbf2a330
  3. 14 Jun, 2009 1 commit
    • Randy Dunlap's avatar
      x86: atomic_32.h: Fix kernel-doc warnings · 46e44328
      Randy Dunlap authored
      
      Fix kernel-doc warnings in atomic_32.h:
      
        Warning(arch/x86/include/asm/atomic_32.h:265): No description found for parameter 'ptr'
        Warning(arch/x86/include/asm/atomic_32.h:265): Excess function parameter 'v' description in '__atomic64_read'
        Warning(arch/x86/include/asm/atomic_32.h:305): Excess function parameter 'old_val' description in 'atomic64_xchg'
      Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
      LKML-Reference: <4A3467E6.6010907@oracle.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      46e44328
  4. 11 Jun, 2009 1 commit
  5. 07 Apr, 2009 1 commit
  6. 06 Jan, 2009 1 commit
  7. 14 Dec, 2008 1 commit
  8. 23 Oct, 2008 2 commits
  9. 22 Jul, 2008 1 commit
    • Vegard Nossum's avatar
      x86: consolidate header guards · 77ef50a5
      Vegard Nossum authored
      
      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: default avatarVegard Nossum <vegard.nossum@gmail.com>
      77ef50a5
  10. 17 Apr, 2008 1 commit
  11. 11 Oct, 2007 1 commit
  12. 24 May, 2007 1 commit
  13. 08 May, 2007 4 commits
  14. 11 Feb, 2007 1 commit
  15. 07 Dec, 2006 1 commit
    • Duncan Sands's avatar
      [PATCH] x86-64: fix asm constraints in i386 atomic_add_return · e4b522d7
      Duncan Sands authored
      
      Since v->counter is both read and written, it should be an output as well
      as an input for the asm.  The current code only gets away with this because
      counter is volatile.  Also, according to Documents/atomic_ops.txt,
      atomic_add_return should provide a memory barrier, in particular a compiler
      barrier, so the asm should be marked as clobbering memory.
      
      Test case:
      
      #include <stdio.h>
      
      typedef struct { int counter; } atomic_t; /* NB: no "volatile" */
      
      #define ATOMIC_INIT(i)	{ (i) }
      
      #define atomic_read(v)		((v)->counter)
      
      static __inline__ int atomic_add_return(int i, atomic_t *v)
      {
      	int __i = i;
      
      	__asm__ __volatile__(
      		"lock; xaddl %0, %1;"
      		:"=r"(i)
      		:"m"(v->counter), "0"(i));
      /*	__asm__ __volatile__(
      		"lock; xaddl %0, %1"
      		:"+r" (i), "+m" (v->counter)
      		: : "memory"); */
      	return i + __i;
      }
      
      int main (void) {
      	atomic_t a = ATOMIC_INIT(0);
      	int x;
      
      	x = atomic_add_return (1, &a);
      	if ((x!=1) || (atomic_read(&a)!=1))
      		printf("fail: %i, %i\n", x, atomic_read(&a));
      }
      Signed-off-by: default avatarDuncan Sands <baldrick@free.fr>
      Signed-off-by: default avatarAndi Kleen <ak@suse.de>
      Cc: Andi Kleen <ak@suse.de>
      Acked-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      e4b522d7
  16. 06 Dec, 2006 1 commit
  17. 08 Jul, 2006 1 commit
    • Linus Torvalds's avatar
      i386: improve and correct inline asm memory constraints · b862f3b0
      Linus Torvalds authored
      
      Use "+m" rather than a combination of "=m" and "m" for improved clarity
      and consistency.
      
      This also fixes some inlines that incorrectly didn't tell the compiler
      that they read the old value at all, potentially causing the compiler to
      generate bogus code.  It appear that all of those potential bugs were
      hidden by the use of extra "volatile" specifiers on the data structures
      in question, though.
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      b862f3b0
  18. 26 Apr, 2006 1 commit
  19. 19 Apr, 2006 1 commit
  20. 23 Mar, 2006 2 commits
    • Nick Piggin's avatar
      [PATCH] atomic: add_unless cmpxchg optimise · 0b2fcfdb
      Nick Piggin authored
      
      Without branch hints, the very unlikely chance of the loop repeating due to
      cmpxchg failure is unrolled with gcc-4 that I have tested.
      
      Improve this for architectures with a native cas/cmpxchg.  llsc archs
      should try to implement this natively.
      Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
      Cc: Andi Kleen <ak@muc.de>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      0b2fcfdb
    • Gerd Hoffmann's avatar
      [PATCH] x86: SMP alternatives · 9a0b5817
      Gerd Hoffmann authored
      
      Implement SMP alternatives, i.e.  switching at runtime between different
      code versions for UP and SMP.  The code can patch both SMP->UP and UP->SMP.
      The UP->SMP case is useful for CPU hotplug.
      
      With CONFIG_CPU_HOTPLUG enabled the code switches to UP at boot time and
      when the number of CPUs goes down to 1, and switches to SMP when the number
      of CPUs goes up to 2.
      
      Without CONFIG_CPU_HOTPLUG or on non-SMP-capable systems the code is
      patched once at boot time (if needed) and the tables are released
      afterwards.
      
      The changes in detail:
      
        * The current alternatives bits are moved to a separate file,
          the SMP alternatives code is added there.
      
        * The patch adds some new elf sections to the kernel:
          .smp_altinstructions
      	like .altinstructions, also contains a list
      	of alt_instr structs.
          .smp_altinstr_replacement
      	like .altinstr_replacement, but also has some space to
      	save original instruction before replaving it.
          .smp_locks
      	list of pointers to lock prefixes which can be nop'ed
      	out on UP.
          The first two are used to replace more complex instruction
          sequences such as spinlocks and semaphores.  It would be possible
          to deal with the lock prefixes with that as well, but by handling
          them as special case the table sizes become much smaller.
      
       * The sections are page-aligned and padded up to page size, so they
         can be free if they are not needed.
      
       * Splitted the code to release init pages to a separate function and
         use it to release the elf sections if they are unused.
      Signed-off-by: default avatarGerd Hoffmann <kraxel@suse.de>
      Signed-off-by: default avatarChuck Ebbert <76306.1226@compuserve.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      9a0b5817
  21. 19 Jan, 2006 2 commits
    • Alan Cox's avatar
      [PATCH] EDAC: core EDAC support code · da9bb1d2
      Alan Cox authored
      
      This is a subset of the bluesmoke project core code, stripped of the NMI work
      which isn't ready to merge and some of the "interesting" proc functionality
      that needs reworking or just has no place in kernel.  It requires no core
      kernel changes except the added scrub functions already posted.
      
      The goal is to merge further functionality only after the core code is
      accepted and proven in the base kernel, and only at the point the upstream
      extras are really ready to merge.
      
      From: doug thompson <norsk5@xmission.com>
      
        This converts EDAC to sysfs and is the final chunk neccessary before EDAC
        has a stable user space API and can be considered for submission into the
        base kernel.
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
      Signed-off-by: default avatarJesper Juhl <jesper.juhl@gmail.com>
      Signed-off-by: default avatardoug thompson <norsk5@xmission.com>
      Signed-off-by: default avatarPavel Machek <pavel@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      da9bb1d2
    • Alan Cox's avatar
      [PATCH] EDAC: atomic scrub operations · 715b49ef
      Alan Cox authored
      
      EDAC requires a way to scrub memory if an ECC error is found and the chipset
      does not do the work automatically.  That means rewriting memory locations
      atomically with respect to all CPUs _and_ bus masters.  That means we can't
      use atomic_add(foo, 0) as it gets optimised for non-SMP
      
      This adds a function to include/asm-foo/atomic.h for the platforms currently
      supported which implements a scrub of a mapped block.
      
      It also adjusts a few other files include order where atomic.h is included
      before types.h as this now causes an error as atomic_scrub uses u32.
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      715b49ef
  22. 09 Jan, 2006 1 commit
  23. 06 Jan, 2006 1 commit
    • Christoph Lameter's avatar
      [PATCH] atomic_long_t & include/asm-generic/atomic.h V2 · d3cb4871
      Christoph Lameter authored
      
      Several counters already have the need to use 64 atomic variables on 64 bit
      platforms (see mm_counter_t in sched.h).  We have to do ugly ifdefs to fall
      back to 32 bit atomic on 32 bit platforms.
      
      The VM statistics patch that I am working on will also make more extensive
      use of atomic64.
      
      This patch introduces a new type atomic_long_t by providing definitions in
      asm-generic/atomic.h that works similar to the c "long" type.  Its 32 bits
      on 32 bit platforms and 64 bits on 64 bit platforms.
      
      Also cleans up the determination of the mm_counter_t in sched.h.
      Signed-off-by: default avatarChristoph Lameter <clameter@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      d3cb4871
  24. 14 Nov, 2005 2 commits
  25. 16 Apr, 2005 1 commit
    • Linus Torvalds's avatar
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds authored
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4