All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: linux-acpi@vger.kernel.org
Cc: Pavel Machek <pavel@suse.cz>, Len Brown <len.brown@intel.com>
Subject: [PATH] Avoid slab errors on suspend
Date: Wed, 8 Mar 2006 09:04:52 +0100	[thread overview]
Message-ID: <200603080904.53204.trenn@suse.de> (raw)

When going into suspend irqs must be disabled for a long time.

There is already a acpi_in_resume variable in osl.c
to not make use of sleeping functions (mem allocs/mutexes).
This one just makes a bit more intensive use of it.

The acpi_in_resume seem to vanish later (pci_link.c):
/*
 * FIXME: this is a workaround to avoid nasty warning.  It will be removed
 * after every device calls pci_disable_device in .resume.
 */
but for now below patch seem to be needed:

Subject: No GFP_KERNEL buffer alloc or mutexes if resuming

Signed-off-by: Thomas Renninger <trenn@suse.de>

 drivers/acpi/osl.c   |   10 +++++++---
 drivers/acpi/utils.c |    6 +++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

Index: linux-2.6.15/drivers/acpi/osl.c
===================================================================
--- linux-2.6.15.orig/drivers/acpi/osl.c
+++ linux-2.6.15/drivers/acpi/osl.c
@@ -880,7 +880,7 @@ acpi_status acpi_os_wait_semaphore(acpi_
 	ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
 			  handle, units, timeout));
 
-	if (in_atomic())
+	if (in_atomic() || acpi_in_resume)
 		timeout = 0;
 
 	switch (timeout) {
@@ -1009,7 +1009,7 @@ u8 acpi_os_writable(void *ptr, acpi_size
 
 u32 acpi_os_get_thread_id(void)
 {
-	if (!in_atomic())
+	if (!in_atomic() && !acpi_in_resume)
 		return current->pid;
 
 	return 0;
@@ -1252,7 +1252,11 @@ acpi_status acpi_os_release_object(acpi_
 
 void *acpi_os_acquire_object(acpi_cache_t * cache)
 {
-	void *object = kmem_cache_alloc(cache, GFP_KERNEL);
+	void *object;
+	if (acpi_in_resume)
+		object = kmem_cache_alloc(cache, GFP_ATOMIC);
+	else
+		object = kmem_cache_alloc(cache, GFP_KERNEL);
 	WARN_ON(!object);
 	return object;
 }
Index: linux-2.6.15/drivers/acpi/utils.c
===================================================================
--- linux-2.6.15.orig/drivers/acpi/utils.c
+++ linux-2.6.15/drivers/acpi/utils.c
@@ -250,6 +250,7 @@ acpi_extract_package(union acpi_object *
 
 EXPORT_SYMBOL(acpi_extract_package);
 
+extern int acpi_in_resume;
 acpi_status
 acpi_evaluate_integer(acpi_handle handle,
 		      acpi_string pathname,
@@ -264,7 +265,10 @@ acpi_evaluate_integer(acpi_handle handle
 	if (!data)
 		return_ACPI_STATUS(AE_BAD_PARAMETER);
 
-	element = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
+	if (acpi_in_resume)
+		element = kmalloc(sizeof(union acpi_object), GFP_ATOMIC);
+	else
+		element = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
 	if (!element)
 		return_ACPI_STATUS(AE_NO_MEMORY);
 

             reply	other threads:[~2006-03-08  8:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-08  8:04 Thomas Renninger [this message]
2006-03-08  8:51 ` [PATCH] Avoid slab errors on suspend Thomas Renninger
2006-03-08  9:05   ` Shaohua Li

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=200603080904.53204.trenn@suse.de \
    --to=trenn@suse.de \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.