mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Brown, Len" <len.brown@intel.com>
Cc: johnstul@us.ibm.com, linux-kernel@vger.kernel.org, pavel@suse.cz,
	linux-acpi@vger.kernel.org
Subject: Re: [BUG] sleeping function called from invalid context during resume
Date: Fri, 7 Jul 2006 12:40:25 -0700	[thread overview]
Message-ID: <20060707124025.b7e9b2e2.akpm@osdl.org> (raw)
In-Reply-To: <CFF307C98FEABE47A452B27C06B85BB6ECF5EB@hdsmsx411.amr.corp.intel.com>

On Fri, 7 Jul 2006 12:32:41 -0400
"Brown, Len" <len.brown@intel.com> wrote:

>  
> >
> >> I think we need to get rid of the acpi_in_resume hack
> >> and use system_state != SYSTEM_RUNNING to address this.
> >
> >Well if hacks are OK it'd actually be reliable to do
> >
> >	/* comment goes here */
> >	kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
> >
> >because the irqs_disabled() thing happens for well-defined reasons. 
> >Certainly that's better than looking at system_state (and I 
> >don't think we
> >leave SYSTEM_RUNNING during suspend/resume anyway).
> 
> If system_state != SYSTEM_RUNNING on resume, theen __might_sleep()
> would not have spit out the dump_stack() above.
> 
> This is exactly like boot -- we are bringing up the system
> and we need to configure interrupts, which runs AML,
> which calls kmalloc in a variety of ways, all of which call
> __might_sleep.
> 
> It seems simplest to have resume admit that it is like boot
> and that the early allocations with interrupts off simply
> must succeed or it is game-off.
> 

No, we shouldn't expand the use of system_state.  Code continues to be
merged which uses it.  If we also merge code which enhances its semantics
then we're getting into quadratically-increasing nastiness rather than
linearly-increasing.

Callers should tell callees what to do.  Callees shouldn't be peeking at
globals to work out what to do.

Lacking any other caller-passed indication, it would be much better for
acpi to look at irqs_disabled().  That's effectively a task-local,
cpu-local argument which was passed down to callees.  It's hacky - it's
like the PF_foo flags.  But it's heaps better than having all the kernel
fight over the state of a global.

  reply	other threads:[~2006-07-07 19:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07 16:32 Brown, Len
2006-07-07 19:40 ` Andrew Morton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-07-10  5:48 Brown, Len
2006-07-08  0:21 Brown, Len
2006-07-08  0:30 ` Pavel Machek
2006-07-07  3:10 Brown, Len
2006-07-07  3:51 ` Andrew Morton
2006-07-07  3:01 john stultz
2006-07-07  3:32 ` Parag Warudkar

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=20060707124025.b7e9b2e2.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=johnstul@us.ibm.com \
    --cc=len.brown@intel.com \
    --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

Powered by JetHome