Re: [PATCH] Add IORESOUCE_BUSY flag for System RAM (Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c)
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 <[EMAIL PROTECTED]> > > --- > 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.0 > +0900 > +++ current/arch/ia64/kernel/efi.c2007-11-01 15:24:18.0 +0900 > @@ -,7 +,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.0 +0900 > +++ current/mm/memory_hotplug.c 2007-11-01 15:41:27.0 +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 <[EMAIL PROTECTED]> --- 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.0 -0700 +++ linux-2.6.24-rc1/kernel/resource.c 2007-11-01 08:19:59.0 -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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Add IORESOUCE_BUSY flag for System RAM (Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c)
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 <[EMAIL PROTECTED]> --- 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.0 +0900 +++ current/arch/ia64/kernel/efi.c 2007-11-01 15:24:18.0 +0900 @@ -,7 +,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.c2007-11-01 15:24:16.0 +0900 +++ current/mm/memory_hotplug.c 2007-11-01 15:41:27.0 +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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c
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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c
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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c
On Tue, 2 Oct 2007 19:52:42 -0600 Matthew Wilcox <[EMAIL PROTECTED]> 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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Question] How to represent SYSTEM_RAM in kerenel/resouce.c
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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[Question] How to represent SYSTEM_RAM in kerenel/resouce.c
Hi, Now, SYSTEM_RAM is registerd to resouce list and a user can see memory map from /proc/iomem, like following. == [EMAIL PROTECTED] linux-2.6.23-rc8-mm2]$ grep RAM /proc/iomem -0009 : System RAM 0010-03ff : System RAM 0400-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 1-7 : System RAM 408000-40 : System RAM 1400400-147 : 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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/