[lkml]   [2008]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [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.



 \ /
  Last update: 2008-07-28 21:45    [W:0.094 / U:8.448 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site