[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201301181435.15491.arnd@arndb.de>
Date: Fri, 18 Jan 2013 14:35:15 +0000
From: Arnd Bergmann <arnd@...db.de>
To: Vineet Gupta <Vineet.Gupta1@...opsys.com>
Cc: linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
Al Viro <viro@...iv.linux.org.uk>,
Thomas Gleixner <tglx@...utronix.de>,
"Frederic Weisbecker" <fweisbec@...il.com>
Subject: Re: [PATCH v2 17/76] ARC: Process-creation/scheduling/idle-loop
On Friday 18 January 2013, Vineet Gupta wrote:
> +void cpu_idle(void)
> +{
> + /* Since we SLEEP in idle loop, TIF_POLLING_NRFLAG can't be set */
> +
> + /* endless idle loop with no priority at all */
> + while (1) {
> + tick_nohz_idle_enter();
> + rcu_idle_enter();
> +
> + while (!need_resched())
> + arch_idle();
> +
> + rcu_idle_exit();
> + tick_nohz_idle_exit();
> +
> + schedule_preempt_disabled();
> + }
> +}
Unless I'm mistaken, you have introduced the classic sleep race
here, where an interrupt can happen between the check for
need_resched() and the sleep instruction in arch_idle().
To avoid that, you need to disable interrupts around
the inner loop. The sleep instruction should return with
interrupts implicitly enabled if ARC behaves like most
other architectures doing this.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists