public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <len.brown@intel.com>
To: akpm@osdl.org
Cc: linux-acpi@vger.kernel.org, jikos@jikos.cz
Subject: Re: [patch 11/14] ACPI: change GFP_ATOMIC to GFP_KERNEL for non-atomic  allocation
Date: Wed, 16 Aug 2006 19:02:01 -0400	[thread overview]
Message-ID: <200608161902.02221.len.brown@intel.com> (raw)
In-Reply-To: <200608150537.k7F5bTu8011560@shell0.pdx.osdl.net>

On Tuesday 15 August 2006 01:37, akpm@osdl.org wrote:
> From: Jiri Kosina <jikos@jikos.cz>
> 
> acpi_pci_link_set() allocates with GFP_ATOMIC. On resume from suspend,
> this is called with interrupts off, otherwise GFP_KERNEL is safe.

So you are suggesting this?

diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 7f3e7e7..d53bd98 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -307,7 +307,7 @@ static int acpi_pci_link_set(struct acpi
 	if (!link || !irq)
 		return -EINVAL;
 
-	resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC);
+	resource = kmalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
 	if (!resource)
 		return -ENOMEM;
 


> On the other hand, when resuming from suspend with interrupts off, the
> following callchain allocates with GFP_KERNEL, which is wrong:
>
> acpi_pci_link_resume -> acpi_pci_link_set -> acpi_set_current_resources ->
> acpi_rs_set_srs_method_data -> acpi_ut_create_internal_object_dbg ->
> acpi_ut_allocate_object_desc_dbg -> acpi_os_acquire_object ->
> kmem_cache_alloc(GFP_KERNEL) flag.

I don't understand this comment.
acpi_os_acquire_object is implemented in aclinux.h:

static inline void *acpi_os_acquire_object(acpi_cache_t * cache) {
        return kmem_cache_zalloc(cache, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
}

-Len

> Signed-off-by: Jiri Kosina <jikos@jikos.cz>
> Cc: "Brown, Len" <len.brown@intel.com>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> ---
> 
>  drivers/acpi/pci_link.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff -puN drivers/acpi/pci_link.c~acpi-change-gfp_atomic-to-gfp_kernel-for-non-atomic drivers/acpi/pci_link.c
> --- a/drivers/acpi/pci_link.c~acpi-change-gfp_atomic-to-gfp_kernel-for-non-atomic
> +++ a/drivers/acpi/pci_link.c
> @@ -307,7 +307,12 @@ static int acpi_pci_link_set(struct acpi
>  	if (!link || !irq)
>  		return -EINVAL;
>  
> -	resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC);
> +	/* irqs could be disabled when resuming from suspend */
> +	if (irqs_disabled())
> +		resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC);
> +	else
> +		resource = kmalloc(sizeof(*resource) + 1, GFP_KERNEL);
> +
>  	if (!resource)
>  		return -ENOMEM;
>  
> _
> -
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2006-08-16 23:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-15  5:37 [patch 11/14] ACPI: change GFP_ATOMIC to GFP_KERNEL for non-atomic allocation akpm
2006-08-16 23:02 ` Len Brown [this message]
2006-08-17  9:15   ` Jiri Kosina
2006-08-24  6:43     ` Len Brown
2006-08-25  9:00       ` Jiri Kosina
2006-08-25 14:27         ` Jiri Kosina
  -- strict thread matches above, loose matches on Subject: below --
2006-08-25 14:48 Pallipadi, Venkatesh
2006-08-26  1:39 Pallipadi, Venkatesh
2006-08-26 15:39 ` Jiri Kosina
2006-08-29  2:01 Pallipadi, Venkatesh
2006-08-30 10:28 ` Jiri Kosina
2006-08-30 18:01   ` Venkatesh Pallipadi
2006-08-30 22:28     ` Jiri Kosina

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=200608161902.02221.len.brown@intel.com \
    --to=len.brown@intel.com \
    --cc=akpm@osdl.org \
    --cc=jikos@jikos.cz \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    /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