lkml.org 
[lkml]   [2013]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 17/76] ARC: Process-creation/scheduling/idle-loop
Date
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


\
 
 \ /
  Last update: 2013-01-18 16:21    [W:0.497 / U:0.960 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site