* [Question] How to represent SYSTEM_RAM in kerenel/resouce.c @ 2007-10-03 1:31 KAMEZAWA Hiroyuki 2007-10-03 1:52 ` Matthew Wilcox 2007-10-03 16:37 ` [Question] How to represent SYSTEM_RAM in kerenel/resouce.c Dave Hansen 0 siblings, 2 replies; 8+ messages in thread From: KAMEZAWA Hiroyuki @ 2007-10-03 1:31 UTC (permalink / raw) To: LKML Cc: andi, linux-mm@kvack.org, tony.luck@intel.com, Andrew Morton, pbadari, linux-ia64@vger.kernel.org Hi, Now, SYSTEM_RAM is registerd to resouce list and a user can see memory map from /proc/iomem, like following. == [kamezawa@drpq linux-2.6.23-rc8-mm2]$ grep RAM /proc/iomem 00000000-0009ffff : System RAM 00100000-03ffffff : System RAM 04000000-04f1bfff : System RAM 04f1c000-6b4b9fff : System RAM 6b4ba000-6b797fff : System RAM 6b798000-6b799fff : System RAM 6b79a000-6b79dfff : System RAM 6b79e000-6b79efff : System RAM 6b79f000-6b7fbfff : System RAM 6b7fc000-6c629fff : System RAM 6c62a000-6c800fff : System RAM 6c801000-6c843fff : System RAM 6c844000-6c847fff : System RAM 6c848000-6c849fff : System RAM 6c84a000-6c85dfff : System RAM 6c85e000-6c85efff : System RAM 6c85f000-6cbfbfff : System RAM 6cbfc000-6d349fff : System RAM 6d34a000-6d3fbfff : System RAM 6d3fc000-6d455fff : System RAM 6d4fc000-6d773fff : System RAM 100000000-7ffffffff : System RAM 4080000000-40ffffffff : System RAM 14004000000-147ffffffff : System RAM == But there is a confusion. i386 and x86_64 registers System RAM as IORESOUCE_MEM | IORESOUCE_BUSY. ia64 registers System RAM as IORESOURCE_MEM. Which is better ? I ask this because current memory hotplug treat memory as IORESOUCE_MEM. When memory hot-add occurs on x86_64, new memory is added as IORESOUCE_MEM. memory hot-remove (now) can remove only IORESOUCE_MEM. If ia64 should treat System RAM as IORESOUCE_MEM | IORESOUCE_BUSY, I'll write a fix. Thanks, -Kame -- 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> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c 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-10-03 16:37 ` [Question] How to represent SYSTEM_RAM in kerenel/resouce.c Dave Hansen 1 sibling, 1 reply; 8+ messages in thread From: Matthew Wilcox @ 2007-10-03 1:52 UTC (permalink / raw) To: KAMEZAWA Hiroyuki Cc: LKML, andi, linux-mm@kvack.org, tony.luck@intel.com, Andrew Morton, pbadari, linux-ia64@vger.kernel.org On Wed, Oct 03, 2007 at 10:31:36AM +0900, KAMEZAWA Hiroyuki wrote: > i386 and x86_64 registers System RAM as IORESOUCE_MEM | IORESOUCE_BUSY. > ia64 registers System RAM as IORESOURCE_MEM. > > Which is better ? Should probably be BUSY. Non-BUSY regions can have io resources requested underneath them, but you wouldn't want a PCI device to be assigned an address which overlaps with physical memory. -- Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step." -- 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> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c 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 0 siblings, 1 reply; 8+ messages in thread From: KAMEZAWA Hiroyuki @ 2007-10-03 4:57 UTC (permalink / raw) To: Matthew Wilcox Cc: LKML, andi, linux-mm@kvack.org, tony.luck@intel.com, Andrew Morton, pbadari, linux-ia64@vger.kernel.org On Tue, 2 Oct 2007 19:52:42 -0600 Matthew Wilcox <matthew@wil.cx> wrote: > On Wed, Oct 03, 2007 at 10:31:36AM +0900, KAMEZAWA Hiroyuki wrote: > > i386 and x86_64 registers System RAM as IORESOUCE_MEM | IORESOUCE_BUSY. > > ia64 registers System RAM as IORESOURCE_MEM. > > > > Which is better ? > > Should probably be BUSY. Non-BUSY regions can have io resources > requested underneath them, but you wouldn't want a PCI device to be > assigned an address which overlaps with physical memory. Thank you. It seems that I'll have to try modifing ia64 and memory hotplug in the next -mm. Regards, -Kame -- 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> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Add IORESOUCE_BUSY flag for System RAM (Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c) 2007-10-03 4:57 ` KAMEZAWA Hiroyuki @ 2007-11-01 9:21 ` Yasunori Goto 2007-11-01 16:28 ` Badari Pulavarty 0 siblings, 1 reply; 8+ messages in thread From: Yasunori Goto @ 2007-11-01 9:21 UTC (permalink / raw) To: Andrew Morton Cc: Matthew Wilcox, LKML, andi, linux-mm@kvack.org, tony.luck@intel.com, pbadari, linux-ia64@vger.kernel.org, KAMEZAWA Hiroyuki, Dave Hansen Hello. I was asked from Kame-san to write this patch. 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 patch adds IORESOURCE_BUSY for them to avoid potential overlap mapping by PCI device. Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com> --- arch/ia64/kernel/efi.c | 6 ++---- mm/memory_hotplug.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) Index: current/arch/ia64/kernel/efi.c =================================================================== --- current.orig/arch/ia64/kernel/efi.c 2007-11-01 15:24:05.000000000 +0900 +++ current/arch/ia64/kernel/efi.c 2007-11-01 15:24:18.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-01 15:24:16.000000000 +0900 +++ current/mm/memory_hotplug.c 2007-11-01 15:41:27.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); -- 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> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add IORESOUCE_BUSY flag for System RAM (Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c) 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 ` [PATCH] Add IORESOUCE_BUSY flag for System RAM take 2 Yasunori Goto 0 siblings, 1 reply; 8+ messages in thread From: Badari Pulavarty @ 2007-11-01 16:28 UTC (permalink / raw) To: Yasunori Goto Cc: Andrew Morton, Matthew Wilcox, lkml, andi, linux-mm@kvack.org, tony.luck@intel.com, linux-ia64@vger.kernel.org, KAMEZAWA Hiroyuki, Dave Hansen On Thu, 2007-11-01 at 18:21 +0900, Yasunori Goto wrote: > Hello. > > I was asked from Kame-san to write this patch. > > 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 patch adds IORESOURCE_BUSY for them to avoid potential overlap mapping > by PCI device. > > Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com> > > --- > arch/ia64/kernel/efi.c | 6 ++---- > mm/memory_hotplug.c | 2 +- > 2 files changed, 3 insertions(+), 5 deletions(-) > > Index: current/arch/ia64/kernel/efi.c > =================================================================== > --- current.orig/arch/ia64/kernel/efi.c 2007-11-01 15:24:05.000000000 +0900 > +++ current/arch/ia64/kernel/efi.c 2007-11-01 15:24:18.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-01 15:24:16.000000000 +0900 > +++ current/mm/memory_hotplug.c 2007-11-01 15:41:27.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); > Not quite.. You need following patch on top of this to make hotplug memory remove work on ia64/x86-64. Thanks, Badari Once you mark memory resource BUSY, walk_memory_resource() won't be able to find it. Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com> --- kernel/resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6.24-rc1/kernel/resource.c =================================================================== --- linux-2.6.24-rc1.orig/kernel/resource.c 2007-10-23 20:50:57.000000000 -0700 +++ linux-2.6.24-rc1/kernel/resource.c 2007-11-01 08:19:59.000000000 -0700 @@ -277,7 +277,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); -- 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> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Add IORESOUCE_BUSY flag for System RAM take 2. 2007-11-01 16:28 ` Badari Pulavarty @ 2007-11-06 2:23 ` Yasunori Goto 0 siblings, 0 replies; 8+ messages in thread From: Yasunori Goto @ 2007-11-06 2:23 UTC (permalink / raw) To: Andrew Morton Cc: Matthew Wilcox, lkml, andi, linux-mm@kvack.org, tony.luck@intel.com, linux-ia64@vger.kernel.org, KAMEZAWA Hiroyuki, Dave Hansen, Badari Pulavarty 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> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c 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 16:37 ` Dave Hansen 2007-10-03 16:43 ` Matthew Wilcox 1 sibling, 1 reply; 8+ messages in thread From: Dave Hansen @ 2007-10-03 16:37 UTC (permalink / raw) To: KAMEZAWA Hiroyuki Cc: LKML, andi, linux-mm@kvack.org, tony.luck@intel.com, Andrew Morton, pbadari, linux-ia64@vger.kernel.org On Wed, 2007-10-03 at 10:31 +0900, KAMEZAWA Hiroyuki wrote: > > i386 and x86_64 registers System RAM as IORESOUCE_MEM | > IORESOUCE_BUSY. > ia64 registers System RAM as IORESOURCE_MEM. > > Which is better ? I think we should take system ram out of the iomem file, at least. 'struct resource' is a good, cross-platform structure to use for keeping track of which memory we have where. So, we can share that structure to keep track of iomem, or memory hotplug state. But, I'm not sure we should be intermingling system RAM and iomem like we are now in the same instance of the structure. -- Dave -- 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> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c 2007-10-03 16:37 ` [Question] How to represent SYSTEM_RAM in kerenel/resouce.c Dave Hansen @ 2007-10-03 16:43 ` Matthew Wilcox 0 siblings, 0 replies; 8+ messages in thread From: Matthew Wilcox @ 2007-10-03 16:43 UTC (permalink / raw) To: Dave Hansen Cc: KAMEZAWA Hiroyuki, LKML, andi, linux-mm@kvack.org, tony.luck@intel.com, Andrew Morton, pbadari, linux-ia64@vger.kernel.org On Wed, Oct 03, 2007 at 09:37:13AM -0700, Dave Hansen wrote: > I think we should take system ram out of the iomem file, at least. Rubbish. iomem is a representation of the physical addresses in the system as seen from the CPU's perspective. As I said in my previous mail in this thread, if you attempt to map a device's BAR over the top of physical RAM, things will go poorly for you. -- Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step." -- 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> ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-11-06 2:23 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [PATCH] Add IORESOUCE_BUSY flag for System RAM take 2 Yasunori Goto 2007-10-03 16:37 ` [Question] How to represent SYSTEM_RAM in kerenel/resouce.c Dave Hansen 2007-10-03 16:43 ` Matthew Wilcox
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).