Subject: sysmips syscall

From: [email-masked]
Date: Fri, 17 Nov 2000 19:28:50 -0600

Hi,

   The following lines appear in the linuxthreads/sysdeps/mips/pt-machine.h file in version
LinuxThreads 2.1.2:

TODO: This version makes use of MIPS ISA 2 features.  It won't
   work on ISA 1.  These machines will have to take the overhead of
   a sysmips(MIPS_ATOMIC_SET, ...) syscall which isn't implemented
   yet correctly.  There is however a better solution for R3000
   uniprocessor machines possible.

My questions are:
1.  Is the sysmips syscall implemented correctly yet?
2.  What is the better solution for R3000 uniprocessor machines?
3.  Does anyone have a patch for LinuxThreads that supports MIPS ISA 1?

   Thanks and regards,

   Rajesh

---

From: Ralf Baechle <[email-masked]>
Date: Sat, 18 Nov 2000 11:59:09 +0100

> 1.  Is the sysmips syscall implemented correctly yet?

Yes.

> 2.  What is the better solution for R3000 uniprocessor machines?

You can base a spinlock implementation on the fact that the register k0
will be left at a value != zero after any exception, also including context
switches.

Problem: this solution breaks silently on multiproessor systems.

> 3.  Does anyone have a patch for LinuxThreads that supports MIPS ISA 1?

glibc 2.2's pthread will do that out of the box.

  Ralf

---

From: Keith Owens <[email-masked]>
Date: Sun, 19 Nov 2000 00:46:19 +1100

On Sat, 18 Nov 2000 11:59:09 +0100, 
>Problem: this solution breaks silently on multiproessor systems.

Use Dekker's algorithm between systems.  It requires cache coherent
memory but does not need any inter cpu locking mechanisms.

http://www.cs.wvu.edu/~jdm/classes/cs356/notes/mutex/Dekker.html
describes the algorithm for the two cpu case.  It assumes no preemption
on each cpu so it has to be modified to handle interrupts.  Add a local
lock so you are the only code on this processor trying to use Dekker
between processors.

---

From: Ralf Baechle <[email-masked]>
Date: Sat, 18 Nov 2000 15:13:28 +0100

> lock so you are the only code on this processor trying to use Dekker

We're talking about a algorithem to implement atomic operations only in
userspace.  There is Dekker and few improved variants of it.  They all
got in common that they're performing badly for an increasing number of
threads even for the no-contention case.  And non-constant memory
requirements which would require further changes to glibc.  So I consider
this whole family of algorithems to be a entirely theoretical construct.
Which is why we're thinking about those crude hacks.

  Ralf

---

From: Alan Cox <[email-masked]>
Date: Sat, 18 Nov 2000 17:26:54 +0000 (GMT)

> memory but does not need any inter cpu locking mechanisms.

Cache coherent and write ordered