[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1903508.hihLuMSVUz@wuerfel>
Date: Wed, 17 Aug 2011 21:45:10 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Richard Kuo <rkuo@...eaurora.org>
Cc: linux-kernel@...r.kernel.org, linux-hexagon@...r.kernel.org
Subject: Re: [patch 15/36] Hexagon: Add init_task and process functions
On Wednesday 17 August 2011 11:35:12 Richard Kuo wrote:
> +/*
> + * Spin, or better still, do a hardware or VM wait instruction
> + * If hardware or VM offer wait termination even though interrupts
> + * are disabled.
> + */
> +static void default_idle(void)
> +{
> + __vmwait();
> +}
> +
> +void (*idle_sleep)(void) = default_idle;
> +
> +void cpu_idle(void)
> +{
> + while (1) {
> + tick_nohz_stop_sched_tick(1);
> + while (!need_resched())
> + idle_sleep();
> + tick_nohz_restart_sched_tick();
> + schedule();
> + }
> +}
This looks like you have the classic going to sleep race in here:
You need to disable hardware interrupts before checking need_resched(),
otherwise an interrupt might hit just after you have checked it and
before you call __vmwait(). The definition of the __vmwait call
must atomically reenable interrupts and suspend the CPU.
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