linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Jonas Gorski <jogo@openwrt.org>,
	eunb.song@samsung.com,
	"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] MIPS: Enable interrupts in arch_cpu_idle()
Date: Thu, 2 May 2013 09:45:08 -0700	[thread overview]
Message-ID: <CA+55aFwDGyHOzu=Qh7SJOBK6QvAwAh7pMDL6LfMUE=AW_kapAw@mail.gmail.com> (raw)
In-Reply-To: <20130502145809.GA16236@linux-mips.org>

On Thu, May 2, 2013 at 7:58 AM, Ralf Baechle <ralf@linux-mips.org> wrote:
>
> For a while we just used to live with the race condition resulting from
> not disabling interrupts in the idle loop.  Then c65a5480 fixed this by
> checking if we're returning to the WAIT instruction in the idle loop
> when returning from an interrupt and iff so, rolling back the
> program counter to point to the if (test_thread_flag(TIF_NEED_RESCHED))
> test at the beginning of rollback_r4k_wait.

Umm. That sounds buggy. What if there was an interrupt *between* the
two places, not right at the wait instruction?

It seriously sounds like MIPS should do this by enabling interrupts in
the *assembly* code immediately preceding the wait instruction. IOW,
you'd effectively have the same kind of "sti; halt" kind of sequence
that x86 has. Not "enable interrupts" + C compiler puts random
instructions here + "wait".

                       Linus

  reply	other threads:[~2013-05-02 16:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01  4:57 mips; boot fail after merge 3.9+ EUNBONG SONG
2013-05-02  8:32 ` Jonas Gorski
2013-05-02 10:42   ` Thomas Gleixner
2013-05-02 11:20     ` Jonas Gorski
2013-05-02 14:33       ` [PATCH] MIPS: Enable interrupts in arch_cpu_idle() Thomas Gleixner
2013-05-02 14:58         ` Ralf Baechle
2013-05-02 16:45           ` Linus Torvalds [this message]
2013-05-02 20:48             ` [PATCH] MIPS: Enable interrupts before WAIT instruction David Daney
2013-05-02 21:04               ` Thomas Gleixner
2013-05-03  9:54                 ` Jonas Gorski
2013-05-06 14:26               ` Manuel Lauss
2013-05-22 22:32               ` Aaro Koskinen
2013-05-22 22:36                 ` David Daney

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='CA+55aFwDGyHOzu=Qh7SJOBK6QvAwAh7pMDL6LfMUE=AW_kapAw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=eunb.song@samsung.com \
    --cc=jogo@openwrt.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).