From: Yasunori Goto <y-goto@jp.fujitsu.com>
To: Badari Pulavarty <pbadari@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
linuxppc-dev@ozlabs.org, paulus@samba.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/5] generic __remove_pages() support
Date: Sat, 22 Mar 2008 00:25:48 +0900 [thread overview]
Message-ID: <20080321235322.2B17.E1E9C6FF@jp.fujitsu.com> (raw)
In-Reply-To: <1204829734.7939.61.camel@dyn9047017100.beaverton.ibm.com>
Badari-san.
> Index: linux-2.6.25-rc2/mm/memory_hotplug.c
> ===================================================================
> --- linux-2.6.25-rc2.orig/mm/memory_hotplug.c 2008-02-27 12:58:17.000000000 -0800
> +++ linux-2.6.25-rc2/mm/memory_hotplug.c 2008-02-27 16:06:50.000000000 -0800
> @@ -102,6 +102,21 @@ static int __add_section(struct zone *zo
> return register_new_memory(__pfn_to_section(phys_start_pfn));
> }
>
> +static int __remove_section(struct zone *zone, struct mem_section *ms)
> +{
> + int ret = -EINVAL;
> +
> + if (!valid_section(ms))
> + return ret;
> +
> + ret = unregister_memory_section(ms);
> + if (ret)
> + return ret;
> +
> + sparse_remove_one_section(zone, ms);
> + return 0;
> +}
> +
> /*
> * Reasonably generic function for adding memory. It is
> * expected that archs that support memory hotplug will
> @@ -135,6 +150,35 @@ int __add_pages(struct zone *zone, unsig
> }
> EXPORT_SYMBOL_GPL(__add_pages);
>
> +int __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
> + unsigned long nr_pages)
> +{
> + unsigned long i, ret = 0;
> + int sections_to_remove;
> + unsigned long flags;
> + struct pglist_data *pgdat = zone->zone_pgdat;
> +
> + /*
> + * We can only remove entire sections
> + */
> + BUG_ON(phys_start_pfn & ~PAGE_SECTION_MASK);
> + BUG_ON(nr_pages % PAGES_PER_SECTION);
> +
> + release_mem_region(phys_start_pfn << PAGE_SHIFT, nr_pages * PAGE_SIZE);
> +
> + sections_to_remove = nr_pages / PAGES_PER_SECTION;
> + for (i = 0; i < sections_to_remove; i++) {
> + unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;
> + pgdat_resize_lock(pgdat, &flags);
> + ret = __remove_section(zone, __pfn_to_section(pfn));
> + pgdat_resize_unlock(pgdat, &flags);
> + if (ret)
> + break;
> + }
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(__remove_pages);
Here may be a bug.
__remove_section() is called with pgdat_resize_lock() which is
spin_lock_irqsave().
__remove_section()
|
+--> unregister_memory_section()
|
+--> remove_memory_block()
|
+--> unregister_memory()
|
+--> sysdev_unregister()
sysdev_unregister() calls mutex_lock().
It might sleep with irq disable, right?
I found BUG()'s messages by this.
Bye.
--
Yasunori Goto
next prev parent reply other threads:[~2008-03-21 15:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-06 18:54 [PATCH 0/5] 2.6.25-rc3-mm1 hotplug memory remove updates Badari Pulavarty
2008-03-06 18:55 ` [PATCH 1/5] generic __remove_pages() support Badari Pulavarty
2008-03-06 19:08 ` Randy Dunlap
2008-03-06 19:29 ` Badari Pulavarty
2008-03-06 23:37 ` Badari Pulavarty
2008-03-06 20:54 ` Dave Hansen
2008-03-06 21:42 ` Badari Pulavarty
2008-03-07 1:35 ` Yasunori Goto
2008-03-07 16:36 ` Badari Pulavarty
2008-03-07 16:44 ` Badari Pulavarty
2008-03-21 15:25 ` Yasunori Goto [this message]
2008-03-21 16:55 ` Badari Pulavarty
2008-03-06 18:56 ` [PATCH 2/5] [PPC] htab_remove_mapping() error handling Badari Pulavarty
2008-03-06 18:57 ` [PATCH 3/5] [PPC] hotplug memory notifications for ppc Badari Pulavarty
2008-03-06 18:58 ` [PATCH 4/5] [PPC] update lmb for hotplug memory add/remove Badari Pulavarty
2008-03-06 18:59 ` [PATCH 5/5] [PPC] provide walk_memory_resource() for ppc Badari Pulavarty
2008-03-28 0:33 [PATCH 0/5] 2.6.25-rc5-mm1 hotplug memory remove updates Badari Pulavarty
2008-03-28 0:35 ` [PATCH 1/5] generic __remove_pages() support Badari Pulavarty
2008-03-28 2:26 ` Yasunori Goto
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=20080321235322.2B17.E1E9C6FF@jp.fujitsu.com \
--to=y-goto@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
--cc=pbadari@us.ibm.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®