All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jun Sun <jsun@mvista.com>
To: Ralf Baechle <ralf@oss.sgi.com>
Cc: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
	Harald Koerfgen <Harald.Koerfgen@home.ivm.de>,
	linux-mips@oss.sgi.com
Subject: Re: Build failure for R3000 DECstation
Date: Tue, 14 Nov 2000 19:13:08 -0800	[thread overview]
Message-ID: <3A11FF44.D7B8D826@mvista.com> (raw)
In-Reply-To: 20001115024358.A3182@bacchus.dhis.org

Ralf Baechle wrote:
> 
> On Wed, Nov 15, 2000 at 01:58:21AM +0100, Maciej W. Rozycki wrote:
> 
> > > In any case, for uniprocessor non-ll/sc machines there is also a better
> > > solution availble with no syscalls at all.  It's easy to implement, just
> > > use the fact that any exception will change the values of k0/k1.  That of
> > > course breaks silently on SMP.
> >
> >  Can you guarantee it???  Well I can guarantee k0 and k1 won't change when
> > least expected. ;-)  AFAIK, the only fact guaranteed is that exception
> > handlers do not preserve the values of the scratch registers, but it does
> > not mean the last value written there is always different from what was
> > there upon a handler's entry...
> 
> Make that change k0 to a non-zero value.  So a R3000 UP spinlock can look
> like:
> 
>         move    k0, zero
>         li      t0, 1
> 0:      sw      t0, spin
>         bnez    k0, 0b
> 
>         [critical section]
> 
>         sw      zero, spin
> 
>   Ralf
> 
> (Who should write thousant times ``I shall not post with a phone in my hand'')

You should not post when you are sleepy. :-)

The above code does not work - the loop is infinite as nobody will set
k0 to 0 again if it is not zero for the first time.

In fact, I don't think you can perform automic operation ONLY based on
the knowledge whether a context switch has happened during a specified
period.  (It should be interesting to see if we can actually "prove"
it.)

I also doubt if k0 is absolutely non-zero after a context ...

Jun

  reply	other threads:[~2000-11-15  3:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-12 20:00 Build failure for R3000 DECstation Jan-Benedict Glaw
2000-11-13  9:47 ` Ralf Baechle
2000-11-14 21:30   ` Harald Koerfgen
2000-11-14 23:41     ` Ralf Baechle
2000-11-15  0:58       ` Maciej W. Rozycki
2000-11-15  1:43         ` Ralf Baechle
2000-11-15  3:13           ` Jun Sun [this message]
2000-11-15  3:16             ` Ralf Baechle
2000-11-15 11:21             ` Maciej W. Rozycki
2000-11-15 19:46             ` Harald Koerfgen
2000-11-15 20:17               ` Maciej W. Rozycki
2000-11-15 20:21                 ` Jun Sun
2000-11-16 13:23                   ` Maciej W. Rozycki
2000-11-15 20:17               ` Jun Sun
2000-11-15 20:31                 ` Maciej W. Rozycki
2000-11-15 11:18           ` Maciej W. Rozycki
2000-11-16  1:27             ` Ralf Baechle
2000-11-16 13:41               ` Maciej W. Rozycki
2000-11-15 19:46       ` Harald Koerfgen
2000-11-13 21:03 ` Harald Koerfgen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A11FF44.D7B8D826@mvista.com \
    --to=jsun@mvista.com \
    --cc=Harald.Koerfgen@home.ivm.de \
    --cc=linux-mips@oss.sgi.com \
    --cc=macro@ds2.pg.gda.pl \
    --cc=ralf@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.