From: Thomas Gleixner <tglx@linutronix.de>
To: Andi Kleen <andi@firstfloor.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Dhaval Giani <dhaval@linux.vnet.ibm.com>,
Venkatesch Pallipadi <venkatesh.pallipadi@intel.com>,
Len Brown <lenb@kernel.org>
Subject: Re: [PATCH] ACPI/CPUIDLE: prevent setting pm_idle to NULL
Date: Mon, 28 Jul 2008 21:38:44 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.1.10.0807282107500.14925@apollo.tec.linutronix.de> (raw)
In-Reply-To: <20080728174644.GC30344@one.firstfloor.org>
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
next prev parent reply other threads:[~2008-07-28 19:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-27 21:47 Thomas Gleixner
2008-07-28 17:46 ` Andi Kleen
2008-07-28 19:38 ` Thomas Gleixner [this message]
2008-07-28 19:53 ` Andi Kleen
2008-07-28 21:51 ` Thomas Gleixner
2008-07-28 22:05 ` Pallipadi, Venkatesh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.1.10.0807282107500.14925@apollo.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=dhaval@linux.vnet.ibm.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.org \
--cc=venkatesh.pallipadi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®