[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0807282107500.14925@apollo.tec.linutronix.de>
Date: Mon, 28 Jul 2008 21:38:44 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Andi Kleen <andi@...stfloor.org>
cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
Dhaval Giani <dhaval@...ux.vnet.ibm.com>,
Venkatesch Pallipadi <venkatesh.pallipadi@...el.com>,
Len Brown <lenb@...nel.org>
Subject: Re: [PATCH] ACPI/CPUIDLE: prevent setting pm_idle to NULL
On Mon, 28 Jul 2008, Andi Kleen wrote:
> > + /*
> > + * Fall back to the default idle loop, when pm_idle_save had
> > + * been initialized.
> > + */
> > + if (pm_idle_save) {
> > + pm_idle = pm_idle_save;
> > + /* Relies on interrupts forcing exit from idle. */
> > + synchronize_sched();
> > + }
>
> I think it would be better to fall back to default_idle (which
> might need to be exported) when the old pointer is NULL.
No, falling back to default_idle is wrong as hell. When pm_idle was
set to mwait_idle or whatever then you override pm_idle to
default_idle for no good reason.
The problem here is that the acpi/cpuidle code can be in a state where
the _save/old variables _ARE_ NULL because they had not been
initialized with the original pm_idle before the module is removed or
the cst state changes. So all we have to do is to prevent pm_idle to
be set to NULL.
> Now with your patch
> the cpuidle idle code would run with inconsistent state for some time,
> which is probably not good.
Err, this happens when the original pm_idle pointer _is_ restored. But
if the _save/old pointer is NULL we crash the system and that's what
my patch prevents.
So nothing runs with an inconsistent state. If pm_idle_save contains
the original pm_idle value we restore, if it is NULL we do not touch
pm_idle and keep the original value.
Thanks,
tglx
--
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