alpha SMP doesn't build, due to lack of _raw_read_trylock().

Patch below completely untested...  needs review and testing.

One could also use the arch-neutral generic_raw_read_trylock(),
but that implementation is rather lame (it spins).  I'm amazed at the
number of arches that use the generic implementation, since the generic
version isn't really a "trylock".

Don't send this patch upstream until its been verified to actually work.

Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>


diff -ur ../kernel-2.6.11.orig/linux-2.6.11/include/asm-alpha/spinlock.h 
linux-2.6.11/include/asm-alpha/spinlock.h
--- ../kernel-2.6.11.orig/linux-2.6.11/include/asm-alpha/spinlock.h     
2005-03-02 02:38:12.000000000 -0500
+++ linux-2.6.11/include/asm-alpha/spinlock.h   2005-03-19 03:26:11.000000000 
-0500
@@ -153,6 +153,29 @@
 }
 #endif /* CONFIG_DEBUG_RWLOCK */
 
+static inline int _raw_read_trylock(rwlock_t * lock)
+{
+       long regx;
+       int success;
+
+       __asm__ __volatile__(
+       "1:     ldl_l   %1,%0\n"
+       "       lda     %2,0\n"
+       "       blbs    %1,6f\n"
+       "       subl    %1,2,%1\n"
+       "       stl_c   %1,%0\n"
+       "       beq     %1,6f\n"
+       "       lda     %2,1\n"
+       "4:     mb\n"
+       ".subsection 2\n"
+       "6:     br      1b\n"
+       ".previous"
+       : "=m" (*lock), "=&r" (regx), "=&r" (success)
+       : "m" (*lock) : "memory");
+
+       return success;
+}
+
 static inline int _raw_write_trylock(rwlock_t * lock)
 {
        long regx;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to