Re: [PATCH] amd76x_pm port to 2.5.70

From: Zwane Mwaikambo (zwane@linuxpower.ca)
Date: Sat May 31 2003 - 13:43:09 EST


On Sat, 31 May 2003, Pasi Savolainen wrote:

> Attached is a simplistic port of amd76x_pm to 2.5.70.
> There is a mention about being non-preempt safe, and I can't tell
> spinlock from semaphore, so can do nada about it.
> zwane told me on #kernelnewbies that
>
> pm_idle = old_pm_idle; wmb();
>
> should take care about the processor syncing, but I do get total hangs
> on rmmod.

pm_idle = NULL_or_previous_handler;
synchronize_kernel();
unload_module;

> +amd76x_up_idle(void)
> +{
> + // FIXME: Optionally add non-smp idle loop here
> +}
> +#endif

This is going to really suck power wise, at least do a rep_nop or some
such otherwise you spin in a tight polling loop around need_resched.

> +static void
> +amd76x_smp_idle(void)
> +{
> + /*
> + * Exit idle mode immediately if the CPU does not change.
> + * Usually that means that we have some load on another CPU.
> + */
> +
> + if (prs[0].idle && prs[1].idle && amd76x_pm_cfg.last_pr == smp_processor_id()) {
> + prs[0].idle = 0;
> + prs[1].idle = 0;
> + /* This looks redundent as it was just checked in the if() */
> + /* amd76x_pm_cfg.last_pr = smp_processor_id(); */

One is a comparison the other an assignment, what's going on here?

> +static void __exit
> +amd76x_pm_cleanup(void)
> +{
> +#ifndef AMD76X_NTH
> + pm_idle = amd76x_pm_cfg.orig_idle;
> + wmb();
> + //__asm__ __volatile__ ("wbinvd;"); // propagate through SMP

synchronize_kernel() here, then you should be safe to unload.

--
function.linuxpower.ca
-
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/