Thursday, January 7, 2010

linux.kernel - 25 new messages in 8 topics - digest

linux.kernel
http://groups.google.com/group/linux.kernel?hl=en

linux.kernel@googlegroups.com

Today's topics:

* x86: Merge atomic headers - 3 messages, 1 author
http://groups.google.com/group/linux.kernel/t/0d9ef05d2287056a?hl=en
* mmotm 2010-01-06-14-34 uploaded (kernel/cgroup) - 3 messages, 2 authors
http://groups.google.com/group/linux.kernel/t/e64c577b9ad4e453?hl=en
* introduce sys_membarrier(): process-wide memory barrier - 9 messages, 4
authors
http://groups.google.com/group/linux.kernel/t/c8972d397ccbdcff?hl=en
* cfq-iosched: non-rot devices do not need read queue merging - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/f5cfad2a8e2aea5f?hl=en
* Add add_local() and add_local_return() - 5 messages, 1 author
http://groups.google.com/group/linux.kernel/t/5f2d14484e0e3b5a?hl=en
* Add BUILD_BUG_ON_NOT_POWER_OF_2() - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/a1d308e1f7ceb692?hl=en
* 2.6.33-rc3 regression: leds_alix2: can't allocate I/O for GPIO - 1 messages,
1 author
http://groups.google.com/group/linux.kernel/t/350e15d12734a9b8?hl=en
* [PATCH 6/8] mm: handle_speculative_fault() - 2 messages, 2 authors
http://groups.google.com/group/linux.kernel/t/2a5e8285ffb8a998?hl=en

==============================================================================
TOPIC: x86: Merge atomic headers
http://groups.google.com/group/linux.kernel/t/0d9ef05d2287056a?hl=en
==============================================================================

== 1 of 3 ==
Date: Thurs, Jan 7 2010 9:00 am
From: Brian Gerst


This patchset merges the implementations of the atomic_t functions which
are common between 32-bit and 64-bit mode. It splits out the atomic64_t
functions into new headers since those are still different.

[PATCH 1/3] x86: Split atomic64_t functions into seperate headers
[PATCH 2/3] x86: Sync atomic_xx.h
[PATCH 3/3] x86: Merge atomic.h

arch/x86/include/asm/atomic.h | 299 ++++++++++++++++++++++-
arch/x86/include/asm/atomic64_32.h | 160 ++++++++++++
arch/x86/include/asm/atomic64_64.h | 224 +++++++++++++++++
arch/x86/include/asm/atomic_32.h | 415 ------------------------------
arch/x86/include/asm/atomic_64.h | 485 ------------------------------------
5 files changed, 681 insertions(+), 902 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 2 of 3 ==
Date: Thurs, Jan 7 2010 9:00 am
From: Brian Gerst


Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/include/asm/atomic.h | 299 +++++++++++++++++++++++++++++++++++++-
arch/x86/include/asm/atomic_32.h | 295 -------------------------------------
arch/x86/include/asm/atomic_64.h | 295 -------------------------------------
3 files changed, 297 insertions(+), 592 deletions(-)
delete mode 100644 arch/x86/include/asm/atomic_32.h
delete mode 100644 arch/x86/include/asm/atomic_64.h

diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index 4e1b887..8baaa71 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -1,5 +1,300 @@
+#ifndef _ASM_X86_ATOMIC_H
+#define _ASM_X86_ATOMIC_H
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+#include <asm/processor.h>
+#include <asm/alternative.h>
+#include <asm/cmpxchg.h>
+
+/*
+ * Atomic operations that C can't guarantee us. Useful for
+ * resource counting etc..
+ */
+
+#define ATOMIC_INIT(i) { (i) }
+
+/**
+ * atomic_read - read atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically reads the value of @v.
+ */
+static inline int atomic_read(const atomic_t *v)
+{
+ return v->counter;
+}
+
+/**
+ * atomic_set - set atomic variable
+ * @v: pointer of type atomic_t
+ * @i: required value
+ *
+ * Atomically sets the value of @v to @i.
+ */
+static inline void atomic_set(atomic_t *v, int i)
+{
+ v->counter = i;
+}
+
+/**
+ * atomic_add - add integer to atomic variable
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v.
+ */
+static inline void atomic_add(int i, atomic_t *v)
+{
+ asm volatile(LOCK_PREFIX "addl %1,%0"
+ : "+m" (v->counter)
+ : "ir" (i));
+}
+
+/**
+ * atomic_sub - subtract integer from atomic variable
+ * @i: integer value to subtract
+ * @v: pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v.
+ */
+static inline void atomic_sub(int i, atomic_t *v)
+{
+ asm volatile(LOCK_PREFIX "subl %1,%0"
+ : "+m" (v->counter)
+ : "ir" (i));
+}
+
+/**
+ * atomic_sub_and_test - subtract value from variable and test result
+ * @i: integer value to subtract
+ * @v: pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v and returns
+ * true if the result is zero, or false for all
+ * other cases.
+ */
+static inline int atomic_sub_and_test(int i, atomic_t *v)
+{
+ unsigned char c;
+
+ asm volatile(LOCK_PREFIX "subl %2,%0; sete %1"
+ : "+m" (v->counter), "=qm" (c)
+ : "ir" (i) : "memory");
+ return c;
+}
+
+/**
+ * atomic_inc - increment atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1.
+ */
+static inline void atomic_inc(atomic_t *v)
+{
+ asm volatile(LOCK_PREFIX "incl %0"
+ : "+m" (v->counter));
+}
+
+/**
+ * atomic_dec - decrement atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1.
+ */
+static inline void atomic_dec(atomic_t *v)
+{
+ asm volatile(LOCK_PREFIX "decl %0"
+ : "+m" (v->counter));
+}
+
+/**
+ * atomic_dec_and_test - decrement and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1 and
+ * returns true if the result is 0, or false for all other
+ * cases.
+ */
+static inline int atomic_dec_and_test(atomic_t *v)
+{
+ unsigned char c;
+
+ asm volatile(LOCK_PREFIX "decl %0; sete %1"
+ : "+m" (v->counter), "=qm" (c)
+ : : "memory");
+ return c != 0;
+}
+
+/**
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+static inline int atomic_inc_and_test(atomic_t *v)
+{
+ unsigned char c;
+
+ asm volatile(LOCK_PREFIX "incl %0; sete %1"
+ : "+m" (v->counter), "=qm" (c)
+ : : "memory");
+ return c != 0;
+}
+
+/**
+ * atomic_add_negative - add and test if negative
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v and returns true
+ * if the result is negative, or false when
+ * result is greater than or equal to zero.
+ */
+static inline int atomic_add_negative(int i, atomic_t *v)
+{
+ unsigned char c;
+
+ asm volatile(LOCK_PREFIX "addl %2,%0; sets %1"
+ : "+m" (v->counter), "=qm" (c)
+ : "ir" (i) : "memory");
+ return c;
+}
+
+/**
+ * atomic_add_return - add integer and return
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v and returns @i + @v
+ */
+static inline int atomic_add_return(int i, atomic_t *v)
+{
+ int __i;
+#ifdef CONFIG_M386
+ unsigned long flags;
+ if (unlikely(boot_cpu_data.x86 <= 3))
+ goto no_xadd;
+

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate