lkml.org 
[lkml]   [2011]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch v2 15/35] Hexagon: Add init_task and process functions
Date
On Tuesday 30 August 2011, Richard Kuo wrote:
> Fixed potential race-to-sleep condition in cpu_idle(). I hope.
>
> If called with interrupts disabled, our __vmwait() actually just returns
> without servicing it. Let me know if there's any other condition that
> I've missed...

The race should be gone now, but

> +void cpu_idle(void)
> +{
> + while (1) {
> + tick_nohz_stop_sched_tick(1);
> + local_irq_disable();
> + while (!need_resched()) {
> + idle_sleep();
> + /* interrupts wake us up, but aren't serviced */
> + local_irq_enable(); /* service interrupt */
> + local_irq_disable();
> + }
> + tick_nohz_restart_sched_tick();
> + schedule();
> + }
> +}

you now call schedule() with interrupts disabled, which isn't strictly
allowed.

I think it should all be fine if you write it as

while (1) {
tick_nohz_stop_sched_tick(1);
local_irq_disable();
while (!need_resched()) {
idle_sleep();
}
local_irq_enable();
tick_nohz_restart_sched_tick();
schedule();
}


Arnd


\
 
 \ /
  Last update: 2011-08-31 15:47    [W:0.358 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site