From: Andrew Morton <akpm@linux-foundation.org>
To: Len Brown <lenb@kernel.org>
Cc: pavel@suse.cz, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: acpi_evaluate_integer broken by design
Date: Wed, 26 Nov 2008 15:02:24 -0800 [thread overview]
Message-ID: <20081126150224.947c18d4.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.LFD.2.00.0811261729550.3895@localhost.localdomain>
On Wed, 26 Nov 2008 17:37:29 -0500 (EST)
Len Brown <lenb@kernel.org> wrote:
>
>
> > > Now I know why I had strange "scheduling in atomic" problems:
> > > acpi_evaluate_integer() does malloc(..., irqs_disabled() ? GFP_ATOMIC
> > > : GFP_KERNEL)... which is (of course) broken.
> >
> > That is kinda weird. When did this all start happening?
>
> > > There's no way to reliably tell if we need GFP_ATOMIC or not from
> > > code, this one for example fails to detect spinlocks held.
>
> > Len, this looks like 2.6.28 material. But given the poor quality of
> > the changelog it is hard to be sure about this. Why isn't everyone
> > seeing these warnings? What did Pavel do to provoke these alleged
> > warnings? Nobody knows...
>
> I don't know know why pavel sees this and nobody else --
> maybe something unusual he's doing with suspend?
>
> The reason that the ACPI code is littered with bogus
> irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL)
> is because, like boot, resume starts life with interrupts off.
yes, suspend's disabling of interrupts causes problems all over the place.
If we really do need to inspect global state to handle this, it would
be much better to create a new
bool resume_is_running_so_you_cant_sleep;
and to test that. Something which is clear, highly specific and which
cannot be accidentally triggered via other means.
> I would prefer that resume and boot handle this the same way,
> with system_state. However, a few years ago when I suggested
> using system_state for resume, Andrew thought that was a very
> bad idea. Andrew, do you still feel that way?
yep. We've had problems in the past with system_state, where people add
new states, and old code breaks. Plus as we add more dependencies on
system_state, that reduces our ability to add new states and makes it
harder to alter (ie: fix) system_state transitions, etc. Just run
away!
As I said above, if we have a piece of code which wants to know when a
separate piece of code is in a particualr state, it is better to add a
new state flag just for that application, rather than trying to infer
things from the heavily overloaded system_state.
Obviously, it is even better to do neither. It is a basic and
oft-reoccurring design mistake for a low-level piece of code to
hardwire its GFP_foo decision. The gfp_t should be passed in from the
callers, all the way down the chain from the top-level code which
actually knows what state this thread of control is in.
> -Len
>
> ps. I'll put this particular fix in my tree now.
bewdy. It's a good change.
next prev parent reply other threads:[~2008-11-26 23:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-25 11:05 acpi_evaluate_integer broken by design Pavel Machek
2008-11-25 18:41 ` Moore, Robert
2008-11-26 21:20 ` Andrew Morton
2008-11-26 22:37 ` Len Brown
2008-11-26 23:02 ` Andrew Morton [this message]
2008-11-27 13:58 ` Pavel Machek
2008-12-16 5:24 ` acpi_os_allocate(GFP_KERNEL) (was Re: acpi_evaluate_integer broken by design) Len Brown
2008-12-16 5:41 ` Andrew Morton
2008-12-16 15:34 ` Rafael J. Wysocki
2008-12-16 23:40 ` Rafael J. Wysocki
2008-12-16 23:49 ` Rafael J. Wysocki
2008-12-18 6:07 ` Len Brown
2008-12-18 16:48 ` Pavel Machek
2008-12-18 6:08 ` irqs_disabled() vs ACPI interpreter vs suspend Len Brown
2008-12-18 16:32 ` Rafael J. Wysocki
2008-12-18 16:52 ` Pavel Machek
2008-12-18 21:20 ` Rafael J. Wysocki
2008-12-18 16:55 ` Pavel Machek
2008-11-27 13:56 ` acpi_evaluate_integer broken by design Pavel Machek
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=20081126150224.947c18d4.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@suse.cz \
/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