Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: Manuel Lauss <manuel.lauss@gmail.com>,
	Linux-MIPS <linux-mips@linux-mips.org>
Subject: Re: [PATCH v2] MIPS: Alchemy: fix wait function
Date: Mon, 10 Jun 2013 19:45:16 +0100 (BST)	[thread overview]
Message-ID: <alpine.LFD.2.03.1306101940450.18329@linux-mips.org> (raw)
In-Reply-To: <20130610154944.GB5303@linux-mips.org>

On Mon, 10 Jun 2013, Ralf Baechle wrote:

> > Only an interrupt can wake the core from 'wait', enable interrupts
> > locally before executing 'wait'.
> > 
> > Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
> > ---
> > Ralf made me aware of the race in between enabling interrupts and
> > entering wait.  While this patch does not eliminate it, it shrinks it
> > to 1 instruction.  It's not perfect, but lets Alchemy boot until a
> > more sophisticated solution (like __r4k_wait) can be implemented
> > without having to duplicate the interrupt exception handler.
> 
> It doesn't shrink it - interrupts will be pending from the time they
> were disabled to the point where they get re-enabled.  That can be quite
> a few cycles and so the likelyhood for hitting the race is not that low.

 My understanding has been the race is that an interrupt can be taken 
between the MTC0 instruction used to enable interrupts and the WAIT 
instruction and the handler can disable interrupts back.  That's not going 
to be a problem if the interrupt is taken "a few cycles" later, because by 
then WAIT will have already been executed.

 Have I been missing something here?

  Maciej

      reply	other threads:[~2013-06-10 18:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 13:28 [PATCH v2] MIPS: Alchemy: fix wait function Manuel Lauss
2013-06-08 18:18 ` Maciej W. Rozycki
2013-06-08 20:15   ` Manuel Lauss
2013-06-10 15:49 ` Ralf Baechle
2013-06-10 18:45   ` Maciej W. Rozycki [this message]

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=alpine.LFD.2.03.1306101940450.18329@linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=linux-mips@linux-mips.org \
    --cc=manuel.lauss@gmail.com \
    --cc=ralf@linux-mips.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox