* [PATCH 2.6] missing _raw_write_trylock
@ 2004-03-16 15:09 Jun Sun
2004-03-16 15:11 ` Steven J. Hill
0 siblings, 1 reply; 5+ messages in thread
From: Jun Sun @ 2004-03-16 15:09 UTC (permalink / raw)
To: linux-mips; +Cc: jsun
[-- Attachment #1: Type: text/plain, Size: 102 bytes --]
Please help me reviewing the code, because inline assembly bug is
always tricky and miserable.
Jun
[-- Attachment #2: junk --]
[-- Type: text/plain, Size: 752 bytes --]
diff -Nru linux/include/asm-mips/spinlock.h.orig linux/include/asm-mips/spinlock.h
--- linux/include/asm-mips/spinlock.h.orig 2004-01-05 10:48:38.000000000 -0800
+++ linux/include/asm-mips/spinlock.h 2004-03-15 18:50:30.000000000 -0800
@@ -167,4 +167,28 @@
: "memory");
}
+static inline int _raw_write_trylock(rwlock_t *rw)
+{
+ unsigned int tmp;
+ int ret;
+
+ __asm__ __volatile__(
+ ".set\tnoreorder\t\t\t# _raw_write_trylock\n"
+ "li\t%2, 0\n\t"
+ "1:\tll\t%1, %3\n\t"
+ "bnez\t%1, 2f\n\t"
+ "lui\t%1, 0x8000\n\t"
+ "sc\t%1, %0\n\t"
+ "beqz\t%1, 1b\n\t"
+ "sync\n\t"
+ "li\t%2, 1\n\t"
+ ".set\treorder\n"
+ "2:"
+ : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
+ : "m" (rw->lock)
+ : "memory");
+
+ return ret;
+}
+
#endif /* _ASM_SPINLOCK_H */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.6] missing _raw_write_trylock
2004-03-16 15:09 [PATCH 2.6] missing _raw_write_trylock Jun Sun
@ 2004-03-16 15:11 ` Steven J. Hill
2004-03-16 17:50 ` Jun Sun
0 siblings, 1 reply; 5+ messages in thread
From: Steven J. Hill @ 2004-03-16 15:11 UTC (permalink / raw)
To: Jun Sun; +Cc: linux-mips
Jun Sun wrote:
> Please help me reviewing the code, because inline assembly bug is
> always tricky and miserable.
>
Are you going to do a non-LLSC, or are we no longer concerned about
those?
-Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.6] missing _raw_write_trylock
2004-03-16 15:11 ` Steven J. Hill
@ 2004-03-16 17:50 ` Jun Sun
2004-03-16 19:08 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Jun Sun @ 2004-03-16 17:50 UTC (permalink / raw)
To: Steven J. Hill; +Cc: linux-mips, jsun
On Tue, Mar 16, 2004 at 10:11:18AM -0500, Steven J. Hill wrote:
> Jun Sun wrote:
> >Please help me reviewing the code, because inline assembly bug is
> >always tricky and miserable.
> >
> Are you going to do a non-LLSC, or are we no longer concerned about
> those?
>
For SMP machines we assume LLSC are present. This function and its friends
for SMP only.
Jun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.6] missing _raw_write_trylock
2004-03-16 17:50 ` Jun Sun
@ 2004-03-16 19:08 ` Christoph Hellwig
2004-03-16 19:14 ` Christopher G. Stach II
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2004-03-16 19:08 UTC (permalink / raw)
To: Jun Sun; +Cc: Steven J. Hill, linux-mips
On Tue, Mar 16, 2004 at 09:50:00AM -0800, Jun Sun wrote:
> > Are you going to do a non-LLSC, or are we no longer concerned about
> > those?
> >
>
> For SMP machines we assume LLSC are present. This function and its friends
> for SMP only.
doesn't CONFIG_PREEMPT (*shudder*) need it is aswell?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.6] missing _raw_write_trylock
2004-03-16 19:08 ` Christoph Hellwig
@ 2004-03-16 19:14 ` Christopher G. Stach II
0 siblings, 0 replies; 5+ messages in thread
From: Christopher G. Stach II @ 2004-03-16 19:14 UTC (permalink / raw)
To: linux-mips
CONFIG_SMP and CONFIG_PREEMPT at the same time, as it's in
kernel/sched.c.
chris
On Tue, 2004-03-16 at 13:08, Christoph Hellwig wrote:
> On Tue, Mar 16, 2004 at 09:50:00AM -0800, Jun Sun wrote:
> > > Are you going to do a non-LLSC, or are we no longer concerned about
> > > those?
> > >
> >
> > For SMP machines we assume LLSC are present. This function and its friends
> > for SMP only.
>
> doesn't CONFIG_PREEMPT (*shudder*) need it is aswell?
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-03-16 19:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-16 15:09 [PATCH 2.6] missing _raw_write_trylock Jun Sun
2004-03-16 15:11 ` Steven J. Hill
2004-03-16 17:50 ` Jun Sun
2004-03-16 19:08 ` Christoph Hellwig
2004-03-16 19:14 ` Christopher G. Stach II
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.