public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Aubrey <aubreylee@gmail.com>
Cc: "Luke Yang" <luke.adi@gmail.com>,
	linux-kernel@vger.kernel.org, "Andrew Morton" <akpm@osdl.org>
Subject: Re: [PATCH 1/4] Blackfin: arch patch for 2.6.18
Date: Mon, 25 Sep 2006 11:26:17 +0200	[thread overview]
Message-ID: <200609251126.17494.arnd@arndb.de> (raw)
In-Reply-To: <6d6a94c50609250049l75b2f070q81583b90d8fcfaec@mail.gmail.com>

On Monday 25 September 2006 09:49, Aubrey wrote:
> Oh, sorry for my unclear description, any of the peripherals can be configured
> to wake up the core from its idled state to process the interrupt on
> Blackfin. I should say __if no other interrupts__ here is the timer
> interrupt waking up the processor every one jiffy.

And that works if interrupts are disabled as it should?

> I don't understand if interrupt occurs between need_resched() and the
> idle instruction, what will become the racy object? Can you comment it
> detailed? thanks.

It's the same problem as why sleep_on() is wrong and wait_event() is
right, you can find lots of documentation about that.

Think about a process calling nanosleep() to wait for a timeout.
It eventually ends up going to sleep and the kernel schedules
the idle task.

The idle task checks need_resched(), which returns false, so it
will call the idle instruction. Before it gets there, the timer
tick happens, which calls the timer softirq. That softirq notices
that the user process should continue running and calls wake_up(),
which makes the condition for need_resched() true.

Since we're handling that softirq that interrupted the idle task,
that task continues what it was last doing and calls the idle instruction.
This is the point where it goes wrong, because your user task should
run, but the CPU is sleeping until the next interrupt happens.

Note that you should in the future disable timer ticks during the
idle function (CONFIG_NO_IDLE_HZ or similar) to save more power, but
in that case the CPU may be in idle indefinitely after missing the
one interrupt that should have woken it up.

	Arnd <><

  reply	other threads:[~2006-09-25  9:26 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-21  3:32 [PATCH 1/4] Blackfin: arch patch for 2.6.18 Luke Yang
2006-09-21  9:59 ` Luke Yang
2006-09-23  0:18 ` Arnd Bergmann
2006-09-23  1:18   ` Randy.Dunlap
2006-09-23  1:24     ` Roland Dreier
2006-09-23  1:58       ` Mike Frysinger
2006-09-23  6:50   ` Mike Frysinger
2006-09-23 11:03     ` Arnd Bergmann
2006-09-23 11:15       ` Mike Frysinger
2006-09-23 11:29         ` Arnd Bergmann
2006-09-23 13:07         ` Arnd Bergmann
2006-09-23 11:28     ` Matthieu CASTET
2006-09-23 11:35       ` Mike Frysinger
2006-09-23 19:43     ` Arnd Bergmann
2006-09-24  3:49       ` Luke Yang
2006-09-24  3:35   ` Aubrey
2006-09-24  3:50     ` Randy Dunlap
2006-09-24  4:28       ` Aubrey
2006-09-25  6:54     ` Arnd Bergmann
2006-09-25  7:49       ` Aubrey
2006-09-25  9:26         ` Arnd Bergmann [this message]
2006-09-25  9:39           ` Luke Yang
2006-09-25  9:45           ` Aubrey
2006-09-25 15:39           ` Aubrey
2006-09-25 17:05             ` Arnd Bergmann
2006-09-26  3:42               ` Aubrey
2006-09-26  9:43                 ` Arnd Bergmann
2006-09-27 10:04               ` Aubrey
2006-09-27 11:37                 ` Arnd Bergmann
2006-09-23 21:27 ` David Woodhouse
2006-09-25 16:52 ` Randy Dunlap
2006-09-25 18:05   ` Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2006-09-23 16:29 Robin Getz
2006-09-23 18:10 ` Arnd Bergmann
2006-09-23 17:57 Robin Getz
2006-09-23 23:25 Robin Getz
2006-09-24  7:29 ` David Woodhouse
2006-09-25 23:21 Robin Getz
2006-09-27 16:25 Robin Getz
2006-09-27 16:36 ` Randy Dunlap
2006-09-27 16:41 ` Arnd Bergmann
2006-09-27 17:19 ` Robin Getz
2006-09-27 20:57   ` Arnd Bergmann
2006-09-28  9:31     ` Bernd Schmidt
2006-09-28 11:04       ` Arnd Bergmann
2006-09-28 11:39         ` Bernd Schmidt
2006-09-28 12:35           ` Arnd Bergmann
2006-09-27 17:47 Robin Getz
2006-09-27 19:19 ` Jörn Engel
2006-09-27 21:22 Robin Getz
2006-09-27 21:36 ` Arnd Bergmann
2006-09-27 22:56 Robin Getz
2006-09-27 23:01 Robin Getz

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=200609251126.17494.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@osdl.org \
    --cc=aubreylee@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke.adi@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox