* [PATCH] _raw_read_trylock for alpha
@ 2005-03-19 20:39 Jeff Garzik
2005-03-20 2:40 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Garzik @ 2005-03-19 20:39 UTC (permalink / raw)
To: rth, akpm, linux-kernel
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 <jgarzik@pobox.com>
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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] _raw_read_trylock for alpha
2005-03-19 20:39 [PATCH] _raw_read_trylock for alpha Jeff Garzik
@ 2005-03-20 2:40 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2005-03-20 2:40 UTC (permalink / raw)
To: jgarzik; +Cc: akpm, linux-kernel
On Sat, Mar 19, 2005 at 03:39:33PM -0500, Jeff Garzik wrote:
> Don't send this patch upstream until its been verified to actually work.
It certainly won't. I'll gen up something soon.
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-03-20 2:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-19 20:39 [PATCH] _raw_read_trylock for alpha Jeff Garzik
2005-03-20 2:40 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox