Re: [PATCH 25/60] microblaze_v4: process and init task function

From: Paul Mundt
Date: Sat Jun 28 2008 - 00:54:21 EST


On Thu, Jun 26, 2008 at 02:29:54PM +0200, monstr@xxxxxxxxx wrote:
> +void (*pm_power_off)(void) = NULL;
> +EXPORT_SYMBOL(pm_power_off);
> +
> +void cpu_idle(void)
> +{
> + set_thread_flag(TIF_POLLING_NRFLAG);
> +
> + while (1) {
> + while (!need_resched())
> + cpu_relax();
> +
> + preempt_enable_no_resched();
> + schedule();
> + preempt_disable();
> + }
> +}
> +
A couple things to note here. You have a pm_power_off, but no pm_idle.

You set TIF_POLLING_NRFLAG but don't have any explicit clearing and
resetting of it if the CPU is sleeping. In the cpu_relax() case this is
ok, but if you have a cpu_sleep() you will want to use in the SMP case,
you will need to handle it explicitly.

Beyond that, you may also want to stub in the
tick_nohz_stop_sched_tick()/tick_nohz_restart_sched_tick() calls, then
when you implement the generic clockevents you will already have the
tickless bits in place.

check_pgt_cache() is also helpful here for quicklist trimming, though you
may not care if you never plan to have an MMU.

You can look at arch/sh/kernel/process_32.c for examples.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/