linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yasunori Goto <y-goto@jp.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <matthew@wil.cx>,
	lkml <linux-kernel@vger.kernel.org>,
	andi@firstfloor.org, "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"tony.luck@intel.com" <tony.luck@intel.com>,
	"linux-ia64@vger.kernel.org" <linux-ia64@vger.kernel.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Dave Hansen <haveblue@us.ibm.com>,
	Badari Pulavarty <pbadari@us.ibm.com>
Subject: [PATCH] Add IORESOUCE_BUSY flag for System RAM take 2.
Date: Tue, 06 Nov 2007 11:23:01 +0900	[thread overview]
Message-ID: <20071106111839.4D11.Y-GOTO@jp.fujitsu.com> (raw)
In-Reply-To: <1193934490.26106.0.camel@dyn9047017100.beaverton.ibm.com>

Hello.

I merged Baradi-san's patch and mine. This and Kame-san's
following patch is necessary for x86-64 memory unplug.

http://marc.info/?l=linux-mm&m=119399026017901&w=2

I heard Kame-san's patch is already included in -mm.
So, I'll repost merged patch now.

This patch is tested on 2.6.23-mm1.

Please apply.

---

i386 and x86-64 registers System RAM as IORESOURCE_MEM | IORESOURCE_BUSY.

But ia64 registers it as IORESOURCE_MEM only.
In addition, memory hotplug code registers new memory as IORESOURCE_MEM too.

This difference causes a failure of memory unplug of x86-64.
This patch fix it.

This patch adds IORESOURCE_BUSY to avoid potential overlap mapping
by PCI device.


Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>

---
 arch/ia64/kernel/efi.c |    6 ++----
 kernel/resource.c      |    2 +-
 mm/memory_hotplug.c    |    2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

Index: current/arch/ia64/kernel/efi.c
===================================================================
--- current.orig/arch/ia64/kernel/efi.c	2007-11-02 17:17:30.000000000 +0900
+++ current/arch/ia64/kernel/efi.c	2007-11-02 17:19:10.000000000 +0900
@@ -1111,7 +1111,7 @@ efi_initialize_iomem_resources(struct re
 		if (md->num_pages == 0) /* should not happen */
 			continue;
 
-		flags = IORESOURCE_MEM;
+		flags = IORESOURCE_MEM | IORESOURCE_BUSY;
 		switch (md->type) {
 
 			case EFI_MEMORY_MAPPED_IO:
@@ -1133,12 +1133,11 @@ efi_initialize_iomem_resources(struct re
 
 			case EFI_ACPI_MEMORY_NVS:
 				name = "ACPI Non-volatile Storage";
-				flags |= IORESOURCE_BUSY;
 				break;
 
 			case EFI_UNUSABLE_MEMORY:
 				name = "reserved";
-				flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED;
+				flags |= IORESOURCE_DISABLED;
 				break;
 
 			case EFI_RESERVED_TYPE:
@@ -1147,7 +1146,6 @@ efi_initialize_iomem_resources(struct re
 			case EFI_ACPI_RECLAIM_MEMORY:
 			default:
 				name = "reserved";
-				flags |= IORESOURCE_BUSY;
 				break;
 		}
 
Index: current/mm/memory_hotplug.c
===================================================================
--- current.orig/mm/memory_hotplug.c	2007-11-02 17:19:09.000000000 +0900
+++ current/mm/memory_hotplug.c	2007-11-02 17:19:10.000000000 +0900
@@ -39,7 +39,7 @@ static struct resource *register_memory_
 	res->name = "System RAM";
 	res->start = start;
 	res->end = start + size - 1;
-	res->flags = IORESOURCE_MEM;
+	res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
 	if (request_resource(&iomem_resource, res) < 0) {
 		printk("System RAM resource %llx - %llx cannot be added\n",
 		(unsigned long long)res->start, (unsigned long long)res->end);
Index: current/kernel/resource.c
===================================================================
--- current.orig/kernel/resource.c	2007-11-02 17:19:15.000000000 +0900
+++ current/kernel/resource.c	2007-11-02 17:22:39.000000000 +0900
@@ -287,7 +287,7 @@ walk_memory_resource(unsigned long start
 	int ret = -1;
 	res.start = (u64) start_pfn << PAGE_SHIFT;
 	res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1;
-	res.flags = IORESOURCE_MEM;
+	res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
 	orig_end = res.end;
 	while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) {
 		pfn = (unsigned long)(res.start >> PAGE_SHIFT);

-- 
Yasunori Goto 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-11-06  2:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-03  1:31 [Question] How to represent SYSTEM_RAM in kerenel/resouce.c KAMEZAWA Hiroyuki
2007-10-03  1:52 ` Matthew Wilcox
2007-10-03  4:57   ` KAMEZAWA Hiroyuki
2007-11-01  9:21     ` [PATCH] Add IORESOUCE_BUSY flag for System RAM (Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c) Yasunori Goto
2007-11-01 16:28       ` Badari Pulavarty
2007-11-06  2:23         ` Yasunori Goto [this message]
2007-10-03 16:37 ` [Question] How to represent SYSTEM_RAM in kerenel/resouce.c Dave Hansen
2007-10-03 16:43   ` Matthew Wilcox

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=20071106111839.4D11.Y-GOTO@jp.fujitsu.com \
    --to=y-goto@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=haveblue@us.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=matthew@wil.cx \
    --cc=pbadari@us.ibm.com \
    --cc=tony.luck@intel.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