[PATCH v2] PCI: use dev-irq instead of dev-pin to enable non MSI/INTx interrupt
On some platforms, root port has neither MSI/MSI-X nor INTx interrupt generated in RC mode. In this case, we have to use other interrupt(e.g. system shared interrupt) for port service irq to have AER, Hot-plug, etc, services to work. Signed-off-by: Shengzhou Liu shengzhou@freescale.com --- drivers/pci/pcie/portdrv_core.c | 16 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 75915b3..49acf72 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -200,10 +200,13 @@ static int init_service_irqs(struct pci_dev *dev, int *irqs, int mask) { int i, irq = -1; - /* We have to use INTx if MSI cannot be used for PCIe PME or pciehp. */ + /* +* We have to use INTx or other interrupts(e.g. system shared interrupt) +* if MSI cannot be used for PCIe PME or pciehp. +*/ if (((mask PCIE_PORT_SERVICE_PME) pcie_pme_no_msi()) || ((mask PCIE_PORT_SERVICE_HP) pciehp_no_msi())) { - if (dev-pin) + if (dev-irq) irq = dev-irq; goto no_msi; } @@ -212,8 +215,13 @@ static int init_service_irqs(struct pci_dev *dev, int *irqs, int mask) if (!pcie_port_enable_msix(dev, irqs, mask)) return 0; - /* We're not going to use MSI-X, so try MSI and fall back to INTx */ - if (!pci_enable_msi(dev) || dev-pin) + /* +* We're not going to use MSI-X, so try MSI and fall back to INTx. +* If neither MSI/MSI-X nor INTx available, try other interrupt. (On +* some platforms, root port doesn't support generating MSI/MSI-X/INTx +* in RC mode) +*/ + if (!pci_enable_msi(dev) || dev-irq) irq = dev-irq; no_msi: -- 1.6.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] PCI: use dev-irq instead of dev-pin to enable non MSI/INTx interrupt
-Original Message- From: Wood Scott-B07421 Sent: Wednesday, July 18, 2012 1:42 AM To: Liu Shengzhou-B36685 Cc: bhelg...@google.com; linux-...@vger.kernel.org; linuxppc- d...@lists.ozlabs.org Subject: Re: [PATCH] PCI: use dev-irq instead of dev-pin to enable non MSI/INTx interrupt On 07/16/2012 09:35 PM, Shengzhou Liu wrote: On some platforms, root port has neither MSI/MSI-X nor INTx interrupt generated in RC mode. In this case, we have to use other interrupt(i.e. system shared interrupt) for port service irq to have AER, Hot-plug, etc, services to work. Signed-off-by: Shengzhou Liu shengzhou@freescale.com --- drivers/pci/pcie/portdrv_core.c |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 75915b3..a855254 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -212,8 +212,13 @@ static int init_service_irqs(struct pci_dev *dev, int *irqs, int mask) if (!pcie_port_enable_msix(dev, irqs, mask)) return 0; - /* We're not going to use MSI-X, so try MSI and fall back to INTx */ - if (!pci_enable_msi(dev) || dev-pin) + /* +* We're not going to use MSI-X, so try MSI and fall back to INTx. +* If neither MSI/MSI-X nor INTx available, try other interrupt. (On +* some platforms, root port doesn't support generating MSI/MSI-X/INTx +* in RC mode) +*/ + if (!pci_enable_msi(dev) || dev-irq) irq = dev-irq; What about the other usage of dev-pin a few lines up? -Scott Yes, it should be consistent with bottom, done in v2. Thanks, Shengzhou ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] mm: setup pageblock_order before it's used by sparse
On Mon, 2012-07-02 at 20:25 -0700, Yinghai Lu wrote: That means pageblock_order is always set to MAX_ORDER - 1, not sure whether this is intended. And it has the same issue as IA64 of wasting memory if CONFIG_SPARSE is enabled. adding BenH, need to know if it is powerpc intended. So it would be better to keep function set_pageblock_order(), it will fix the memory wasting on both IA64 and PowerPC. Should setup pageblock_order as early as possible to avoid confusing. Hrm, HPAGE_SHIFT is initially 0 because we only know at runtime what huge page sizes are going to be supported (if any). The business with pageblock_order is new to me and does look bogus today indeed. But not a huge deal either. Our MAX_ORDER is typically 9 (64K pages) or 13 (4K pages) and our standard huge page size is generally 16M so there isn't a big difference here. Still, maybe something worth looking into... Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] mm: setup pageblock_order before it's used by sparse
On Tue, 2012-07-03 at 11:29 +0800, Jiang Liu wrote: OK, waiting response from PPC. If we could find some ways to set HPAGE_SIZE early on PPC too, we can setup pageblock_order in arch instead of page_alloc.c as early as possible. We could split our hugetlbpage_init() into two, with the bit that sets HPAGE_SHIFT called earlier if it's really an issue. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] MIPS: fix bug.h MIPS build regression
On Mon, Jul 16, 2012 at 9:27 PM, Geert Uytterhoeven ge...@linux-m68k.org wrote: On Fri, Jun 22, 2012 at 7:54 PM, David Daney dda...@caviumnetworks.com wrote: On 06/20/2012 09:12 AM, Ralf Baechle wrote: On Wed, Jun 20, 2012 at 03:27:59PM +0900, Yoichi Yuasa wrote: Commit: 3777808873b0c49c5cf27e44c948dfb02675d578 breaks all MIPS builds. Thanks, fix applied. Where was it applied? It doesn't show up in linux-next for 20120622, which is where it is needed. It's also desperately needed in mainline for 3.5. Ralf? Andrew? This prevents any green MIPS builds. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v4 0/13] memory-hotplug : hot-remove physical memory
This patch series aims to support physical memory hot-remove. [RFC PATCH v4 1/13] memory-hotplug : rename remove_memory to offline_memory [RFC PATCH v4 2/13] memory-hotplug : add physical memory hotplug code to acpi_memory_device_remove [RFC PATCH v4 3/13] memory-hotplug : check whether memory is present or not [RFC PATCH v4 4/13] memory-hotplug : remove /sys/firmware/memmap/X sysfs [RFC PATCH v4 5/13] memory-hotplug : does not release memory region in PAGES_PER_SECTION chunks [RFC PATCH v4 6/13] memory-hotplug : add memory_block_release [RFC PATCH v4 7/13] memory-hotplug : remove_memory calls __remove_pages [RFC PATCH v4 8/13] memory-hotplug : check page type in get_page_bootmem [RFC PATCH v4 9/13] memory-hotplug : move register_page_bootmem_info_node and put_page_bootmem for sparse-vmemmap4 [RFC PATCH v4 10/13] memory-hotplug : implement register_page_bootmem_info_section of sparse-vmemmap [RFC PATCH v4 11/13] memory-hotplug : free memmap of sparse-vmemmap [RFC PATCH v4 12/13] memory-hotplug : add node_device_release [RFC PATCH v4 13/13] memory-hotplug : remove sysfs file of node Even if you apply these patches, you cannot remove the physical memory completely since these patches are still under development. But other components can be removed. I want you to cooperate to improve the physical memory hot-remove. So please review these patches and give your comment/idea. The patches can free/remove following things: - acpi_memory_info : [RFC PATCH 2/13] - /sys/firmware/memmap/X/{end, start, type} : [RFC PATCH 4/13] - iomem_resource: [RFC PATCH 5/13] - mem_section and related sysfs files : [RFC PATCH 6-11/13] - node and related sysfs files : [RFC PATCH 12-13/13] The patches cannot do following things yet: - page table of removed memory If you find lack of function for physical memory hot-remove, please let me know. change log of v4: * remove memory-hotplug : unify argument of firmware_map_add_early/hotplug from the patch series, since the patch is a bugfix. It is being disccussed on other thread. But for testing the patch series, the patch is needed. So I added the patch as [PATCH 0/13]. [RFC PATCH v4 2/13] * check memory is online or not at remove_memory() * add memory_add_physaddr_to_nid() to acpi_memory_device_remove() for getting node id [RFC PATCH v4 3/13] * create new patch : check memory is online or not at online_pages() [RFC PATCH v4 4/13] * add __ref section to remove_memory() * call firmware_map_remove_entry() before remove_sysfs_fw_map_entry() [RFC PATCH v4 11/13] * rewrite register_page_bootmem_memmap() for removing page used as PT/PMD change log of v3: * rebase to 3.5.0-rc6 [RFC PATCH v2 2/13] * remove extra kobject_put() * The patch was commented by Wen. Wen's comment is acpi_memory_device_remove() should ignore a return value of remove_memory() since caller does not care the return value. But I did not change it since I think caller should care the return value. And I am trying to fix it as follow: https://lkml.org/lkml/2012/7/5/624 [RFC PATCH v2 4/13] * remove a firmware_memmap_entry allocated by kzmalloc() change log of v2: [RFC PATCH v2 2/13] * check whether memory block is offline or not before calling offline_memory() * check whether section is valid or not in is_memblk_offline() * call kobject_put() for each memory_block in is_memblk_offline() [RFC PATCH v2 3/13] * unify the end argument of firmware_map_add_early/hotplug [RFC PATCH v2 4/13] * add release_firmware_map_entry() for freeing firmware_map_entry [RFC PATCH v2 6/13] * add release_memory_block() for freeing memory_block [RFC PATCH v2 11/13] * fix wrong arguments of free_pages() --- arch/powerpc/platforms/pseries/hotplug-memory.c | 16 +- arch/x86/mm/init_64.c | 144 drivers/acpi/acpi_memhotplug.c | 28 drivers/base/memory.c | 54 - drivers/base/node.c |7 + drivers/firmware/memmap.c | 78 - include/linux/firmware-map.h|6 + include/linux/memory.h |5 include/linux/memory_hotplug.h | 17 -- include/linux/mm.h |5 mm/memory_hotplug.c | 98 mm/sparse.c |5 12 files changed, 414 insertions(+), 49 deletions(-) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 0/13] firmware_map : unify argument of firmware_map_add_early/hotplug
There are two ways to create /sys/firmware/memmap/X sysfs: - firmware_map_add_early When the system starts, it is calledd from e820_reserve_resources() - firmware_map_add_hotplug When the memory is hot plugged, it is called from add_memory() But these functions are called without unifying value of end argument as below: - end argument of firmware_map_add_early() : start + size - 1 - end argument of firmware_map_add_hogplug() : start + size The patch unifies them to start + size. Even if applying the patch, /sys/firmware/memmap/X/end file content does not change. CC: Thomas Gleixner t...@linutronix.de CC: Ingo Molnar mi...@kernel.org CC: H. Peter Anvin h...@zytor.com CC: Tejun Heo t...@kernel.org CC: Andrew Morton a...@linux-foundation.org Reviewed-by: Dave Hansen d...@linux.vnet.ibm.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- arch/x86/kernel/e820.c|2 +- drivers/firmware/memmap.c |8 2 files changed, 5 insertions(+), 5 deletions(-) Index: linux-3.5-rc6/arch/x86/kernel/e820.c === --- linux-3.5-rc6.orig/arch/x86/kernel/e820.c 2012-07-18 17:19:38.391365260 +0900 +++ linux-3.5-rc6/arch/x86/kernel/e820.c2012-07-18 17:19:43.616300222 +0900 @@ -944,7 +944,7 @@ void __init e820_reserve_resources(void) for (i = 0; i e820_saved.nr_map; i++) { struct e820entry *entry = e820_saved.map[i]; firmware_map_add_early(entry-addr, - entry-addr + entry-size - 1, + entry-addr + entry-size, e820_type_to_string(entry-type)); } } Index: linux-3.5-rc6/drivers/firmware/memmap.c === --- linux-3.5-rc6.orig/drivers/firmware/memmap.c2012-07-18 17:19:38.388365299 +0900 +++ linux-3.5-rc6/drivers/firmware/memmap.c 2012-07-18 18:30:47.608390251 +0900 @@ -98,7 +98,7 @@ static LIST_HEAD(map_entries); /** * firmware_map_add_entry() - Does the real work to add a firmware memmap entry. * @start: Start of the memory range. - * @end: End of the memory range (inclusive). + * @end: End of the memory range. * @type: Type of the memory range. * @entry: Pre-allocated (either kmalloc() or bootmem allocator), uninitialised * entry. @@ -113,7 +113,7 @@ static int firmware_map_add_entry(u64 st BUG_ON(start end); entry-start = start; - entry-end = end; + entry-end = end - 1; entry-type = type; INIT_LIST_HEAD(entry-list); kobject_init(entry-kobj, memmap_ktype); @@ -148,7 +148,7 @@ static int add_sysfs_fw_map_entry(struct * firmware_map_add_hotplug() - Adds a firmware mapping entry when we do * memory hotplug. * @start: Start of the memory range. - * @end: End of the memory range (inclusive). + * @end: End of the memory range. * @type: Type of the memory range. * * Adds a firmware mapping entry. This function is for memory hotplug, it is @@ -175,7 +175,7 @@ int __meminit firmware_map_add_hotplug(u /** * firmware_map_add_early() - Adds a firmware mapping entry. * @start: Start of the memory range. - * @end: End of the memory range (inclusive). + * @end: End of the memory range. * @type: Type of the memory range. * * Adds a firmware mapping entry. This function uses the bootmem allocator ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v4 1/13] memory-hotplug : rename remove_memory to offline_memory
remove_memory() does not remove memory but just offlines memory. The patch changes name of it to offline_memory(). CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- drivers/acpi/acpi_memhotplug.c |2 +- drivers/base/memory.c |4 ++-- include/linux/memory_hotplug.h |2 +- mm/memory_hotplug.c|6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) Index: linux-3.5-rc4/drivers/acpi/acpi_memhotplug.c === --- linux-3.5-rc4.orig/drivers/acpi/acpi_memhotplug.c 2012-07-03 14:21:46.102416917 +0900 +++ linux-3.5-rc4/drivers/acpi/acpi_memhotplug.c2012-07-03 14:21:49.458374960 +0900 @@ -318,7 +318,7 @@ static int acpi_memory_disable_device(st */ list_for_each_entry_safe(info, n, mem_device-res_list, list) { if (info-enabled) { - result = remove_memory(info-start_addr, info-length); + result = offline_memory(info-start_addr, info-length); if (result) return result; } Index: linux-3.5-rc4/drivers/base/memory.c === --- linux-3.5-rc4.orig/drivers/base/memory.c2012-07-03 14:21:46.095417003 +0900 +++ linux-3.5-rc4/drivers/base/memory.c 2012-07-03 14:21:49.459374948 +0900 @@ -266,8 +266,8 @@ memory_block_action(unsigned long phys_i break; case MEM_OFFLINE: start_paddr = page_to_pfn(first_page) PAGE_SHIFT; - ret = remove_memory(start_paddr, - nr_pages PAGE_SHIFT); + ret = offline_memory(start_paddr, +nr_pages PAGE_SHIFT); break; default: WARN(1, KERN_WARNING %s(%ld, %ld) unknown action: Index: linux-3.5-rc4/mm/memory_hotplug.c === --- linux-3.5-rc4.orig/mm/memory_hotplug.c 2012-07-03 14:21:46.102416917 +0900 +++ linux-3.5-rc4/mm/memory_hotplug.c 2012-07-03 14:21:49.466374860 +0900 @@ -990,7 +990,7 @@ out: return ret; } -int remove_memory(u64 start, u64 size) +int offline_memory(u64 start, u64 size) { unsigned long start_pfn, end_pfn; @@ -999,9 +999,9 @@ int remove_memory(u64 start, u64 size) return offline_pages(start_pfn, end_pfn, 120 * HZ); } #else -int remove_memory(u64 start, u64 size) +int offline_memory(u64 start, u64 size) { return -EINVAL; } #endif /* CONFIG_MEMORY_HOTREMOVE */ -EXPORT_SYMBOL_GPL(remove_memory); +EXPORT_SYMBOL_GPL(offline_memory); Index: linux-3.5-rc4/include/linux/memory_hotplug.h === --- linux-3.5-rc4.orig/include/linux/memory_hotplug.h 2012-07-03 14:21:46.102416917 +0900 +++ linux-3.5-rc4/include/linux/memory_hotplug.h2012-07-03 14:21:49.471374796 +0900 @@ -233,7 +233,7 @@ static inline int is_mem_section_removab extern int mem_online_node(int nid); extern int add_memory(int nid, u64 start, u64 size); extern int arch_add_memory(int nid, u64 start, u64 size); -extern int remove_memory(u64 start, u64 size); +extern int offline_memory(u64 start, u64 size); extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, int nr_pages); extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v4 2/13] memory-hotplug : add physical memory hotplug code to acpi_memory_device_remove
acpi_memory_device_remove() has been prepared to remove physical memory. But, the function only frees acpi_memory_device currentlry. The patch adds following functions into acpi_memory_device_remove(): - offline memory - remove physical memory. It only check whether memory is online or not. - free acpi_memory_device CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- drivers/acpi/acpi_memhotplug.c | 27 ++- drivers/base/memory.c | 39 +++ include/linux/memory.h |5 + include/linux/memory_hotplug.h |5 + mm/memory_hotplug.c| 22 ++ 5 files changed, 97 insertions(+), 1 deletion(-) Index: linux-3.5-rc6/drivers/acpi/acpi_memhotplug.c === --- linux-3.5-rc6.orig/drivers/acpi/acpi_memhotplug.c 2012-07-17 11:20:15.117796971 +0900 +++ linux-3.5-rc6/drivers/acpi/acpi_memhotplug.c2012-07-17 13:36:30.325594022 +0900 @@ -29,6 +29,7 @@ #include linux/module.h #include linux/init.h #include linux/types.h +#include linux/memory.h #include linux/memory_hotplug.h #include linux/slab.h #include acpi/acpi_drivers.h @@ -452,12 +453,36 @@ static int acpi_memory_device_add(struct static int acpi_memory_device_remove(struct acpi_device *device, int type) { struct acpi_memory_device *mem_device = NULL; - + struct acpi_memory_info *info, *tmp; + int result; + int node; if (!device || !acpi_driver_data(device)) return -EINVAL; mem_device = acpi_driver_data(device); + + node = acpi_get_node(mem_device-device-handle); + list_for_each_entry_safe(info, tmp, mem_device-res_list, list) { + if (!info-enabled) + continue; + + if (!is_memblk_offline(info-start_addr, info-length)) { + result = offline_memory(info-start_addr, info-length); + if (result) + return result; + } + if (node 0) + node = memory_add_physaddr_to_nid(info-start_addr); + + result = remove_memory(node, info-start_addr, info-length); + if (result) + return result; + + list_del(info-list); + kfree(info); + } + kfree(mem_device); return 0; Index: linux-3.5-rc6/include/linux/memory_hotplug.h === --- linux-3.5-rc6.orig/include/linux/memory_hotplug.h 2012-07-17 11:20:15.133796772 +0900 +++ linux-3.5-rc6/include/linux/memory_hotplug.h2012-07-17 11:29:41.490716352 +0900 @@ -221,6 +221,7 @@ static inline void unlock_memory_hotplug #ifdef CONFIG_MEMORY_HOTREMOVE extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); +extern int remove_memory(int nid, u64 start, u64 size); #else static inline int is_mem_section_removable(unsigned long pfn, @@ -228,6 +229,10 @@ static inline int is_mem_section_removab { return 0; } +static inline int remove_memory(int nid, u64 start, u64 size) +{ + return -EBUSY; +} #endif /* CONFIG_MEMORY_HOTREMOVE */ extern int mem_online_node(int nid); Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-17 11:20:15.129796821 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-17 13:25:18.952986069 +0900 @@ -998,6 +998,28 @@ int offline_memory(u64 start, u64 size) end_pfn = start_pfn + PFN_DOWN(size); return offline_pages(start_pfn, end_pfn, 120 * HZ); } + +int remove_memory(int nid, u64 start, u64 size) +{ + int ret = -EBUSY; + lock_memory_hotplug(); + /* +* The memory might become online by other task, even if you offine it. +* So we check whether the cpu has been onlined or not. +*/ + if (!is_memblk_offline(start, size)) { + pr_warn(memory removing [mem %#010llx-%#010llx] failed, + because the memmory range is online\n, + start, start + size); + ret = -EAGAIN; + } + + unlock_memory_hotplug(); + return ret; + +} +EXPORT_SYMBOL_GPL(remove_memory); + #else int offline_memory(u64 start, u64 size) { Index: linux-3.5-rc6/drivers/base/memory.c
[PATCH v4 3/13] memory-hotplug : check whether memory is present or not
If system supports memory hot-remove, online_pages() may online removed pages. So online_pages() need to check whether onlining pages are present or not. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- include/linux/mmzone.h | 21 + mm/memory_hotplug.c| 13 + 2 files changed, 34 insertions(+) Index: linux-3.5-rc6/include/linux/mmzone.h === --- linux-3.5-rc6.orig/include/linux/mmzone.h 2012-07-08 09:23:56.0 +0900 +++ linux-3.5-rc6/include/linux/mmzone.h2012-07-17 16:10:21.588186145 +0900 @@ -1168,6 +1168,27 @@ void sparse_init(void); #define sparse_index_init(_sec, _nid) do {} while (0) #endif /* CONFIG_SPARSEMEM */ +#ifdef CONFIG_SPARSEMEM +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages) +{ + int i; + for (i = 0; i nr_pages; i++) { + if (pfn_present(pfn + 1)) + continue; + else { + unlock_memory_hotplug(); + return -EINVAL; + } + } + return 0; +} +#else +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages) +{ + return 0; +} +#endif /* CONFIG_SPARSEMEM*/ + #ifdef CONFIG_NODES_SPAN_OTHER_NODES bool early_pfn_in_nid(unsigned long pfn, int nid); #else Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-17 14:26:40.0 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-17 16:09:50.070580170 +0900 @@ -467,6 +467,19 @@ int __ref online_pages(unsigned long pfn struct memory_notify arg; lock_memory_hotplug(); + /* +* If system supports memory hot-remove, the memory may have been +* removed. So we check whether the memory has been removed or not. +* +* Note: When CONFIG_SPARSEMEM is defined, pfns_present() become +* effective. If CONFIG_SPARSEMEM is not defined, pfns_present() +* always returns 0. +*/ + ret = pfns_present(pfn, nr_pages); + if (ret) { + unlock_memory_hotplug(); + return ret; + } arg.start_pfn = pfn; arg.nr_pages = nr_pages; arg.status_change_nid = -1; ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v4 4/13] memory-hotplug : remove /sys/firmware/memmap/X sysfs
When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type} sysfs files are created. But there is no code to remove these files. The patch implements the function to remove them. Note : The code does not free firmware_map_entry since there is no way to free memory which is allocated by bootmem. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- drivers/firmware/memmap.c| 78 ++- include/linux/firmware-map.h |6 +++ mm/memory_hotplug.c |9 +++- 3 files changed, 90 insertions(+), 3 deletions(-) Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 17:20:05.670024283 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 17:51:03.933189930 +0900 @@ -1012,9 +1012,9 @@ int offline_memory(u64 start, u64 size) return offline_pages(start_pfn, end_pfn, 120 * HZ); } -int remove_memory(int nid, u64 start, u64 size) +int __ref remove_memory(int nid, u64 start, u64 size) { - int ret = -EBUSY; + int ret = 0; lock_memory_hotplug(); /* * The memory might become online by other task, even if you offine it. @@ -1025,8 +1025,13 @@ int remove_memory(int nid, u64 start, u6 because the memmory range is online\n, start, start + size); ret = -EAGAIN; + goto out; } + /* remove memmap entry */ + firmware_map_remove(start, start + size, System RAM); + +out: unlock_memory_hotplug(); return ret; Index: linux-3.5-rc6/include/linux/firmware-map.h === --- linux-3.5-rc6.orig/include/linux/firmware-map.h 2012-07-18 17:19:37.007382563 +0900 +++ linux-3.5-rc6/include/linux/firmware-map.h 2012-07-18 17:42:20.804730245 +0900 @@ -25,6 +25,7 @@ int firmware_map_add_early(u64 start, u64 end, const char *type); int firmware_map_add_hotplug(u64 start, u64 end, const char *type); +int firmware_map_remove(u64 start, u64 end, const char *type); #else /* CONFIG_FIRMWARE_MEMMAP */ @@ -38,6 +39,11 @@ static inline int firmware_map_add_hotpl return 0; } +static inline int firmware_map_remove(u64 start, u64 end, const char *type) +{ + return 0; +} + #endif /* CONFIG_FIRMWARE_MEMMAP */ #endif /* _LINUX_FIRMWARE_MAP_H */ Index: linux-3.5-rc6/drivers/firmware/memmap.c === --- linux-3.5-rc6.orig/drivers/firmware/memmap.c2012-07-18 17:19:43.618300182 +0900 +++ linux-3.5-rc6/drivers/firmware/memmap.c 2012-07-18 17:42:20.846729721 +0900 @@ -21,6 +21,7 @@ #include linux/types.h #include linux/bootmem.h #include linux/slab.h +#include linux/mm.h /* * Data types -- @@ -79,7 +80,22 @@ static const struct sysfs_ops memmap_att .show = memmap_attr_show, }; +#define to_memmap_entry(obj) container_of(obj, struct firmware_map_entry, kobj) + +static void release_firmware_map_entry(struct kobject *kobj) +{ + struct firmware_map_entry *entry = to_memmap_entry(kobj); + struct page *page; + + page = virt_to_page(entry); + if (PageSlab(page) || PageCompound(page)) + kfree(entry); + + /* There is no way to free memory allocated from bootmem*/ +} + static struct kobj_type memmap_ktype = { + .release= release_firmware_map_entry, .sysfs_ops = memmap_attr_ops, .default_attrs = def_attrs, }; @@ -123,6 +139,16 @@ static int firmware_map_add_entry(u64 st return 0; } +/** + * firmware_map_remove_entry() - Does the real work to remove a firmware + * memmap entry. + * @entry: removed entry. + **/ +static inline void firmware_map_remove_entry(struct firmware_map_entry *entry) +{ + list_del(entry-list); +} + /* * Add memmap entry on sysfs */ @@ -144,6 +170,31 @@ static int add_sysfs_fw_map_entry(struct return 0; } +/* + * Remove memmap entry on sysfs + */ +static inline void remove_sysfs_fw_map_entry(struct firmware_map_entry *entry) +{ + kobject_put(entry-kobj); +} + +/* + * Search memmap entry + */ + +struct firmware_map_entry * __meminit +find_firmware_map_entry(u64 start, u64 end, const char *type) +{ + struct firmware_map_entry *entry; + + list_for_each_entry(entry, map_entries, list) + if
[RFC PATCH v4 5/13] memory-hotplug : does not release memory region in PAGES_PER_SECTION chunks
Since applying a patch(de7f0cba96786c), release_mem_region() has been changed as called in PAGES_PER_SECTION chunks because register_memory_resource() is called in PAGES_PER_SECTION chunks by add_memory(). But it seems firmware dependency. If CRS are written in the PAGES_PER_SECTION chunks in ACPI DSDT Table, register_memory_resource() is called in PAGES_PER_SECTION chunks. But if CRS are written in the DIMM unit in ACPI DSDT Table, register_memory_resource() is called in DIMM unit. So release_mem_region() should not be called in PAGES_PER_SECTION chunks. The patch fixes it. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- arch/powerpc/platforms/pseries/hotplug-memory.c | 13 + mm/memory_hotplug.c |4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 17:51:03.933189930 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 17:51:17.550020005 +0900 @@ -358,11 +358,11 @@ int __remove_pages(struct zone *zone, un 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; - release_mem_region(pfn PAGE_SHIFT, - PAGES_PER_SECTION PAGE_SHIFT); ret = __remove_section(zone, __pfn_to_section(pfn)); if (ret) break; Index: linux-3.5-rc6/arch/powerpc/platforms/pseries/hotplug-memory.c === --- linux-3.5-rc6.orig/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-18 17:50:49.893365814 +0900 +++ linux-3.5-rc6/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-18 17:51:17.553019968 +0900 @@ -77,7 +77,8 @@ static int pseries_remove_memblock(unsig { unsigned long start, start_pfn; struct zone *zone; - int ret; + int i, ret; + int sections_to_remove; start_pfn = base PAGE_SHIFT; @@ -97,9 +98,13 @@ static int pseries_remove_memblock(unsig * to sysfs state file and we can't remove sysfs entries * while writing to it. So we have to defer it to here. */ - ret = __remove_pages(zone, start_pfn, memblock_size PAGE_SHIFT); - if (ret) - return ret; + sections_to_remove = (memblock_size PAGE_SHIFT) / PAGES_PER_SECTION; + for (i = 0; i sections_to_remove; i++) { + unsigned long pfn = start_pfn + i * PAGES_PER_SECTION; + ret = __remove_pages(zone, start_pfn, PAGES_PER_SECTION); + if (ret) + return ret; + } /* * Update memory regions for memory remove ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v4 7/13] memory-hotplug : remove_memory calls __remove_pages
The patch adds __remove_pages() to remove_memory(). Then the range of phys_start_pfn argument and nr_pages argument in __remove_pagse() may have different zone. So zone argument is removed from __remove_pages() and __remove_pages() caluculates zone in each section. When CONFIG_SPARSEMEM_VMEMMAP is defined, there is no way to remove a memmap. So __remove_section only calls unregister_memory_section(). CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- arch/powerpc/platforms/pseries/hotplug-memory.c |5 + include/linux/memory_hotplug.h |3 +-- mm/memory_hotplug.c | 19 --- 3 files changed, 14 insertions(+), 13 deletions(-) Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:00:27.440145432 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:01:02.070712487 +0900 @@ -275,11 +275,14 @@ static int __meminit __add_section(int n #ifdef CONFIG_SPARSEMEM_VMEMMAP static int __remove_section(struct zone *zone, struct mem_section *ms) { - /* -* XXX: Freeing memmap with vmemmap is not implement yet. -* This should be removed later. -*/ - return -EBUSY; + int ret = -EINVAL; + + if (!valid_section(ms)) + return ret; + + ret = unregister_memory_section(ms); + + return ret; } #else static int __remove_section(struct zone *zone, struct mem_section *ms) @@ -346,11 +349,11 @@ EXPORT_SYMBOL_GPL(__add_pages); * sure that pages are marked reserved and zones are adjust properly by * calling offline_pages(). */ -int __remove_pages(struct zone *zone, unsigned long phys_start_pfn, -unsigned long nr_pages) +int __remove_pages(unsigned long phys_start_pfn, unsigned long nr_pages) { unsigned long i, ret = 0; int sections_to_remove; + struct zone *zone; /* * We can only remove entire sections @@ -363,6 +366,7 @@ int __remove_pages(struct zone *zone, un 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; + zone = page_zone(pfn_to_page(pfn)); ret = __remove_section(zone, __pfn_to_section(pfn)); if (ret) break; @@ -1031,6 +1035,7 @@ int __ref remove_memory(int nid, u64 sta /* remove memmap entry */ firmware_map_remove(start, start + size, System RAM); + __remove_pages(start PAGE_SHIFT, size PAGE_SHIFT); out: unlock_memory_hotplug(); return ret; Index: linux-3.5-rc6/include/linux/memory_hotplug.h === --- linux-3.5-rc6.orig/include/linux/memory_hotplug.h 2012-07-18 18:00:27.445145371 +0900 +++ linux-3.5-rc6/include/linux/memory_hotplug.h2012-07-18 18:00:40.461982690 +0900 @@ -89,8 +89,7 @@ extern bool is_pageblock_removable_noloc /* reasonably generic interface to expand the physical pages in a zone */ extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, unsigned long nr_pages); -extern int __remove_pages(struct zone *zone, unsigned long start_pfn, - unsigned long nr_pages); +extern int __remove_pages(unsigned long start_pfn, unsigned long nr_pages); #ifdef CONFIG_NUMA extern int memory_add_physaddr_to_nid(u64 start); Index: linux-3.5-rc6/arch/powerpc/platforms/pseries/hotplug-memory.c === --- linux-3.5-rc6.orig/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-18 18:00:27.442145407 +0900 +++ linux-3.5-rc6/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-18 18:00:40.470982578 +0900 @@ -76,7 +76,6 @@ unsigned long memory_block_size_bytes(vo static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size) { unsigned long start, start_pfn; - struct zone *zone; int i, ret; int sections_to_remove; @@ -87,8 +86,6 @@ static int pseries_remove_memblock(unsig return 0; } - zone = page_zone(pfn_to_page(start_pfn)); - /* * Remove section mappings and sysfs entries for the * section of the memory we are removing. @@ -101,7 +98,7 @@ static int pseries_remove_memblock(unsig sections_to_remove = (memblock_size PAGE_SHIFT) /
[RFC PATCH v4 6/13] memory-hotplug : add memory_block_release
When calling remove_memory_block(), the function shows following message at device_release(). Device 'memory528' does not have a release() function, it is broken and must be fixed. remove_memory_block() calls kfree(mem). I think it shouled be called from device_release(). So the patch implements memory_block_release() CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- drivers/base/memory.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) Index: linux-3.5-rc6/drivers/base/memory.c === --- linux-3.5-rc6.orig/drivers/base/memory.c2012-07-18 17:50:49.659368740 +0900 +++ linux-3.5-rc6/drivers/base/memory.c 2012-07-18 17:51:28.655881214 +0900 @@ -109,6 +109,15 @@ bool is_memblk_offline(unsigned long sta } EXPORT_SYMBOL(is_memblk_offline); +#define to_memory_block(device) container_of(device, struct memory_block, dev) + +static void release_memory_block(struct device *dev) +{ + struct memory_block *mem = to_memory_block(dev); + + kfree(mem); +} + /* * register_memory - Setup a sysfs device for a memory block */ @@ -119,6 +128,7 @@ int register_memory(struct memory_block memory-dev.bus = memory_subsys; memory-dev.id = memory-start_section_nr / sections_per_block; + memory-dev.release = release_memory_block; error = device_register(memory-dev); return error; @@ -669,7 +679,6 @@ int remove_memory_block(unsigned long no mem_remove_simple_file(mem, phys_device); mem_remove_simple_file(mem, removable); unregister_memory(mem); - kfree(mem); } else kobject_put(mem-dev.kobj); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v4 8/13] memory-hotplug : check page type in get_page_bootmem
There is a possibility that get_page_bootmem() is called to the same page many times. So when get_page_bootmem is called to the same page, the function only increments page-_count. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- mm/memory_hotplug.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:01:02.070712487 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:01:12.586581077 +0900 @@ -95,10 +95,17 @@ static void release_memory_resource(stru static void get_page_bootmem(unsigned long info, struct page *page, unsigned long type) { - page-lru.next = (struct list_head *) type; - SetPagePrivate(page); - set_page_private(page, info); - atomic_inc(page-_count); + unsigned long page_type; + + page_type = (unsigned long) page-lru.next; + if (type MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE || + type MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE){ + page-lru.next = (struct list_head *) type; + SetPagePrivate(page); + set_page_private(page, info); + atomic_inc(page-_count); + } else + atomic_inc(page-_count); } /* reference to __meminit __free_pages_bootmem is valid ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
mpc85xx_edac.c: Should the mpc85xx_l2_isr be shared irqs?
Hi All, I detected below error when booting p1021mds after enabled EDAC feature: EDAC MC: Ver: 2.1.0 Jul 17 2012 Freescale(R) MPC85xx EDAC driver, (C) 2006 Montavista Software EDAC MC0: Giving out device to 'MPC85xx_edac' 'mpc85xx_mc_err': DEV mpc85xx_mc_e rr IRQ 45/[EDAC] MC err: IRQF_DISABLED is not guaranteed on shared IRQs MPC85xx_edac acquired irq 45 for MC MPC85xx_edac MC err registered EDAC DEVICE0: Giving out device to module 'MPC85xx_edac' controller 'mpc85xx_l2_ err': DEV 'mpc85xx_l2_err' (INTERRUPT) mpc85xx_l2_err_probe: Unable to requiest irq 45 for MPC85xx L2 err Then kernel hang. When request irq for l2-cache, since it share the same irq with memory controller, I think the code should be: --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c @@ -577,7 +577,7 @@ static int __devinit mpc85xx_l2_err_probe(struct of_device *op, if (edac_op_state == EDAC_OPSTATE_INT) { pdata-irq = irq_of_parse_and_map(op-node, 0); res = devm_request_irq(op-dev, pdata-irq, - mpc85xx_l2_isr, IRQF_DISABLED, + mpc85xx_l2_isr, IRQF_DISABLED | IRQF_SHARED, [EDAC] L2 err, edac_dev); if (res 0) { printk(KERN_ERR Thanks, Xufeng Zhang ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Where can i find patches for Freescale MPC5125 Tower?
Hello, We have bought these evaluation boards for MPC5125 from Freescale. We did receive the linux source code for this device. But i have noticed that there are some patches available for many files. How do i get these patch files? Any help on this will be greatly appreciated. Support for Freescale is NONE. I saw the patch related info here... Thanks in advance, Mahesh. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v4 9/13] memory-hotplug : move register_page_bootmem_info_node and put_page_bootmem for sparse-vmemmap
For implementing register_page_bootmem_info_node of sparse-vmemmap, register_page_bootmem_info_node and put_page_bootmem are moved to memory_hotplug.c CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- include/linux/memory_hotplug.h |9 - mm/memory_hotplug.c|8 ++-- 2 files changed, 6 insertions(+), 11 deletions(-) Index: linux-3.5-rc6/include/linux/memory_hotplug.h === --- linux-3.5-rc6.orig/include/linux/memory_hotplug.h 2012-07-18 18:00:40.461982690 +0900 +++ linux-3.5-rc6/include/linux/memory_hotplug.h2012-07-18 18:01:24.217435670 +0900 @@ -160,17 +160,8 @@ static inline void arch_refresh_nodedata #endif /* CONFIG_NUMA */ #endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ -#ifdef CONFIG_SPARSEMEM_VMEMMAP -static inline void register_page_bootmem_info_node(struct pglist_data *pgdat) -{ -} -static inline void put_page_bootmem(struct page *page) -{ -} -#else extern void register_page_bootmem_info_node(struct pglist_data *pgdat); extern void put_page_bootmem(struct page *page); -#endif /* * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:01:12.586581077 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:01:24.221435622 +0900 @@ -91,7 +91,6 @@ static void release_memory_resource(stru } #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE -#ifndef CONFIG_SPARSEMEM_VMEMMAP static void get_page_bootmem(unsigned long info, struct page *page, unsigned long type) { @@ -127,6 +126,7 @@ void __ref put_page_bootmem(struct page } +#ifndef CONFIG_SPARSEMEM_VMEMMAP static void register_page_bootmem_info_section(unsigned long start_pfn) { unsigned long *usemap, mapsize, section_nr, i; @@ -163,6 +163,11 @@ static void register_page_bootmem_info_s get_page_bootmem(section_nr, page, MIX_SECTION_INFO); } +#else +static inline void register_page_bootmem_info_section(unsigned long start_pfn) +{ +} +#endif void register_page_bootmem_info_node(struct pglist_data *pgdat) { @@ -198,7 +203,6 @@ void register_page_bootmem_info_node(str register_page_bootmem_info_section(pfn); } -#endif /* !CONFIG_SPARSEMEM_VMEMMAP */ static void grow_zone_span(struct zone *zone, unsigned long start_pfn, unsigned long end_pfn) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v4 10/13] memory-hotplug : implement register_page_bootmem_info_section of sparse-vmemmap
For removing memmap region of sparse-vmemmap which is allocated bootmem, memmap region of sparse-vmemmap needs to be registered by get_page_bootmem(). So the patch searches pages of virtual mapping and registers the pages by get_page_bootmem(). CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- arch/x86/mm/init_64.c | 52 + include/linux/memory_hotplug.h |2 + include/linux/mm.h |3 +- mm/memory_hotplug.c| 23 +++--- 4 files changed, 76 insertions(+), 4 deletions(-) Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:01:24.221435622 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:01:28.156386427 +0900 @@ -91,8 +91,8 @@ static void release_memory_resource(stru } #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE -static void get_page_bootmem(unsigned long info, struct page *page, -unsigned long type) +void get_page_bootmem(unsigned long info, struct page *page, + unsigned long type) { unsigned long page_type; @@ -164,8 +164,25 @@ static void register_page_bootmem_info_s } #else -static inline void register_page_bootmem_info_section(unsigned long start_pfn) +static void register_page_bootmem_info_section(unsigned long start_pfn) { + unsigned long mapsize, section_nr; + struct mem_section *ms; + struct page *page, *memmap; + + if (!pfn_valid(start_pfn)) + return; + + section_nr = pfn_to_section_nr(start_pfn); + ms = __nr_to_section(section_nr); + + memmap = sparse_decode_mem_map(ms-section_mem_map, section_nr); + + page = virt_to_page(memmap); + mapsize = sizeof(struct page) * PAGES_PER_SECTION; + mapsize = PAGE_ALIGN(mapsize) PAGE_SHIFT; + + register_page_bootmem_memmap(section_nr, memmap, PAGES_PER_SECTION); } #endif Index: linux-3.5-rc6/include/linux/mm.h === --- linux-3.5-rc6.orig/include/linux/mm.h 2012-07-18 17:59:51.225598230 +0900 +++ linux-3.5-rc6/include/linux/mm.h2012-07-18 18:01:28.161386365 +0900 @@ -1586,7 +1586,8 @@ int vmemmap_populate_basepages(struct pa unsigned long pages, int node); int vmemmap_populate(struct page *start_page, unsigned long pages, int node); void vmemmap_populate_print_last(void); - +void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, + unsigned long size); enum mf_flags { MF_COUNT_INCREASED = 1 0, Index: linux-3.5-rc6/arch/x86/mm/init_64.c === --- linux-3.5-rc6.orig/arch/x86/mm/init_64.c2012-07-18 17:59:51.221598278 +0900 +++ linux-3.5-rc6/arch/x86/mm/init_64.c 2012-07-18 18:01:28.169386264 +0900 @@ -978,6 +978,58 @@ vmemmap_populate(struct page *start_page return 0; } +void register_page_bootmem_memmap(unsigned long section_nr, + struct page *start_page, unsigned long size) +{ + unsigned long addr = (unsigned long)start_page; + unsigned long end = (unsigned long)(start_page + size); + unsigned long next; + pgd_t *pgd; + pud_t *pud; + pmd_t *pmd; + + for (; addr end; addr = next) { + pte_t *pte = NULL; + + pgd = pgd_offset_k(addr); + if (pgd_none(*pgd)) { + next = (addr + PAGE_SIZE) PAGE_MASK; + continue; + } + get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO); + + pud = pud_offset(pgd, addr); + if (pud_none(*pud)) { + next = (addr + PAGE_SIZE) PAGE_MASK; + continue; + } + get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO); + + if (!cpu_has_pse) { + next = (addr + PAGE_SIZE) PAGE_MASK; + pmd = pmd_offset(pud, addr); + if (pmd_none(*pmd)) + continue; + get_page_bootmem(section_nr, pmd_page(*pmd), +MIX_SECTION_INFO); + + pte = pte_offset_kernel(pmd, addr); + if (pte_none(*pte)) +
[RFC PATCH v4 11/13] memory-hotplug : free memmap of sparse-vmemmap
All pages of virtual mapping in removed memory cannot be freed, since some pages used as PGD/PUD includes not only removed memory but also other memory. So the patch checks whether page can be freed or not. How to check whether page can be freed or not? 1. When removing memory, the page structs of the revmoved memory are filled with 0FD. 2. All page structs are filled with 0xFD on PT/PMD, PT/PMD can be cleared. In this case, the page used as PT/PMD can be freed. Applying patch, __remove_section() of CONFIG_SPARSEMEM_VMEMMAP is integrated into one. So __remove_section() of CONFIG_SPARSEMEM_VMEMMAP is deleted. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- arch/x86/mm/init_64.c | 121 ++ include/linux/mm.h|2 mm/memory_hotplug.c | 19 --- mm/sparse.c |5 +- 4 files changed, 128 insertions(+), 19 deletions(-) Index: linux-3.5-rc6/include/linux/mm.h === --- linux-3.5-rc6.orig/include/linux/mm.h 2012-07-18 18:01:28.0 +0900 +++ linux-3.5-rc6/include/linux/mm.h2012-07-18 18:03:05.551168773 +0900 @@ -1588,6 +1588,8 @@ int vmemmap_populate(struct page *start_ void vmemmap_populate_print_last(void); void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, unsigned long size); +void vmemmap_kfree(struct page *memmpa, unsigned long nr_pages); +void vmemmap_free_bootmem(struct page *memmpa, unsigned long nr_pages); enum mf_flags { MF_COUNT_INCREASED = 1 0, Index: linux-3.5-rc6/mm/sparse.c === --- linux-3.5-rc6.orig/mm/sparse.c 2012-07-18 17:59:25.0 +0900 +++ linux-3.5-rc6/mm/sparse.c 2012-07-18 18:03:05.553168749 +0900 @@ -614,12 +614,13 @@ static inline struct page *kmalloc_secti /* This will make the necessary allocations eventually. */ return sparse_mem_map_populate(pnum, nid); } -static void __kfree_section_memmap(struct page *memmap, unsigned long nr_pages) +static void __kfree_section_memmap(struct page *page, unsigned long nr_pages) { - return; /* XXX: Not implemented yet */ + vmemmap_kfree(page, nr_pages); } static void free_map_bootmem(struct page *page, unsigned long nr_pages) { + vmemmap_free_bootmem(page, nr_pages); } #else static struct page *__kmalloc_section_memmap(unsigned long nr_pages) Index: linux-3.5-rc6/arch/x86/mm/init_64.c === --- linux-3.5-rc6.orig/arch/x86/mm/init_64.c2012-07-18 18:01:28.0 +0900 +++ linux-3.5-rc6/arch/x86/mm/init_64.c 2012-07-18 18:03:05.564168611 +0900 @@ -978,6 +978,127 @@ vmemmap_populate(struct page *start_page return 0; } +#define PAGE_INUSE 0xFD + +unsigned long find_and_clear_pte_page(unsigned long addr, unsigned long end, + struct page **pp, int *page_size) +{ + pgd_t *pgd; + pud_t *pud; + pmd_t *pmd; + pte_t *pte; + void *page_addr; + unsigned long next; + + *pp = NULL; + + pgd = pgd_offset_k(addr); + if (pgd_none(*pgd)) + return pgd_addr_end(addr, end); + + pud = pud_offset(pgd, addr); + if (pud_none(*pud)) + return pud_addr_end(addr,end); + + if (!cpu_has_pse) { + next = (addr + PAGE_SIZE) PAGE_MASK; + pmd = pmd_offset(pud, addr); + if (pmd_none(*pmd)) + return next; + + pte = pte_offset_kernel(pmd, addr); + if (pte_none(*pte)) + return next; + + *page_size = PAGE_SIZE; + *pp = pte_page(*pte); + } else { + next = pmd_addr_end(addr, end); + + pmd = pmd_offset(pud, addr); + if (pmd_none(*pmd)) + return next; + + *page_size = PMD_SIZE; + *pp = pmd_page(*pmd); + } + + /* +* Removed page structs are filled with 0xFD. +*/ + memset((void *)addr, PAGE_INUSE, next - addr); + + page_addr = page_address(*pp); + + /* +* Check the page is filled with 0xFD or not. +* memchr_inv() returns the address. In this case, we cannot +* clear PTE/PUD entry, since the page is used by other. +* So we cannot also free the page. +* +* memchr_inv() returns NULL. In this case, we
[RFC PATCH v4 12/13] memory-hotplug : add node_device_release
When calling unregister_node(), the function shows following message at device_release(). Device 'node2' does not have a release() function, it is broken and must be fixed. So the patch implements node_device_release() CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- drivers/base/node.c |7 +++ 1 file changed, 7 insertions(+) Index: linux-3.5-rc6/drivers/base/node.c === --- linux-3.5-rc6.orig/drivers/base/node.c 2012-07-18 18:24:29.191121066 +0900 +++ linux-3.5-rc6/drivers/base/node.c 2012-07-18 18:25:47.46983 +0900 @@ -252,6 +252,12 @@ static inline void hugetlb_register_node static inline void hugetlb_unregister_node(struct node *node) {} #endif +static void node_device_release(struct device *dev) +{ + struct node *node_dev = to_node(dev); + + memset(node_dev, 0, sizeof(struct node)); +} /* * register_node - Setup a sysfs device for a node. @@ -265,6 +271,7 @@ int register_node(struct node *node, int node-dev.id = num; node-dev.bus = node_subsys; + node-dev.release = node_device_release; error = device_register(node-dev); if (!error){ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v4 13/13] memory-hotplug : remove sysfs file of node
The patch adds node_set_offline() and unregister_one_node() to remove_memory() for removing sysfs file of node. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- mm/memory_hotplug.c |5 + 1 file changed, 5 insertions(+) Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:25:11.036597977 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:25:54.860050109 +0900 @@ -1048,6 +1048,11 @@ int __ref remove_memory(int nid, u64 sta /* remove memmap entry */ firmware_map_remove(start, start + size, System RAM); + if (!node_present_pages(nid)) { + node_set_offline(nid); + unregister_one_node(nid); + } + __remove_pages(start PAGE_SHIFT, size PAGE_SHIFT); out: unlock_memory_hotplug(); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/13] memory-hotplug : check whether memory is present or not
At 07/18/2012 06:07 PM, Yasuaki Ishimatsu Wrote: If system supports memory hot-remove, online_pages() may online removed pages. So online_pages() need to check whether onlining pages are present or not. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- include/linux/mmzone.h | 21 + mm/memory_hotplug.c| 13 + 2 files changed, 34 insertions(+) Index: linux-3.5-rc6/include/linux/mmzone.h === --- linux-3.5-rc6.orig/include/linux/mmzone.h 2012-07-08 09:23:56.0 +0900 +++ linux-3.5-rc6/include/linux/mmzone.h 2012-07-17 16:10:21.588186145 +0900 @@ -1168,6 +1168,27 @@ void sparse_init(void); #define sparse_index_init(_sec, _nid) do {} while (0) #endif /* CONFIG_SPARSEMEM */ +#ifdef CONFIG_SPARSEMEM +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages) +{ + int i; + for (i = 0; i nr_pages; i++) { + if (pfn_present(pfn + 1)) + continue; + else { + unlock_memory_hotplug(); Why do you unlock memory hotplug here? The caller will do it. Thanks Wen Congyang + return -EINVAL; + } + } + return 0; +} +#else +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages) +{ + return 0; +} +#endif /* CONFIG_SPARSEMEM*/ + #ifdef CONFIG_NODES_SPAN_OTHER_NODES bool early_pfn_in_nid(unsigned long pfn, int nid); #else Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c2012-07-17 14:26:40.0 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-17 16:09:50.070580170 +0900 @@ -467,6 +467,19 @@ int __ref online_pages(unsigned long pfn struct memory_notify arg; lock_memory_hotplug(); + /* + * If system supports memory hot-remove, the memory may have been + * removed. So we check whether the memory has been removed or not. + * + * Note: When CONFIG_SPARSEMEM is defined, pfns_present() become + * effective. If CONFIG_SPARSEMEM is not defined, pfns_present() + * always returns 0. + */ + ret = pfns_present(pfn, nr_pages); + if (ret) { + unlock_memory_hotplug(); + return ret; + } arg.start_pfn = pfn; arg.nr_pages = nr_pages; arg.status_change_nid = -1; ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/13] memory-hotplug : check whether memory is present or not
Hi Wen, 2012/07/18 19:25, Wen Congyang wrote: At 07/18/2012 06:07 PM, Yasuaki Ishimatsu Wrote: If system supports memory hot-remove, online_pages() may online removed pages. So online_pages() need to check whether onlining pages are present or not. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- include/linux/mmzone.h | 21 + mm/memory_hotplug.c| 13 + 2 files changed, 34 insertions(+) Index: linux-3.5-rc6/include/linux/mmzone.h === --- linux-3.5-rc6.orig/include/linux/mmzone.h2012-07-08 09:23:56.0 +0900 +++ linux-3.5-rc6/include/linux/mmzone.h 2012-07-17 16:10:21.588186145 +0900 @@ -1168,6 +1168,27 @@ void sparse_init(void); #define sparse_index_init(_sec, _nid) do {} while (0) #endif /* CONFIG_SPARSEMEM */ +#ifdef CONFIG_SPARSEMEM +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages) +{ +int i; +for (i = 0; i nr_pages; i++) { +if (pfn_present(pfn + 1)) +continue; +else { +unlock_memory_hotplug(); Why do you unlock memory hotplug here? The caller will do it. Ah, you are right. In this case, the function should only return -EINVAL. Thansks, Yasuaki Ishimatsu Thanks Wen Congyang +return -EINVAL; +} +} +return 0; +} +#else +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages) +{ +return 0; +} +#endif /* CONFIG_SPARSEMEM*/ + #ifdef CONFIG_NODES_SPAN_OTHER_NODES bool early_pfn_in_nid(unsigned long pfn, int nid); #else Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-17 14:26:40.0 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c2012-07-17 16:09:50.070580170 +0900 @@ -467,6 +467,19 @@ int __ref online_pages(unsigned long pfn struct memory_notify arg; lock_memory_hotplug(); +/* + * If system supports memory hot-remove, the memory may have been + * removed. So we check whether the memory has been removed or not. + * + * Note: When CONFIG_SPARSEMEM is defined, pfns_present() become + * effective. If CONFIG_SPARSEMEM is not defined, pfns_present() + * always returns 0. + */ +ret = pfns_present(pfn, nr_pages); +if (ret) { +unlock_memory_hotplug(); +return ret; +} arg.start_pfn = pfn; arg.nr_pages = nr_pages; arg.status_change_nid = -1; ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC PATCH v4 4/13] memory-hotplug : remove /sys/firmware/memmap/X sysfs
At 07/18/2012 06:09 PM, Yasuaki Ishimatsu Wrote: When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type} sysfs files are created. But there is no code to remove these files. The patch implements the function to remove them. Note : The code does not free firmware_map_entry since there is no way to free memory which is allocated by bootmem. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- drivers/firmware/memmap.c| 78 ++- include/linux/firmware-map.h |6 +++ mm/memory_hotplug.c |9 +++- 3 files changed, 90 insertions(+), 3 deletions(-) Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c2012-07-18 17:20:05.670024283 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 17:51:03.933189930 +0900 @@ -1012,9 +1012,9 @@ int offline_memory(u64 start, u64 size) return offline_pages(start_pfn, end_pfn, 120 * HZ); } -int remove_memory(int nid, u64 start, u64 size) +int __ref remove_memory(int nid, u64 start, u64 size) { - int ret = -EBUSY; + int ret = 0; lock_memory_hotplug(); /* * The memory might become online by other task, even if you offine it. @@ -1025,8 +1025,13 @@ int remove_memory(int nid, u64 start, u6 because the memmory range is online\n, start, start + size); ret = -EAGAIN; + goto out; } + /* remove memmap entry */ + firmware_map_remove(start, start + size, System RAM); + +out: unlock_memory_hotplug(); return ret; Index: linux-3.5-rc6/include/linux/firmware-map.h === --- linux-3.5-rc6.orig/include/linux/firmware-map.h 2012-07-18 17:19:37.007382563 +0900 +++ linux-3.5-rc6/include/linux/firmware-map.h2012-07-18 17:42:20.804730245 +0900 @@ -25,6 +25,7 @@ int firmware_map_add_early(u64 start, u64 end, const char *type); int firmware_map_add_hotplug(u64 start, u64 end, const char *type); +int firmware_map_remove(u64 start, u64 end, const char *type); #else /* CONFIG_FIRMWARE_MEMMAP */ @@ -38,6 +39,11 @@ static inline int firmware_map_add_hotpl return 0; } +static inline int firmware_map_remove(u64 start, u64 end, const char *type) +{ + return 0; +} + #endif /* CONFIG_FIRMWARE_MEMMAP */ #endif /* _LINUX_FIRMWARE_MAP_H */ Index: linux-3.5-rc6/drivers/firmware/memmap.c === --- linux-3.5-rc6.orig/drivers/firmware/memmap.c 2012-07-18 17:19:43.618300182 +0900 +++ linux-3.5-rc6/drivers/firmware/memmap.c 2012-07-18 17:42:20.846729721 +0900 @@ -21,6 +21,7 @@ #include linux/types.h #include linux/bootmem.h #include linux/slab.h +#include linux/mm.h /* * Data types -- @@ -79,7 +80,22 @@ static const struct sysfs_ops memmap_att .show = memmap_attr_show, }; +#define to_memmap_entry(obj) container_of(obj, struct firmware_map_entry, kobj) + +static void release_firmware_map_entry(struct kobject *kobj) +{ + struct firmware_map_entry *entry = to_memmap_entry(kobj); + struct page *page; + + page = virt_to_page(entry); + if (PageSlab(page) || PageCompound(page)) + kfree(entry); IIRC, this function's implementation is changed. Why do you do it? If PageCompound(page), should we check page-first_page's flags? Thanks Wen Congyang + + /* There is no way to free memory allocated from bootmem*/ +} + static struct kobj_type memmap_ktype = { + .release= release_firmware_map_entry, .sysfs_ops = memmap_attr_ops, .default_attrs = def_attrs, }; @@ -123,6 +139,16 @@ static int firmware_map_add_entry(u64 st return 0; } +/** + * firmware_map_remove_entry() - Does the real work to remove a firmware + * memmap entry. + * @entry: removed entry. + **/ +static inline void firmware_map_remove_entry(struct firmware_map_entry *entry) +{ + list_del(entry-list); +} + /* * Add memmap entry on sysfs */ @@ -144,6 +170,31 @@ static int add_sysfs_fw_map_entry(struct return 0; } +/* + * Remove memmap entry on sysfs + */ +static inline void remove_sysfs_fw_map_entry(struct firmware_map_entry *entry) +{ +
[PATCH RESEND] PPC Hardware Breakpoints: Fix incorrect pointer access
If arch_validate_hwbkpt_settings() fails, bp-ctx won't be valid and the kernel panics. Add a check to fix this. Reported-by: Edjunior Barbosa Machado emach...@linux.vnet.ibm.com Signed-off-by: Naveen N. Rao naveen.n@linux.vnet.ibm.com --- arch/powerpc/kernel/hw_breakpoint.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c index 2bc0584..f3a82dd 100644 --- a/arch/powerpc/kernel/hw_breakpoint.c +++ b/arch/powerpc/kernel/hw_breakpoint.c @@ -111,7 +111,7 @@ void arch_unregister_hw_breakpoint(struct perf_event *bp) * and the single_step_dabr_instruction(), then cleanup the breakpoint * restoration variables to prevent dangling pointers. */ - if (bp-ctx-task) + if (bp-ctx bp-ctx-task) bp-ctx-task-thread.last_hit_ubp = NULL; } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC PATCH v4 4/13] memory-hotplug : remove /sys/firmware/memmap/X sysfs
Hi Wen, 2012/07/18 19:33, Wen Congyang wrote: At 07/18/2012 06:09 PM, Yasuaki Ishimatsu Wrote: When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type} sysfs files are created. But there is no code to remove these files. The patch implements the function to remove them. Note : The code does not free firmware_map_entry since there is no way to free memory which is allocated by bootmem. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- drivers/firmware/memmap.c| 78 ++- include/linux/firmware-map.h |6 +++ mm/memory_hotplug.c |9 +++- 3 files changed, 90 insertions(+), 3 deletions(-) Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 17:20:05.670024283 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c2012-07-18 17:51:03.933189930 +0900 @@ -1012,9 +1012,9 @@ int offline_memory(u64 start, u64 size) return offline_pages(start_pfn, end_pfn, 120 * HZ); } -int remove_memory(int nid, u64 start, u64 size) +int __ref remove_memory(int nid, u64 start, u64 size) { -int ret = -EBUSY; +int ret = 0; lock_memory_hotplug(); /* * The memory might become online by other task, even if you offine it. @@ -1025,8 +1025,13 @@ int remove_memory(int nid, u64 start, u6 because the memmory range is online\n, start, start + size); ret = -EAGAIN; +goto out; } +/* remove memmap entry */ +firmware_map_remove(start, start + size, System RAM); + +out: unlock_memory_hotplug(); return ret; Index: linux-3.5-rc6/include/linux/firmware-map.h === --- linux-3.5-rc6.orig/include/linux/firmware-map.h 2012-07-18 17:19:37.007382563 +0900 +++ linux-3.5-rc6/include/linux/firmware-map.h 2012-07-18 17:42:20.804730245 +0900 @@ -25,6 +25,7 @@ int firmware_map_add_early(u64 start, u64 end, const char *type); int firmware_map_add_hotplug(u64 start, u64 end, const char *type); +int firmware_map_remove(u64 start, u64 end, const char *type); #else /* CONFIG_FIRMWARE_MEMMAP */ @@ -38,6 +39,11 @@ static inline int firmware_map_add_hotpl return 0; } +static inline int firmware_map_remove(u64 start, u64 end, const char *type) +{ +return 0; +} + #endif /* CONFIG_FIRMWARE_MEMMAP */ #endif /* _LINUX_FIRMWARE_MAP_H */ Index: linux-3.5-rc6/drivers/firmware/memmap.c === --- linux-3.5-rc6.orig/drivers/firmware/memmap.c 2012-07-18 17:19:43.618300182 +0900 +++ linux-3.5-rc6/drivers/firmware/memmap.c 2012-07-18 17:42:20.846729721 +0900 @@ -21,6 +21,7 @@ #include linux/types.h #include linux/bootmem.h #include linux/slab.h +#include linux/mm.h /* * Data types -- @@ -79,7 +80,22 @@ static const struct sysfs_ops memmap_att .show = memmap_attr_show, }; +#define to_memmap_entry(obj) container_of(obj, struct firmware_map_entry, kobj) + +static void release_firmware_map_entry(struct kobject *kobj) +{ +struct firmware_map_entry *entry = to_memmap_entry(kobj); +struct page *page; + +page = virt_to_page(entry); +if (PageSlab(page) || PageCompound(page)) +kfree(entry); IIRC, this function's implementation is changed. Why do you do it? If PageCompound(page), should we check page-first_page's flags? I forgot to write the change to change log. Jiang and Christoph discussed how to find the slab page: - https://lkml.org/lkml/2012/7/6/333 Then, Christoph proposed this method. So I changed it. Thanks, Yasuaki Ishimatsu Thanks Wen Congyang + +/* There is no way to free memory allocated from bootmem*/ +} + static struct kobj_type memmap_ktype = { +.release= release_firmware_map_entry, .sysfs_ops = memmap_attr_ops, .default_attrs = def_attrs, }; @@ -123,6 +139,16 @@ static int firmware_map_add_entry(u64 st return 0; } +/** + * firmware_map_remove_entry() - Does the real work to remove a firmware + * memmap entry. + * @entry: removed entry. + **/ +static inline void firmware_map_remove_entry(struct firmware_map_entry *entry) +{ +
Re: [PATCH v4 3/13] memory-hotplug : check whether memory is present or not
At 07/18/2012 06:07 PM, Yasuaki Ishimatsu Wrote: If system supports memory hot-remove, online_pages() may online removed pages. So online_pages() need to check whether onlining pages are present or not. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- include/linux/mmzone.h | 21 + mm/memory_hotplug.c| 13 + 2 files changed, 34 insertions(+) Index: linux-3.5-rc6/include/linux/mmzone.h === --- linux-3.5-rc6.orig/include/linux/mmzone.h 2012-07-08 09:23:56.0 +0900 +++ linux-3.5-rc6/include/linux/mmzone.h 2012-07-17 16:10:21.588186145 +0900 @@ -1168,6 +1168,27 @@ void sparse_init(void); #define sparse_index_init(_sec, _nid) do {} while (0) #endif /* CONFIG_SPARSEMEM */ +#ifdef CONFIG_SPARSEMEM +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages) +{ + int i; + for (i = 0; i nr_pages; i++) { + if (pfn_present(pfn + 1)) + continue; + else { + unlock_memory_hotplug(); + return -EINVAL; + } + } + return 0; +} +#else +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages) +{ + return 0; +} +#endif /* CONFIG_SPARSEMEM*/ + #ifdef CONFIG_NODES_SPAN_OTHER_NODES bool early_pfn_in_nid(unsigned long pfn, int nid); #else Index: linux-3.5-rc6/mm/memory_hotplug.c === --- linux-3.5-rc6.orig/mm/memory_hotplug.c2012-07-17 14:26:40.0 +0900 +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-17 16:09:50.070580170 +0900 @@ -467,6 +467,19 @@ int __ref online_pages(unsigned long pfn struct memory_notify arg; lock_memory_hotplug(); + /* + * If system supports memory hot-remove, the memory may have been + * removed. So we check whether the memory has been removed or not. + * + * Note: When CONFIG_SPARSEMEM is defined, pfns_present() become + * effective. If CONFIG_SPARSEMEM is not defined, pfns_present() + * always returns 0. + */ There is one space before tab in the comment. Thanks Wen Congyang + ret = pfns_present(pfn, nr_pages); + if (ret) { + unlock_memory_hotplug(); + return ret; + } arg.start_pfn = pfn; arg.nr_pages = nr_pages; arg.status_change_nid = -1; ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] of: require a match on all fields of of_device_id
On 07/17/2012 09:38 PM, Rob Herring wrote: On 07/17/2012 08:11 PM, Scott Wood wrote: Commit 107a84e61cdd3406c842a0e4be7efffd3a05dba6 (of: match by compatible property first) breaks the gianfar ethernet driver found on various Freescale PPC chips. You do know this is reverted, right? No, I didn't. I got it via Kumar's next branch, and saw that it was still in your fixes-for-grant branch, and didn't see any revert-related e-mail activity on the devicetree-discuss list about it. I now see that it was reverted directly in Linus's tree (I didn't see either the original or the revert in Linus's tree when I checked, but apparently I hadn't fetched that as recently as I thought). Here's my fix (untested) which is a bit simpler. I'm assuming if we care about which compatible string we are matching to, then we require name and type are blank and we only care about compatible strings. Any particular reason for making that assumption? We should be avoiding the need for .name or .type matching in new bindings, but this seems like unnecessarily inconsistent behavior. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 05/15] pci: resource assignment based on p2p alignment
On Tue, Jul 17, 2012 at 10:25 PM, Ram Pai linux...@us.ibm.com wrote: On Tue, Jul 17, 2012 at 11:14:51AM -0600, Bjorn Helgaas wrote: On Tue, Jul 17, 2012 at 4:38 AM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Tue, 2012-07-17 at 18:03 +0800, Ram Pai wrote: Lets say we passed that 'type' flag to size the minimum alignment constraints for that b_res. And window_alignment(bus, type) of your platform used that 'type' information to determine whether to use the alignment constraints of 32-bit window or 64-bit window. However, later when the b_res is actually allocated a resource, the pci_assign_resource() has no idea whether to allocate 32-bit window resource or 64-bit window resource, because the 'type' information is not captured anywhere in b_res. You would basically have a disconnect between what is sized and what is allocated. Unless offcourse you pass that 'type' to the b_res-flags, which is currently not the case. Right, we ideally would need the core to query the alignment once per apertures it tries as a candidate to allocate a given resource... but that's for later. For now we can probably live with giving out the max of the minimum alignment we support for M64 and our M32 segment size. We already know the aperture we're proposing to allocate from (the result of find_free_bus_resource()), don't we? What if we passed it to pcibios_window_alignment() along with the struct pci_bus *, e.g.: resource_size_t pcibios_window_alignment(struct pci_bus *bus, struct resource *window) Hmm..'struct resource *window' may not yet know which aperature it is allocated from. Will it? We are still in the sizing process, the allocation will be done much later. Of course, you're absolutely right; I had this backwards. In pbus_size_io/mem(), we do b_res = find_free_bus_resource(), so b_res is a bus resource that matches the desired type (IO/MEM). This resource represents an aperture of the upstream bridge leading to the bus. I was thinking that b_res-start would contain address information that the arch could use to decide alignment. But at this point, in pbus_size_io/mem(), we set b_res-start = min_align, so obviously b_res contains no information about the window base that will eventually be assigned. I think b_res is basically the *container* into which we'll eventually put the P2P aperture start/end, but here, we're using that container to hold the information about the size and alignment we need for that aperture. The fact that we deal with alignment in pbus_size_mem() and again in __pci_assign_resource() (via pcibios_align_resource) is confusing to me -- I don't have a clear idea of what sorts of alignment are done in each place. Could this powerpc alignment be done in pcibios_align_resource()? We do have the actual proposed address there, as well as the pci_dev. Bjorn ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] radeonfb: Add quirk for the graphics adapter in some JSxx
From: Tony Breeds t...@bakeyournoodle.com These devices are set to 640x480 by firmware, switch them to 800x600@60 so that the graphical installer can run on remote console. Reported by IBM during SLES10 SP2 beta testing: https://bugzilla.novell.com/show_bug.cgi?id=461002 LTC50817 Signed-off-by: Olaf Hering o...@aepfle.de diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c index 9261c91..5c23eac 100644 --- a/drivers/video/aty/radeon_monitor.c +++ b/drivers/video/aty/radeon_monitor.c @@ -730,6 +730,25 @@ static void radeon_videomode_to_var(struct fb_var_screeninfo *var, var-vmode = mode-vmode; } +#ifdef CONFIG_PPC_PSERIES +static int is_powerblade(const char *model) +{ + struct device_node *root; + const char* cp; + int len, l, rc = 0; + + root = of_find_node_by_path(/); + if (root model) { + l = strlen(model); + cp = of_get_property(root, model, len); + if (cp) + rc = memcmp(model, cp, min(len, l)) == 0; + of_node_put(root); + } + return rc; +} +#endif + /* * Build the modedb for head 1 (head 2 will come later), check panel infos * from either BIOS or EDID, and pick up the default mode @@ -865,6 +884,22 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_ has_default_mode = 1; } +#ifdef CONFIG_PPC_PSERIES + if (!has_default_mode ( + is_powerblade(IBM,8842) || /* JS20 */ + is_powerblade(IBM,8844) || /* JS21 */ + is_powerblade(IBM,7998) || /* JS12/JS21/JS22 */ + is_powerblade(IBM,0792) || /* QS21 */ + is_powerblade(IBM,0793)/* QS22 */ + )) { + printk(Falling back to 800x600 on JSxx hardware\n); + if (fb_find_mode(info-var, info, 800x600@60, +info-monspecs.modedb, +info-monspecs.modedb_len, NULL, 8) != 0) + has_default_mode = 1; + } +#endif + /* * Still no mode, let's pick up a default from the db */ -- 1.7.10.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] scsi/ibmvscsi: /sys/class/scsi_host/hostX/config doesn't show any information
From: Linda Xie lx...@us.ibm.com Expected result: It should show something like this: x1521p4:~ # cat /sys/class/scsi_host/host1/config PARTITIONNAME='x1521p4' NWSDNAME='X1521P4' HOSTNAME='X1521P4' DOMAINNAME='RCHLAND.IBM.COM' NAMESERVERS='9.10.244.100 9.10.244.200' Actual result: x1521p4:~ # cat /sys/class/scsi_host/host0/config x1521p4:~ # This patch changes the size of the buffer used for transfering config data to 4K. It was tested against 2.6.19-rc2 tree. Reported by IBM during SLES11 beta testing: https://bugzilla.novell.com/show_bug.cgi?id=439970 LTC49349 Signed-off-by: Olaf Hering o...@aepfle.de diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index e580aa4..1513ca8 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -93,6 +93,8 @@ static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT; static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2; static int fast_fail = 1; static int client_reserve = 1; +/* host data buffer size */ +#define HOST_BUFFER_SIZE 4096 static struct scsi_transport_template *ibmvscsi_transport_template; @@ -1666,7 +1668,7 @@ static ssize_t show_host_srp_version(struct device *dev, struct ibmvscsi_host_data *hostdata = shost_priv(shost); int len; - len = snprintf(buf, PAGE_SIZE, %s\n, + len = snprintf(buf, HOST_BUFFER_SIZE, %s\n, hostdata-madapter_info.srp_version); return len; } @@ -1687,7 +1689,7 @@ static ssize_t show_host_partition_name(struct device *dev, struct ibmvscsi_host_data *hostdata = shost_priv(shost); int len; - len = snprintf(buf, PAGE_SIZE, %s\n, + len = snprintf(buf, HOST_BUFFER_SIZE, %s\n, hostdata-madapter_info.partition_name); return len; } @@ -1708,7 +1710,7 @@ static ssize_t show_host_partition_number(struct device *dev, struct ibmvscsi_host_data *hostdata = shost_priv(shost); int len; - len = snprintf(buf, PAGE_SIZE, %d\n, + len = snprintf(buf, HOST_BUFFER_SIZE, %d\n, hostdata-madapter_info.partition_number); return len; } @@ -1728,7 +1730,7 @@ static ssize_t show_host_mad_version(struct device *dev, struct ibmvscsi_host_data *hostdata = shost_priv(shost); int len; - len = snprintf(buf, PAGE_SIZE, %d\n, + len = snprintf(buf, HOST_BUFFER_SIZE, %d\n, hostdata-madapter_info.mad_version); return len; } @@ -1748,7 +1750,7 @@ static ssize_t show_host_os_type(struct device *dev, struct ibmvscsi_host_data *hostdata = shost_priv(shost); int len; - len = snprintf(buf, PAGE_SIZE, %d\n, hostdata-madapter_info.os_type); + len = snprintf(buf, HOST_BUFFER_SIZE, %d\n, hostdata-madapter_info.os_type); return len; } @@ -1767,7 +1769,7 @@ static ssize_t show_host_config(struct device *dev, struct ibmvscsi_host_data *hostdata = shost_priv(shost); /* returns null-terminated host config data */ - if (ibmvscsi_do_host_config(hostdata, buf, PAGE_SIZE) == 0) + if (ibmvscsi_do_host_config(hostdata, buf, HOST_BUFFER_SIZE) == 0) return strlen(buf); else return 0; -- 1.7.10.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] scsi/ibmvscsi: add module alias for ibmvscsic
From: Olaf Hering o...@aepfle.de The driver is named ibmvscsic, at runtime it its name is advertised as ibmvscsi. For this reason mkinitrd wont pickup the driver properly. Reported by IBM during SLES11 beta testing: https://bugzilla.novell.com/show_bug.cgi?id=459933 LTC50724 Signed-off-by: Olaf Hering o...@aepfle.de diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 3a6c474..e580aa4 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -100,6 +100,9 @@ static struct scsi_transport_template *ibmvscsi_transport_template; static struct ibmvscsi_ops *ibmvscsi_ops; +/* The driver is named ibmvscsic, map ibmvscsi to module name */ +#define IBMVSCSI_NAME ibmvscsi +MODULE_ALIAS(IBMVSCSI_NAME); MODULE_DESCRIPTION(IBM Virtual SCSI); MODULE_AUTHOR(Dave Boutcher); MODULE_LICENSE(GPL); @@ -1796,7 +1799,7 @@ static struct device_attribute *ibmvscsi_attrs[] = { static struct scsi_host_template driver_template = { .module = THIS_MODULE, .name = IBM POWER Virtual SCSI Adapter IBMVSCSI_VERSION, - .proc_name = ibmvscsi, + .proc_name = IBMVSCSI_NAME, .queuecommand = ibmvscsi_queuecommand, .eh_abort_handler = ibmvscsi_eh_abort_handler, .eh_device_reset_handler = ibmvscsi_eh_device_reset_handler, @@ -1936,7 +1939,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) } hostdata-work_thread = kthread_run(ibmvscsi_work, hostdata, %s_%d, - ibmvscsi, host-host_no); + IBMVSCSI_NAME, host-host_no); if (IS_ERR(hostdata-work_thread)) { dev_err(vdev-dev, couldn't initialize kthread. rc=%ld\n, @@ -2061,7 +2064,7 @@ static struct vio_driver ibmvscsi_driver = { .probe = ibmvscsi_probe, .remove = ibmvscsi_remove, .get_desired_dma = ibmvscsi_get_desired_dma, - .name = ibmvscsi, + .name = IBMVSCSI_NAME, .pm = ibmvscsi_pm_ops, }; -- 1.7.10.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] MIPS: fix bug.h MIPS build regression
On Wed, 18 Jul 2012 10:35:46 +0200 Geert Uytterhoeven ge...@linux-m68k.org wrote: On Mon, Jul 16, 2012 at 9:27 PM, Geert Uytterhoeven ge...@linux-m68k.org wrote: On Fri, Jun 22, 2012 at 7:54 PM, David Daney dda...@caviumnetworks.com wrote: On 06/20/2012 09:12 AM, Ralf Baechle wrote: On Wed, Jun 20, 2012 at 03:27:59PM +0900, Yoichi Yuasa wrote: Commit: 3777808873b0c49c5cf27e44c948dfb02675d578 breaks all MIPS builds. Thanks, fix applied. Where was it applied? It doesn't show up in linux-next for 20120622, which is where it is needed. It's also desperately needed in mainline for 3.5. Ralf? Andrew? This prevents any green MIPS builds. The patch is already in linux-next via Ralf's tree. Perhaps he nodded off - I'll send it at Linus right now. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] mlx4_en: map entire pages to increase throughput
On 7/16/2012 11:57 PM, Thadeu Lima de Souza Cascardo wrote: On Mon, Jul 16, 2012 at 11:43:33PM +0300, Or Gerlitz wrote: TCP_STREAM from this setup before the patch would be good to know as well Does the stream test that I did with uperf using messages of 64000 bytes fit? netperf/TCP_STREAM is very common and it would help to better compare the numbers you get on your systems before/after the patch which runs done here. As for review for the patch itself and the related discussion, Yevgeny Petrilin should be looking on your patch, he'll be in by early next week. Or. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc/ftrace: Trace function graph entry before updating index
As Colin Cross ported my x86 change to ARM, he also pointed out that powerpc is also behind in this fix. The commit 722b3c746953 ftrace/graph: Trace function entry before updating index fixes an issue with function graph tracing for x86, where if the called entry function decides not to trace interrupts, it can fail the check if an interrupt comes in just after the curr_ret_stack is updated. The solution is to call the entry function first, then update the curr_ret_stack if the entry function wants to be traced. Cc: Colin Cross ccr...@android.com Signed-off-by: Steven Rostedt rost...@goodmis.org diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 91b46b7..1fb7856 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c @@ -630,18 +630,17 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) return; } - if (ftrace_push_return_trace(old, self_addr, trace.depth, 0) == -EBUSY) { - *parent = old; - return; - } - trace.func = self_addr; + trace.depth = current-curr_ret_stack + 1; /* Only trace if the calling function expects to */ if (!ftrace_graph_entry(trace)) { - current-curr_ret_stack--; *parent = old; + return; } + + if (ftrace_push_return_trace(old, self_addr, trace.depth, 0) == -EBUSY) + *parent = old; } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] radeonfb: Add quirk for the graphics adapter in some JSxx
On Thu, Jul 19, Jingoo Han wrote: On Thursday, July 19, 2012 1:49 AM, o...@aepfle.de wrote: From: Tony Breeds t...@bakeyournoodle.com These devices are set to 640x480 by firmware, switch them to 800x600@60 so that the graphical installer can run on remote console. Reported by IBM during SLES10 SP2 beta testing: https://bugzilla.novell.com/show_bug.cgi?id=461002 LTC50817 Signed-off-by: Olaf Hering o...@aepfle.de If the author is Tony Breeds, please add 'Signed-off-by: Tony Breeds t...@bakeyournoodle.com'. He provided the initial version of the change, but did not add his tag back in 2009. Tony, perhaps you can do that now? Olaf ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] radeonfb: Add quirk for the graphics adapter in some JSxx
On Thursday, July 19, 2012 1:49 AM, o...@aepfle.de wrote: From: Tony Breeds t...@bakeyournoodle.com These devices are set to 640x480 by firmware, switch them to 800x600@60 so that the graphical installer can run on remote console. Reported by IBM during SLES10 SP2 beta testing: https://bugzilla.novell.com/show_bug.cgi?id=461002 LTC50817 Signed-off-by: Olaf Hering o...@aepfle.de If the author is Tony Breeds, please add 'Signed-off-by: Tony Breeds t...@bakeyournoodle.com'. Best regards, Jingoo Han diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c index 9261c91..5c23eac 100644 --- a/drivers/video/aty/radeon_monitor.c +++ b/drivers/video/aty/radeon_monitor.c @@ -730,6 +730,25 @@ static void radeon_videomode_to_var(struct fb_var_screeninfo *var, var-vmode = mode-vmode; } +#ifdef CONFIG_PPC_PSERIES +static int is_powerblade(const char *model) +{ + struct device_node *root; + const char* cp; + int len, l, rc = 0; + + root = of_find_node_by_path(/); + if (root model) { + l = strlen(model); + cp = of_get_property(root, model, len); + if (cp) + rc = memcmp(model, cp, min(len, l)) == 0; + of_node_put(root); + } + return rc; +} +#endif + /* * Build the modedb for head 1 (head 2 will come later), check panel infos * from either BIOS or EDID, and pick up the default mode @@ -865,6 +884,22 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_ has_default_mode = 1; } +#ifdef CONFIG_PPC_PSERIES + if (!has_default_mode ( + is_powerblade(IBM,8842) || /* JS20 */ + is_powerblade(IBM,8844) || /* JS21 */ + is_powerblade(IBM,7998) || /* JS12/JS21/JS22 */ + is_powerblade(IBM,0792) || /* QS21 */ + is_powerblade(IBM,0793)/* QS22 */ + )) { + printk(Falling back to 800x600 on JSxx hardware\n); + if (fb_find_mode(info-var, info, 800x600@60, + info-monspecs.modedb, + info-monspecs.modedb_len, NULL, 8) != 0) + has_default_mode = 1; + } +#endif + /* * Still no mode, let's pick up a default from the db */ -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-fbdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] radeonfb: Add quirk for the graphics adapter in some JSxx
On Wed, Jul 18, 2012 at 06:49:04PM +0200, o...@aepfle.de wrote: Thanks for following this up. From: Tony Breeds t...@bakeyournoodle.com These devices are set to 640x480 by firmware, switch them to 800x600@60 so that the graphical installer can run on remote console. Reported by IBM during SLES10 SP2 beta testing: https://bugzilla.novell.com/show_bug.cgi?id=461002 LTC50817 Signed-off-by: Olaf Hering o...@aepfle.de Signed-off-by: Tony Breeds t...@bakeyournoodle.com Yours Tony pgpIfaSfwpVu2.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC PATCH v4 11/13] memory-hotplug : free memmap of sparse-vmemmap
At 07/18/2012 06:16 PM, Yasuaki Ishimatsu Wrote: All pages of virtual mapping in removed memory cannot be freed, since some pages used as PGD/PUD includes not only removed memory but also other memory. So the patch checks whether page can be freed or not. How to check whether page can be freed or not? 1. When removing memory, the page structs of the revmoved memory are filled with 0FD. 2. All page structs are filled with 0xFD on PT/PMD, PT/PMD can be cleared. In this case, the page used as PT/PMD can be freed. Applying patch, __remove_section() of CONFIG_SPARSEMEM_VMEMMAP is integrated into one. So __remove_section() of CONFIG_SPARSEMEM_VMEMMAP is deleted. CC: David Rientjes rient...@google.com CC: Jiang Liu liu...@gmail.com CC: Len Brown len.br...@intel.com CC: Benjamin Herrenschmidt b...@kernel.crashing.org CC: Paul Mackerras pau...@samba.org CC: Christoph Lameter c...@linux.com Cc: Minchan Kim minchan@gmail.com CC: Andrew Morton a...@linux-foundation.org CC: KOSAKI Motohiro kosaki.motoh...@jp.fujitsu.com CC: Wen Congyang we...@cn.fujitsu.com Signed-off-by: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com --- arch/x86/mm/init_64.c | 121 ++ include/linux/mm.h|2 mm/memory_hotplug.c | 19 --- mm/sparse.c |5 +- 4 files changed, 128 insertions(+), 19 deletions(-) Index: linux-3.5-rc6/include/linux/mm.h === --- linux-3.5-rc6.orig/include/linux/mm.h 2012-07-18 18:01:28.0 +0900 +++ linux-3.5-rc6/include/linux/mm.h 2012-07-18 18:03:05.551168773 +0900 @@ -1588,6 +1588,8 @@ int vmemmap_populate(struct page *start_ void vmemmap_populate_print_last(void); void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, unsigned long size); +void vmemmap_kfree(struct page *memmpa, unsigned long nr_pages); +void vmemmap_free_bootmem(struct page *memmpa, unsigned long nr_pages); enum mf_flags { MF_COUNT_INCREASED = 1 0, Index: linux-3.5-rc6/mm/sparse.c === --- linux-3.5-rc6.orig/mm/sparse.c2012-07-18 17:59:25.0 +0900 +++ linux-3.5-rc6/mm/sparse.c 2012-07-18 18:03:05.553168749 +0900 @@ -614,12 +614,13 @@ static inline struct page *kmalloc_secti /* This will make the necessary allocations eventually. */ return sparse_mem_map_populate(pnum, nid); } -static void __kfree_section_memmap(struct page *memmap, unsigned long nr_pages) +static void __kfree_section_memmap(struct page *page, unsigned long nr_pages) { - return; /* XXX: Not implemented yet */ + vmemmap_kfree(page, nr_pages); } static void free_map_bootmem(struct page *page, unsigned long nr_pages) { + vmemmap_free_bootmem(page, nr_pages); } #else static struct page *__kmalloc_section_memmap(unsigned long nr_pages) Index: linux-3.5-rc6/arch/x86/mm/init_64.c === --- linux-3.5-rc6.orig/arch/x86/mm/init_64.c 2012-07-18 18:01:28.0 +0900 +++ linux-3.5-rc6/arch/x86/mm/init_64.c 2012-07-18 18:03:05.564168611 +0900 @@ -978,6 +978,127 @@ vmemmap_populate(struct page *start_page return 0; } +#define PAGE_INUSE 0xFD + +unsigned long find_and_clear_pte_page(unsigned long addr, unsigned long end, + struct page **pp, int *page_size) +{ + pgd_t *pgd; + pud_t *pud; + pmd_t *pmd; + pte_t *pte; + void *page_addr; + unsigned long next; + + *pp = NULL; + + pgd = pgd_offset_k(addr); + if (pgd_none(*pgd)) + return pgd_addr_end(addr, end); + + pud = pud_offset(pgd, addr); + if (pud_none(*pud)) + return pud_addr_end(addr,end); + + if (!cpu_has_pse) { + next = (addr + PAGE_SIZE) PAGE_MASK; + pmd = pmd_offset(pud, addr); + if (pmd_none(*pmd)) + return next; + + pte = pte_offset_kernel(pmd, addr); + if (pte_none(*pte)) + return next; + + *page_size = PAGE_SIZE; + *pp = pte_page(*pte); + } else { + next = pmd_addr_end(addr, end); + + pmd = pmd_offset(pud, addr); + if (pmd_none(*pmd)) + return next; + + *page_size = PMD_SIZE; + *pp = pmd_page(*pmd); + } + + /* + * Removed page structs are filled with 0xFD. + */ + memset((void *)addr, PAGE_INUSE, next - addr); + + page_addr = page_address(*pp); + + /* + * Check the page is filled with 0xFD or not. + * memchr_inv() returns the address. In this case, we cannot + * clear PTE/PUD entry, since the page is used by other. + * So we cannot