* [RFC PATCH v2 5/13] memory-hotplug : does not release memory region in PAGES_PER_SECTION chunks
From: Yasuaki Ishimatsu @ 2012-07-03 5:58 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, paulus, minchan.kim, kosaki.motohiro, rientjes, cl,
akpm, liuj97
In-Reply-To: <4FF287C3.4030901@jp.fujitsu.com>
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 <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@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-rc4/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc4.orig/mm/memory_hotplug.c 2012-07-03 14:22:03.549198802 +0900
+++ linux-3.5-rc4/mm/memory_hotplug.c 2012-07-03 14:22:05.919169458 +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-rc4/arch/powerpc/platforms/pseries/hotplug-memory.c
===================================================================
--- linux-3.5-rc4.orig/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-03 14:21:45.641422678
+0900
+++ linux-3.5-rc4/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-03 14:22:05.920169437 +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
^ permalink raw reply
* [RFC PATCH v2 4/13] memory-hotplug : remove /sys/firmware/memmap/X sysfs
From: Yasuaki Ishimatsu @ 2012-07-03 5:56 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, paulus, minchan.kim, kosaki.motohiro, rientjes, cl,
akpm, liuj97
In-Reply-To: <4FF287C3.4030901@jp.fujitsu.com>
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 <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
drivers/firmware/memmap.c | 70 +++++++++++++++++++++++++++++++++++++++++++
include/linux/firmware-map.h | 6 +++
mm/memory_hotplug.c | 6 +++
3 files changed, 81 insertions(+), 1 deletion(-)
Index: linux-3.5-rc4/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc4.orig/mm/memory_hotplug.c 2012-07-03 14:22:00.190240794 +0900
+++ linux-3.5-rc4/mm/memory_hotplug.c 2012-07-03 14:22:03.549198802 +0900
@@ -661,7 +661,11 @@ EXPORT_SYMBOL_GPL(add_memory);
int remove_memory(int nid, u64 start, u64 size)
{
- return -EBUSY;
+ lock_memory_hotplug();
+ /* remove memmap entry */
+ firmware_map_remove(start, start + size - 1, "System RAM");
+ unlock_memory_hotplug();
+ return 0;
}
EXPORT_SYMBOL_GPL(remove_memory);
Index: linux-3.5-rc4/include/linux/firmware-map.h
===================================================================
--- linux-3.5-rc4.orig/include/linux/firmware-map.h 2012-07-03 14:21:45.766421116 +0900
+++ linux-3.5-rc4/include/linux/firmware-map.h 2012-07-03 14:22:03.550198789 +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-rc4/drivers/firmware/memmap.c
===================================================================
--- linux-3.5-rc4.orig/drivers/firmware/memmap.c 2012-07-03 14:21:45.761421180 +0900
+++ linux-3.5-rc4/drivers/firmware/memmap.c 2012-07-03 14:22:03.569198549 +0900
@@ -79,7 +79,16 @@ static const struct sysfs_ops memmap_att
.show = memmap_attr_show,
};
+static void release_firmware_map_entry(struct kobject *kobj)
+{
+ /*
+ * FIXME : There is no idea.
+ * How to free the entry which allocated bootmem?
+ */
+}
+
static struct kobj_type memmap_ktype = {
+ .release = release_firmware_map_entry,
.sysfs_ops = &memmap_attr_ops,
.default_attrs = def_attrs,
};
@@ -123,6 +132,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 +163,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 ((entry->start == start) && (entry->end == end) &&
+ (!strcmp(entry->type, type)))
+ return entry;
+
+ return NULL;
+}
+
/**
* firmware_map_add_hotplug() - Adds a firmware mapping entry when we do
* memory hotplug.
@@ -196,6 +240,32 @@ int __init firmware_map_add_early(u64 st
return firmware_map_add_entry(start, end, type, entry);
}
+/**
+ * firmware_map_remove() - remove a firmware mapping entry
+ * @start: Start of the memory range.
+ * @end: End of the memory range (inclusive).
+ * @type: Type of the memory range.
+ *
+ * removes a firmware mapping entry.
+ *
+ * Returns 0 on success, or -EINVAL if no entry.
+ **/
+int __meminit firmware_map_remove(u64 start, u64 end, const char *type)
+{
+ struct firmware_map_entry *entry;
+
+ entry = find_firmware_map_entry(start, end, type);
+ if (!entry)
+ return -EINVAL;
+
+ /* remove the memmap entry */
+ remove_sysfs_fw_map_entry(entry);
+
+ firmware_map_remove_entry(entry);
+
+ return 0;
+}
+
/*
* Sysfs functions -------------------------------------------------------------
*/
^ permalink raw reply
* [RFC PATCH v2 3/13] unify argument of firmware_map_add_early/hotplug
From: Yasuaki Ishimatsu @ 2012-07-03 5:55 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, paulus, minchan.kim, kosaki.motohiro, rientjes, cl,
akpm, liuj97
In-Reply-To: <4FF287C3.4030901@jp.fujitsu.com>
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 - 1".
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
mm/memory_hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-3.5-rc4/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc4.orig/mm/memory_hotplug.c 2012-07-03 14:21:58.332264022 +0900
+++ linux-3.5-rc4/mm/memory_hotplug.c 2012-07-03 14:22:00.190240794 +0900
@@ -642,7 +642,7 @@ int __ref add_memory(int nid, u64 start,
}
/* create new memmap entry */
- firmware_map_add_hotplug(start, start + size, "System RAM");
+ firmware_map_add_hotplug(start, start + size - 1, "System RAM");
goto out;
^ permalink raw reply
* [RFC PATCH v2 2/13] memory-hotplug : add physical memory hotplug code to acpi_memory_device_remove
From: Yasuaki Ishimatsu @ 2012-07-03 5:54 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, paulus, minchan.kim, kosaki.motohiro, rientjes, cl,
akpm, liuj97
In-Reply-To: <4FF287C3.4030901@jp.fujitsu.com>
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 (only return -EBUSY)
- free acpi_memory_device
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
drivers/acpi/acpi_memhotplug.c | 26 +++++++++++++++++++++++++-
drivers/base/memory.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/memory.h | 5 +++++
include/linux/memory_hotplug.h | 1 +
mm/memory_hotplug.c | 8 ++++++++
5 files changed, 77 insertions(+), 1 deletion(-)
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:49.458374960 +0900
+++ linux-3.5-rc4/drivers/acpi/acpi_memhotplug.c 2012-07-03 14:21:58.329264059 +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,35 @@ 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;
+ }
+
+ 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-rc4/include/linux/memory_hotplug.h
===================================================================
--- linux-3.5-rc4.orig/include/linux/memory_hotplug.h 2012-07-03 14:21:49.471374796 +0900
+++ linux-3.5-rc4/include/linux/memory_hotplug.h 2012-07-03 14:21:58.330264047 +0900
@@ -233,6 +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(int nid, 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);
Index: linux-3.5-rc4/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc4.orig/mm/memory_hotplug.c 2012-07-03 14:21:49.466374860 +0900
+++ linux-3.5-rc4/mm/memory_hotplug.c 2012-07-03 14:21:58.332264022 +0900
@@ -659,6 +659,14 @@ out:
}
EXPORT_SYMBOL_GPL(add_memory);
+int remove_memory(int nid, u64 start, u64 size)
+{
+ return -EBUSY;
+
+}
+EXPORT_SYMBOL_GPL(remove_memory);
+
+
#ifdef CONFIG_MEMORY_HOTREMOVE
/*
* A free page on the buddy free lists (not the per-cpu lists) has PageBuddy
Index: linux-3.5-rc4/drivers/base/memory.c
===================================================================
--- linux-3.5-rc4.orig/drivers/base/memory.c 2012-07-03 14:21:49.459374948 +0900
+++ linux-3.5-rc4/drivers/base/memory.c 2012-07-03 14:21:58.335263984 +0900
@@ -70,6 +70,44 @@ void unregister_memory_isolate_notifier(
}
EXPORT_SYMBOL(unregister_memory_isolate_notifier);
+bool is_memblk_offline(unsigned long start, unsigned long size)
+{
+ struct memory_block *mem = NULL;
+ struct mem_section *section;
+ unsigned long start_pfn, end_pfn;
+ unsigned long pfn, section_nr;
+
+ start_pfn = PFN_DOWN(start);
+ end_pfn = start_pfn + PFN_DOWN(start);
+
+ for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
+ section_nr = pfn_to_section_nr(pfn);
+ if (!present_section_nr(section_nr));
+ continue;
+
+ section = __nr_to_section(section_nr);
+ /* same memblock? */
+ if (mem)
+ if((section_nr >= mem->start_section_nr) &&
+ (section_nr <= mem->end_section_nr))
+ continue;
+
+ mem = find_memory_block_hinted(section, mem);
+ if (!mem)
+ continue;
+ if (mem->state == MEM_OFFLINE) {
+ kobject_put(&mem->dev.kobj);
+ continue;
+ }
+
+ kobject_put(&mem->dev.kobj);
+ return false;
+ }
+
+ return true;
+}
+EXPORT_SYMBOL(is_memblk_offline);
+
/*
* register_memory - Setup a sysfs device for a memory block
*/
Index: linux-3.5-rc4/include/linux/memory.h
===================================================================
--- linux-3.5-rc4.orig/include/linux/memory.h 2012-07-03 14:21:45.998418215 +0900
+++ linux-3.5-rc4/include/linux/memory.h 2012-07-03 14:21:58.340263922 +0900
@@ -106,6 +106,10 @@ static inline int memory_isolate_notify(
{
return 0;
}
+static inline bool is_memblk_offline(unsigned long start, unsigned long size)
+{
+ return false;
+}
#else
extern int register_memory_notifier(struct notifier_block *nb);
extern void unregister_memory_notifier(struct notifier_block *nb);
@@ -120,6 +124,7 @@ extern int memory_isolate_notify(unsigne
extern struct memory_block *find_memory_block_hinted(struct mem_section *,
struct memory_block *);
extern struct memory_block *find_memory_block(struct mem_section *);
+extern bool is_memblk_offline(unsigned long start, unsigned long size);
#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
enum mem_add_context { BOOT, HOTPLUG };
#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
^ permalink raw reply
* [RFC PATCH v2 1/13] memory-hotplug : rename remove_memory to offline_memory
From: Yasuaki Ishimatsu @ 2012-07-03 5:52 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, paulus, minchan.kim, kosaki.motohiro, rientjes, cl,
akpm, liuj97
In-Reply-To: <4FF287C3.4030901@jp.fujitsu.com>
remove_memory() does not remove memory but just offlines memory. The patch
changes name of it to offline_memory().
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@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.c 2012-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.c 2012-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.h 2012-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);
^ permalink raw reply
* [RFC PATCH v2 0/13] memory-hotplug : hot-remove physical memory
From: Yasuaki Ishimatsu @ 2012-07-03 5:48 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, paulus, minchan.kim, kosaki.motohiro, rientjes, cl,
akpm, liuj97
This patch series aims to support physical memory hot-remove.
[RFC PATCH v2 1/13] memory-hotplug : rename remove_memory to offline_memory
[RFC PATCH v2 2/13] memory-hotplug : add physical memory hotplug code to acpi_memory_device_remove
[RFC PATCH v2 3/13] memory-hotplug : unify argument of firmware_map_add_early/hotplug
[RFC PATCH v2 4/13] memory-hotplug : remove /sys/firmware/memmap/X sysfs
[RFC PATCH v2 5/13] memory-hotplug : does not release memory region in PAGES_PER_SECTION chunks
[RFC PATCH v2 6/13] memory-hotplug : add memory_block_release
[RFC PATCH v2 7/13] memory-hotplug : remove_memory calls __remove_pages
[RFC PATCH v2 8/13] memory-hotplug : check page type in get_page_bootmem
[RFC PATCH v2 9/13] memory-hotplug : move register_page_bootmem_info_node and put_page_bootmem for
sparse-vmemmap
[RFC PATCH v2 10/13] memory-hotplug : implement register_page_bootmem_info_section of sparse-vmemmap
[RFC PATCH v2 11/13] memory-hotplug : free memmap of sparse-vmemmap
[RFC PATCH v2 12/13] memory-hotplug : add node_device_release
[RFC PATCH v2 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. 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 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 | 53 ++++++++
drivers/base/node.c | 7 +
drivers/firmware/memmap.c | 70 +++++++++++
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, 406 insertions(+), 48 deletions(-)
^ permalink raw reply
* Re: [PATCH] mm: setup pageblock_order before it's used by sparse
From: Jiang Liu @ 2012-07-03 3:29 UTC (permalink / raw)
To: Yinghai Lu
Cc: Tony Luck, linux-mm, linux-kernel, stable, Minchan Kim,
Keping Chen, Mel Gorman, KOSAKI Motohiro, David Rientjes,
Xishi Qiu, Andrew Morton, David Gibson, linuxppc-dev,
KAMEZAWA Hiroyuki, Jiang Liu
In-Reply-To: <CAE9FiQVxY9E3L_xmRj10+9D6NVbKaxaAd2oJ6EFe1D+Gy2971w@mail.gmail.com>
>> Hi Yinghai,
>>
>> I'm afraid the v2 will break powerpc. Currently only IA64 and PowerPC
>> supports variable hugetlb size.
>>
>> HPAGE_SHIFT is a variable default to 0 on powerpc. But seems PowerPC
>> is doing something wrong here, according to it's mm initialization
>> sequence as below:
>> start_kernel()
>> setup_arch()
>> paging_init()
>> free_area_init_node()
>> set_pageblock_order()
>> refer to HPAGE_SHIFT (still 0)
>> init_rest()
>> do_initcalls()
>> hugetlbpage_init()
>> setup HPAGE_SHIFT
>> 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.
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.
Thanks!
Gerry
^ permalink raw reply
* Re: [PATCH] mm: setup pageblock_order before it's used by sparse
From: Yinghai Lu @ 2012-07-03 3:25 UTC (permalink / raw)
To: Jiang Liu, Benjamin Herrenschmidt
Cc: Tony Luck, linux-mm, linux-kernel, stable, Minchan Kim,
Keping Chen, Mel Gorman, KOSAKI Motohiro, David Rientjes,
Xishi Qiu, Andrew Morton, David Gibson, linuxppc-dev,
KAMEZAWA Hiroyuki, Jiang Liu
In-Reply-To: <4FF25EFA.1080004@huawei.com>
On Mon, Jul 2, 2012 at 7:54 PM, Jiang Liu <jiang.liu@huawei.com> wrote:
> On 2012-7-3 4:43, Yinghai Lu wrote:
>> On Sun, Jul 1, 2012 at 7:01 PM, Jiang Liu <jiang.liu@huawei.com> wrote:
>>> Hi Yinghai,
>>> The patch fails compilation as below:
>>> mm/page_alloc.c:151: error: initializer element is not constant
>>> mm/page_alloc.c:151: error: expected =91,=92 or =91;=92 before =91__att=
ribute__=92
>>>
>>> On IA64, HUGETLB_PAGE_ORDER has dependency on variable hpage_shift.
>>> # define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
>>> # define HPAGE_SHIFT hpage_shift
>>>
>>> And hpage_shift could be changed by early parameter "hugepagesz".
>>> So seems will still need to keep function set_pageblock_order().
>>
>> ah, then use use _DEFAULT instead and later could update that in earlyp=
aram.
>>
>> So attached -v2 should work.
> Hi Yinghai,
>
> I'm afraid the v2 will break powerpc. Currently only IA64 and PowerPC
> supports variable hugetlb size.
>
> HPAGE_SHIFT is a variable default to 0 on powerpc. But seems PowerPC
> is doing something wrong here, according to it's mm initialization
> sequence as below:
> start_kernel()
> setup_arch()
> paging_init()
> free_area_init_node()
> set_pageblock_order()
> refer to HPAGE_SHIFT (still 0)
> init_rest()
> do_initcalls()
> hugetlbpage_init()
> setup HPAGE_SHIFT
> 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.
Thanks
Yinghai
^ permalink raw reply
* Re: [PATCH] mm: setup pageblock_order before it's used by sparse
From: Jiang Liu @ 2012-07-03 2:54 UTC (permalink / raw)
To: Yinghai Lu
Cc: Tony Luck, linux-mm, linux-kernel, stable, Minchan Kim,
Keping Chen, Mel Gorman, KOSAKI Motohiro, David Rientjes,
Xishi Qiu, Andrew Morton, David Gibson, linuxppc-dev,
KAMEZAWA Hiroyuki, Jiang Liu
In-Reply-To: <CAE9FiQXpeGFfWvUHHW_GjgTg+4Op7agsht5coZbcmn2W=f9bqw@mail.gmail.com>
On 2012-7-3 4:43, Yinghai Lu wrote:
> On Sun, Jul 1, 2012 at 7:01 PM, Jiang Liu <jiang.liu@huawei.com> wrote:
>> Hi Yinghai,
>> The patch fails compilation as below:
>> mm/page_alloc.c:151: error: initializer element is not constant
>> mm/page_alloc.c:151: error: expected ‘,’ or ‘;’ before ‘__attribute__’
>>
>> On IA64, HUGETLB_PAGE_ORDER has dependency on variable hpage_shift.
>> # define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
>> # define HPAGE_SHIFT hpage_shift
>>
>> And hpage_shift could be changed by early parameter "hugepagesz".
>> So seems will still need to keep function set_pageblock_order().
>
> ah, then use use _DEFAULT instead and later could update that in earlyparam.
>
> So attached -v2 should work.
Hi Yinghai,
I'm afraid the v2 will break powerpc. Currently only IA64 and PowerPC
supports variable hugetlb size.
HPAGE_SHIFT is a variable default to 0 on powerpc. But seems PowerPC
is doing something wrong here, according to it's mm initialization
sequence as below:
start_kernel()
setup_arch()
paging_init()
free_area_init_node()
set_pageblock_order()
refer to HPAGE_SHIFT (still 0)
init_rest()
do_initcalls()
hugetlbpage_init()
setup HPAGE_SHIFT
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.
So it would be better to keep function set_pageblock_order(), it will
fix the memory wasting on both IA64 and PowerPC.
Thanks!
Gerry
>
> Thanks
>
> Yinghai
^ permalink raw reply
* Re: [PATCH 5/5] usb: gadget: composite: parse dt overrides
From: Rob Herring @ 2012-07-02 22:46 UTC (permalink / raw)
To: balbi
Cc: Roland Stigge, linux-doc, Greg Kroah-Hartman, devicetree-discuss,
linux-usb, linux-kernel, Rob Landley, linuxppc-dev,
Alexandre Pereira da Silva
In-Reply-To: <20120702073522.GE16670@arwen.pp.htv.fi>
On 07/02/2012 02:35 AM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Jun 26, 2012 at 11:27:13AM -0300, Alexandre Pereira da Silva wrote:
>> Grab the devicetree node properties to override VendorId, ProductId,
>> bcdDevice, Manucacturer, Product and SerialNumber
>>
>> Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
>
> I need Grant's acked-by to queue this one.
>
Grant is pretty much offline for the next 2 months, so:
Acked-by: Rob Herring <rob.herring@calxeda.com>
Rob
^ permalink raw reply
* Re: [git pull] Please pull powerpc.git merge branch
From: Benjamin Herrenschmidt @ 2012-07-02 22:20 UTC (permalink / raw)
To: Gerhard Pircher; +Cc: linuxppc-dev list
In-Reply-To: <20120702213828.133470@gmx.net>
On Mon, 2012-07-02 at 23:38 +0200, Gerhard Pircher wrote:
>
> What about this fix:?
>
> http://patchwork.ozlabs.org/patch/166346/
>
> At least I can't see it in the log...
The module fix went in. The ftrace patch, well, it's untested and we
don't even know if we have a problem with mcount yet, so no, I haven't
merged it yet.
Cheers,
Ben.
^ permalink raw reply
* Re: [git pull] Please pull powerpc.git merge branch
From: Gerhard Pircher @ 2012-07-02 21:38 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list
In-Reply-To: <1341205059.2588.30.camel@pasglop>
-------- Original-Nachricht --------
> Datum: Mon, 02 Jul 2012 14:57:39 +1000
> Von: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> An: Linus Torvalds <torvalds@linux-foundation.org>
> CC: linuxppc-dev list <linuxppc-dev@ozlabs.org>, Andrew Morton <akpm@linux-foundation.org>, Linux Kernel list <linux-kernel@vger.kernel.org>
> Betreff: [git pull] Please pull powerpc.git merge branch
> Hi Linus
>
> Here are two more fixes that I "missed" when scrubbing patchwork last
> week which are worth still having in 3.5.
What about this fix:?
http://patchwork.ozlabs.org/patch/166346/
At least I can't see it in the log...
br,
Gerhard
^ permalink raw reply
* Re: [PATCH] PPC: use CURRENT_THREAD_INFO instead of open coded assembly
From: Alexander Graf @ 2012-07-02 21:34 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, Stuart Yoder
In-Reply-To: <4FF21343.20408@freescale.com>
On 02.07.2012, at 23:31, Scott Wood wrote:
> On 07/02/2012 04:27 PM, Alexander Graf wrote:
>>=20
>> On 02.07.2012, at 23:26, Benjamin Herrenschmidt wrote:
>>=20
>>> On Mon, 2012-07-02 at 22:59 +0200, Alexander Graf wrote:
>>>> This should go into an #ifdef __ASSEMBLY__ block, right? :)
>>>=20
>>> We almost never use #ifdef __ASSEMBLY__, we use it the other way
>>> around, to prevent C stuff from being included in assembly. The
>>> other way around is legit since things might be used in inline asm
>>> for example.
>>=20
>> I'm not sure I want to see this bit of code used as is in inline asm
>> :). I don't even think it's possible, since it's a full statement.
>> Either way, it's safer with the guard.
>=20
> Safer from what? It won't be expanded unless referenced. How is this
> better than putting ifdefs on #includes, prototypes, struct =
definitions,
> etc.? The ifdef is just clutter.
Well, it'd make it easier to read the errors resulting of it. Calling =
CURRENT_THREAD_INFO from within C code would throw random compiler =
errors at you that are quite unintelligible, while a missing definition =
would be a reasonably obvious thing to fix, no?
Either way, not married to this. I just find it cleaner to not expose =
something as a define that wouldn't work in the first place.
Alex
^ permalink raw reply
* Re: [PATCH] PPC: use CURRENT_THREAD_INFO instead of open coded assembly
From: Scott Wood @ 2012-07-02 21:31 UTC (permalink / raw)
To: Alexander Graf; +Cc: linuxppc-dev, Stuart Yoder
In-Reply-To: <DAF1D512-B0CF-497D-8626-1C75103C6EA0@suse.de>
On 07/02/2012 04:27 PM, Alexander Graf wrote:
>
> On 02.07.2012, at 23:26, Benjamin Herrenschmidt wrote:
>
>> On Mon, 2012-07-02 at 22:59 +0200, Alexander Graf wrote:
>>> This should go into an #ifdef __ASSEMBLY__ block, right? :)
>>
>> We almost never use #ifdef __ASSEMBLY__, we use it the other way
>> around, to prevent C stuff from being included in assembly. The
>> other way around is legit since things might be used in inline asm
>> for example.
>
> I'm not sure I want to see this bit of code used as is in inline asm
> :). I don't even think it's possible, since it's a full statement.
> Either way, it's safer with the guard.
Safer from what? It won't be expanded unless referenced. How is this
better than putting ifdefs on #includes, prototypes, struct definitions,
etc.? The ifdef is just clutter.
-Scott
^ permalink raw reply
* Re: [PATCH] PPC: use CURRENT_THREAD_INFO instead of open coded assembly
From: Alexander Graf @ 2012-07-02 21:27 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Stuart Yoder
In-Reply-To: <1341264368.2588.49.camel@pasglop>
On 02.07.2012, at 23:26, Benjamin Herrenschmidt wrote:
> On Mon, 2012-07-02 at 22:59 +0200, Alexander Graf wrote:
>> This should go into an #ifdef __ASSEMBLY__ block, right? :)
>=20
> We almost never use #ifdef __ASSEMBLY__, we use it the other way =
around,
> to prevent C stuff from being included in assembly. The other way =
around
> is legit since things might be used in inline asm for example.
I'm not sure I want to see this bit of code used as is in inline asm :). =
I don't even think it's possible, since it's a full statement. Either =
way, it's safer with the guard.
Alex
^ permalink raw reply
* Re: [PATCH][v2] PPC: use CURRENT_THREAD_INFO instead of open coded assembly
From: Benjamin Herrenschmidt @ 2012-07-02 21:27 UTC (permalink / raw)
To: Stuart Yoder; +Cc: linuxppc-dev, agraf
In-Reply-To: <1341263667-29875-1-git-send-email-stuart.yoder@freescale.com>
On Mon, 2012-07-02 at 16:14 -0500, Stuart Yoder wrote:
> -v2
> -moved CURRENT_THREAD_INFO under assembly only
> #ifdef
Nak, invert the two cases to avoid the if_n_def, but don't move it
inside __ASSEMBLY__ only.
IE. Address Alex other comment :-)
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH] PPC: use CURRENT_THREAD_INFO instead of open coded assembly
From: Benjamin Herrenschmidt @ 2012-07-02 21:26 UTC (permalink / raw)
To: Alexander Graf; +Cc: linuxppc-dev, Stuart Yoder
In-Reply-To: <40388C8A-6D3B-409E-9C6D-45005E1F6016@suse.de>
On Mon, 2012-07-02 at 22:59 +0200, Alexander Graf wrote:
> This should go into an #ifdef __ASSEMBLY__ block, right? :)
We almost never use #ifdef __ASSEMBLY__, we use it the other way around,
to prevent C stuff from being included in assembly. The other way around
is legit since things might be used in inline asm for example.
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH][v2] PPC: use CURRENT_THREAD_INFO instead of open coded assembly
From: Alexander Graf @ 2012-07-02 21:15 UTC (permalink / raw)
To: Stuart Yoder; +Cc: linuxppc-dev
In-Reply-To: <1341263667-29875-1-git-send-email-stuart.yoder@freescale.com>
On 02.07.2012, at 23:14, Stuart Yoder wrote:
> From: Stuart Yoder <stuart.yoder@freescale.com>
>=20
> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
> ---
>=20
> -this patch is a pre-requisite for the idle hcall which I
> am trying to get into Alex's KVM tree, so ideally would like
> Ben's ack and get this applied to Alex's tree
>=20
> -built/tested with a 32-bit booke kernel, built a 64-bit
> booke kernel
>=20
> -v2
> -moved CURRENT_THREAD_INFO under assembly only
> #ifdef
>=20
> arch/powerpc/include/asm/exception-64s.h | 4 ++--
> arch/powerpc/include/asm/thread_info.h | 8 ++++++++
> arch/powerpc/kernel/entry_32.S | 24 =
++++++++++++------------
> arch/powerpc/kernel/entry_64.S | 14 +++++++-------
> arch/powerpc/kernel/exceptions-64e.S | 2 +-
> arch/powerpc/kernel/exceptions-64s.S | 2 +-
> arch/powerpc/kernel/head_fsl_booke.S | 2 +-
> arch/powerpc/kernel/idle_6xx.S | 4 ++--
> arch/powerpc/kernel/idle_book3e.S | 2 +-
> arch/powerpc/kernel/idle_e500.S | 4 ++--
> arch/powerpc/kernel/idle_power4.S | 2 +-
> arch/powerpc/kernel/misc_32.S | 4 ++--
> arch/powerpc/kvm/bookehv_interrupts.S | 6 +-----
> arch/powerpc/mm/hash_low_32.S | 8 ++++----
> arch/powerpc/sysdev/6xx-suspend.S | 2 +-
> 15 files changed, 46 insertions(+), 42 deletions(-)
>=20
> diff --git a/arch/powerpc/include/asm/exception-64s.h =
b/arch/powerpc/include/asm/exception-64s.h
> index d58fc4e..5dbd00d 100644
> --- a/arch/powerpc/include/asm/exception-64s.h
> +++ b/arch/powerpc/include/asm/exception-64s.h
> @@ -293,7 +293,7 @@ label##_hv: =
\
>=20
> #define RUNLATCH_ON \
> BEGIN_FTR_SECTION \
> - clrrdi r3,r1,THREAD_SHIFT; \
> + CURRENT_THREAD_INFO(r3, r1) \
> ld r4,TI_LOCAL_FLAGS(r3); \
> andi. r0,r4,_TLF_RUNLATCH; \
> beql ppc64_runlatch_on_trampoline; \
> @@ -332,7 +332,7 @@ label##_common: =
\
> #ifdef CONFIG_PPC_970_NAP
> #define FINISH_NAP \
> BEGIN_FTR_SECTION \
> - clrrdi r11,r1,THREAD_SHIFT; \
> + CURRENT_THREAD_INFO(r11, r1) \
> ld r9,TI_LOCAL_FLAGS(r11); \
> andi. r10,r9,_TLF_NAPPING; \
> bnel power4_fixup_nap; \
> diff --git a/arch/powerpc/include/asm/thread_info.h =
b/arch/powerpc/include/asm/thread_info.h
> index 68831e9..3760620 100644
> --- a/arch/powerpc/include/asm/thread_info.h
> +++ b/arch/powerpc/include/asm/thread_info.h
> @@ -74,6 +74,14 @@ static inline struct thread_info =
*current_thread_info(void)
> return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
> }
>=20
> +#else
> +
> +#ifndef CONFIG_PPC64
Oh no! The logic is still backwards :(
> +#define CURRENT_THREAD_INFO(dest, sp) rlwinm dest, sp, 0, 0, =
31-THREAD_SHIFT
> +#else
> +#define CURRENT_THREAD_INFO(dest, sp) clrrdi dest, sp, =
THREAD_SHIFT
> +#endif
Alex
^ permalink raw reply
* [PATCH][v2] PPC: use CURRENT_THREAD_INFO instead of open coded assembly
From: Stuart Yoder @ 2012-07-02 21:14 UTC (permalink / raw)
To: agraf, benh; +Cc: linuxppc-dev
From: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
---
-this patch is a pre-requisite for the idle hcall which I
am trying to get into Alex's KVM tree, so ideally would like
Ben's ack and get this applied to Alex's tree
-built/tested with a 32-bit booke kernel, built a 64-bit
booke kernel
-v2
-moved CURRENT_THREAD_INFO under assembly only
#ifdef
arch/powerpc/include/asm/exception-64s.h | 4 ++--
arch/powerpc/include/asm/thread_info.h | 8 ++++++++
arch/powerpc/kernel/entry_32.S | 24 ++++++++++++------------
arch/powerpc/kernel/entry_64.S | 14 +++++++-------
arch/powerpc/kernel/exceptions-64e.S | 2 +-
arch/powerpc/kernel/exceptions-64s.S | 2 +-
arch/powerpc/kernel/head_fsl_booke.S | 2 +-
arch/powerpc/kernel/idle_6xx.S | 4 ++--
arch/powerpc/kernel/idle_book3e.S | 2 +-
arch/powerpc/kernel/idle_e500.S | 4 ++--
arch/powerpc/kernel/idle_power4.S | 2 +-
arch/powerpc/kernel/misc_32.S | 4 ++--
arch/powerpc/kvm/bookehv_interrupts.S | 6 +-----
arch/powerpc/mm/hash_low_32.S | 8 ++++----
arch/powerpc/sysdev/6xx-suspend.S | 2 +-
15 files changed, 46 insertions(+), 42 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index d58fc4e..5dbd00d 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -293,7 +293,7 @@ label##_hv: \
#define RUNLATCH_ON \
BEGIN_FTR_SECTION \
- clrrdi r3,r1,THREAD_SHIFT; \
+ CURRENT_THREAD_INFO(r3, r1) \
ld r4,TI_LOCAL_FLAGS(r3); \
andi. r0,r4,_TLF_RUNLATCH; \
beql ppc64_runlatch_on_trampoline; \
@@ -332,7 +332,7 @@ label##_common: \
#ifdef CONFIG_PPC_970_NAP
#define FINISH_NAP \
BEGIN_FTR_SECTION \
- clrrdi r11,r1,THREAD_SHIFT; \
+ CURRENT_THREAD_INFO(r11, r1) \
ld r9,TI_LOCAL_FLAGS(r11); \
andi. r10,r9,_TLF_NAPPING; \
bnel power4_fixup_nap; \
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 68831e9..3760620 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -74,6 +74,14 @@ static inline struct thread_info *current_thread_info(void)
return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
}
+#else
+
+#ifndef CONFIG_PPC64
+#define CURRENT_THREAD_INFO(dest, sp) rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT
+#else
+#define CURRENT_THREAD_INFO(dest, sp) clrrdi dest, sp, THREAD_SHIFT
+#endif
+
#endif /* __ASSEMBLY__ */
#define PREEMPT_ACTIVE 0x10000000
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index ba3aeb4..bad42e3 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -92,7 +92,7 @@ crit_transfer_to_handler:
mfspr r8,SPRN_SPRG_THREAD
lwz r0,KSP_LIMIT(r8)
stw r0,SAVED_KSP_LIMIT(r11)
- rlwimi r0,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r0, r1)
stw r0,KSP_LIMIT(r8)
/* fall through */
#endif
@@ -112,7 +112,7 @@ crit_transfer_to_handler:
mfspr r8,SPRN_SPRG_THREAD
lwz r0,KSP_LIMIT(r8)
stw r0,saved_ksp_limit@l(0)
- rlwimi r0,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r0, r1)
stw r0,KSP_LIMIT(r8)
/* fall through */
#endif
@@ -158,7 +158,7 @@ transfer_to_handler:
tophys(r11,r11)
addi r11,r11,global_dbcr0@l
#ifdef CONFIG_SMP
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r9,TI_CPU(r9)
slwi r9,r9,3
add r11,r11,r9
@@ -179,7 +179,7 @@ transfer_to_handler:
ble- stack_ovf /* then the kernel stack overflowed */
5:
#if defined(CONFIG_6xx) || defined(CONFIG_E500)
- rlwinm r9,r1,0,0,31-THREAD_SHIFT
+ CURRENT_THREAD_INFO(r9, r1)
tophys(r9,r9) /* check local flags */
lwz r12,TI_LOCAL_FLAGS(r9)
mtcrf 0x01,r12
@@ -333,7 +333,7 @@ _GLOBAL(DoSyscall)
mtmsr r11
1:
#endif /* CONFIG_TRACE_IRQFLAGS */
- rlwinm r10,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
+ CURRENT_THREAD_INFO(r10, r1)
lwz r11,TI_FLAGS(r10)
andi. r11,r11,_TIF_SYSCALL_T_OR_A
bne- syscall_dotrace
@@ -354,7 +354,7 @@ ret_from_syscall:
bl do_show_syscall_exit
#endif
mr r6,r3
- rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
+ CURRENT_THREAD_INFO(r12, r1)
/* disable interrupts so current_thread_info()->flags can't change */
LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
/* Note: We don't bother telling lockdep about it */
@@ -815,7 +815,7 @@ ret_from_except:
user_exc_return: /* r10 contains MSR_KERNEL here */
/* Check current_thread_info()->flags */
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r9,TI_FLAGS(r9)
andi. r0,r9,_TIF_USER_WORK_MASK
bne do_work
@@ -835,7 +835,7 @@ restore_user:
/* N.B. the only way to get here is from the beq following ret_from_except. */
resume_kernel:
/* check current_thread_info->preempt_count */
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r0,TI_PREEMPT(r9)
cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
bne restore
@@ -852,7 +852,7 @@ resume_kernel:
bl trace_hardirqs_off
#endif
1: bl preempt_schedule_irq
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r3,TI_FLAGS(r9)
andi. r0,r3,_TIF_NEED_RESCHED
bne- 1b
@@ -1122,7 +1122,7 @@ ret_from_debug_exc:
lwz r10,SAVED_KSP_LIMIT(r1)
stw r10,KSP_LIMIT(r9)
lwz r9,THREAD_INFO-THREAD(r9)
- rlwinm r10,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r10, r1)
lwz r10,TI_PREEMPT(r10)
stw r10,TI_PREEMPT(r9)
RESTORE_xSRR(SRR0,SRR1);
@@ -1156,7 +1156,7 @@ load_dbcr0:
lis r11,global_dbcr0@ha
addi r11,r11,global_dbcr0@l
#ifdef CONFIG_SMP
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r9,TI_CPU(r9)
slwi r9,r9,3
add r11,r11,r9
@@ -1197,7 +1197,7 @@ recheck:
LOAD_MSR_KERNEL(r10,MSR_KERNEL)
SYNC
MTMSRD(r10) /* disable interrupts */
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r9,TI_FLAGS(r9)
andi. r0,r9,_TIF_NEED_RESCHED
bne- do_resched
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index ed1718f..ba943b9 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -146,7 +146,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
REST_2GPRS(7,r1)
addi r9,r1,STACK_FRAME_OVERHEAD
#endif
- clrrdi r11,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r11, r1)
ld r10,TI_FLAGS(r11)
andi. r11,r10,_TIF_SYSCALL_T_OR_A
bne- syscall_dotrace
@@ -181,7 +181,7 @@ syscall_exit:
bl .do_show_syscall_exit
ld r3,RESULT(r1)
#endif
- clrrdi r12,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r12, r1)
ld r8,_MSR(r1)
#ifdef CONFIG_PPC_BOOK3S
@@ -262,7 +262,7 @@ syscall_dotrace:
ld r7,GPR7(r1)
ld r8,GPR8(r1)
addi r9,r1,STACK_FRAME_OVERHEAD
- clrrdi r10,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r10, r1)
ld r10,TI_FLAGS(r10)
b .Lsyscall_dotrace_cont
@@ -499,7 +499,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
2:
#endif /* !CONFIG_PPC_BOOK3S */
- clrrdi r7,r8,THREAD_SHIFT /* base of new stack */
+ CURRENT_THREAD_INFO(r7, r8) /* base of new stack */
/* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE
because we don't need to leave the 288-byte ABI gap at the
top of the kernel stack. */
@@ -559,7 +559,7 @@ _GLOBAL(ret_from_except_lite)
#endif /* CONFIG_PPC_BOOK3E */
#ifdef CONFIG_PREEMPT
- clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */
+ CURRENT_THREAD_INFO(r9, r1)
li r0,_TIF_NEED_RESCHED /* bits to check */
ld r3,_MSR(r1)
ld r4,TI_FLAGS(r9)
@@ -574,7 +574,7 @@ _GLOBAL(ret_from_except_lite)
beq restore /* if not, just restore regs and return */
/* Check current_thread_info()->flags */
- clrrdi r9,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r9, r1)
ld r4,TI_FLAGS(r9)
andi. r0,r4,_TIF_USER_WORK_MASK
bne do_work
@@ -782,7 +782,7 @@ do_work:
1: bl .preempt_schedule_irq
/* Re-test flags and eventually loop */
- clrrdi r9,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r9, r1)
ld r4,TI_FLAGS(r9)
andi. r0,r4,_TIF_NEED_RESCHED
bne 1b
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 7215cc2..3b60028 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -222,7 +222,7 @@ exc_##n##_bad_stack: \
* interrupts happen before the wait instruction.
*/
#define CHECK_NAPPING() \
- clrrdi r11,r1,THREAD_SHIFT; \
+ CURRENT_THREAD_INFO(r11, r1)
ld r10,TI_LOCAL_FLAGS(r11); \
andi. r9,r10,_TLF_NAPPING; \
beq+ 1f; \
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 1c06d29..8ad3468 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -851,7 +851,7 @@ BEGIN_FTR_SECTION
bne- do_ste_alloc /* If so handle it */
END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
- clrrdi r11,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r11, r1)
lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
bne 77f /* then don't call hash_page now */
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 1f4434a..7e7bd88 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -192,7 +192,7 @@ _ENTRY(__early_start)
li r0,0
stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
- rlwinm r22,r1,0,0,31-THREAD_SHIFT /* current thread_info */
+ CURRENT_THREAD_INFO(r22, r1)
stw r24, TI_CPU(r22)
bl early_init
diff --git a/arch/powerpc/kernel/idle_6xx.S b/arch/powerpc/kernel/idle_6xx.S
index 15c611d..1686916 100644
--- a/arch/powerpc/kernel/idle_6xx.S
+++ b/arch/powerpc/kernel/idle_6xx.S
@@ -135,7 +135,7 @@ BEGIN_FTR_SECTION
DSSALL
sync
END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
- rlwinm r9,r1,0,0,31-THREAD_SHIFT /* current thread_info */
+ CURRENT_THREAD_INFO(r9, r1)
lwz r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
ori r8,r8,_TLF_NAPPING /* so when we take an exception */
stw r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
@@ -158,7 +158,7 @@ _GLOBAL(power_save_ppc32_restore)
stw r9,_NIP(r11) /* make it do a blr */
#ifdef CONFIG_SMP
- rlwinm r12,r11,0,0,31-THREAD_SHIFT
+ CURRENT_THREAD_INFO(r12, r11)
lwz r11,TI_CPU(r12) /* get cpu number * 4 */
slwi r11,r11,2
#else
diff --git a/arch/powerpc/kernel/idle_book3e.S b/arch/powerpc/kernel/idle_book3e.S
index ff007b5..4c7cb400 100644
--- a/arch/powerpc/kernel/idle_book3e.S
+++ b/arch/powerpc/kernel/idle_book3e.S
@@ -60,7 +60,7 @@ _GLOBAL(book3e_idle)
1: /* Let's set the _TLF_NAPPING flag so interrupts make us return
* to the right spot
*/
- clrrdi r11,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r11, r1)
ld r10,TI_LOCAL_FLAGS(r11)
ori r10,r10,_TLF_NAPPING
std r10,TI_LOCAL_FLAGS(r11)
diff --git a/arch/powerpc/kernel/idle_e500.S b/arch/powerpc/kernel/idle_e500.S
index 4f0ab85..1544866 100644
--- a/arch/powerpc/kernel/idle_e500.S
+++ b/arch/powerpc/kernel/idle_e500.S
@@ -21,7 +21,7 @@
.text
_GLOBAL(e500_idle)
- rlwinm r3,r1,0,0,31-THREAD_SHIFT /* current thread_info */
+ CURRENT_THREAD_INFO(r3, r1)
lwz r4,TI_LOCAL_FLAGS(r3) /* set napping bit */
ori r4,r4,_TLF_NAPPING /* so when we take an exception */
stw r4,TI_LOCAL_FLAGS(r3) /* it will return to our caller */
@@ -96,7 +96,7 @@ _GLOBAL(power_save_ppc32_restore)
stw r9,_NIP(r11) /* make it do a blr */
#ifdef CONFIG_SMP
- rlwinm r12,r1,0,0,31-THREAD_SHIFT
+ CURRENT_THREAD_INFO(r12, r1)
lwz r11,TI_CPU(r12) /* get cpu number * 4 */
slwi r11,r11,2
#else
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index 2c71b0f..e3edaa1 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -59,7 +59,7 @@ BEGIN_FTR_SECTION
DSSALL
sync
END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
- clrrdi r9,r1,THREAD_SHIFT /* current thread_info */
+ CURRENT_THREAD_INFO(r9, r1)
ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
ori r8,r8,_TLF_NAPPING /* so when we take an exception */
std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 386d57f..407e293 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -179,7 +179,7 @@ _GLOBAL(low_choose_750fx_pll)
mtspr SPRN_HID1,r4
/* Store new HID1 image */
- rlwinm r6,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r6, r1)
lwz r6,TI_CPU(r6)
slwi r6,r6,2
addis r6,r6,nap_save_hid1@ha
@@ -699,7 +699,7 @@ _GLOBAL(kernel_thread)
#ifdef CONFIG_SMP
_GLOBAL(start_secondary_resume)
/* Reset stack */
- rlwinm r1,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
+ CURRENT_THREAD_INFO(r1, r1)
addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
li r3,0
stw r3,0(r1) /* Zero the stack frame pointer */
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index 0fa2ef7..c8c7a04 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -161,11 +161,7 @@
mtspr SPRN_EPLC, r8
/* disable preemption, so we are sure we hit the fixup handler */
-#ifdef CONFIG_PPC64
- clrrdi r8,r1,THREAD_SHIFT
-#else
- rlwinm r8,r1,0,0,31-THREAD_SHIFT /* current thread_info */
-#endif
+ CURRENT_THREAD_INFO(r8, r1)
li r7, 1
stw r7, TI_PREEMPT(r8)
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index b13d589..115347f 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -184,7 +184,7 @@ _GLOBAL(add_hash_page)
add r3,r3,r0 /* note create_hpte trims to 24 bits */
#ifdef CONFIG_SMP
- rlwinm r8,r1,0,0,(31-THREAD_SHIFT) /* use cpu number to make tag */
+ CURRENT_THREAD_INFO(r8, r1) /* use cpu number to make tag */
lwz r8,TI_CPU(r8) /* to go in mmu_hash_lock */
oris r8,r8,12
#endif /* CONFIG_SMP */
@@ -545,7 +545,7 @@ _GLOBAL(flush_hash_pages)
#ifdef CONFIG_SMP
addis r9,r7,mmu_hash_lock@ha
addi r9,r9,mmu_hash_lock@l
- rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r8, r1)
add r8,r8,r7
lwz r8,TI_CPU(r8)
oris r8,r8,9
@@ -639,7 +639,7 @@ _GLOBAL(flush_hash_patch_B)
*/
_GLOBAL(_tlbie)
#ifdef CONFIG_SMP
- rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r8, r1)
lwz r8,TI_CPU(r8)
oris r8,r8,11
mfmsr r10
@@ -677,7 +677,7 @@ _GLOBAL(_tlbie)
*/
_GLOBAL(_tlbia)
#if defined(CONFIG_SMP)
- rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r8, r1)
lwz r8,TI_CPU(r8)
oris r8,r8,10
mfmsr r10
diff --git a/arch/powerpc/sysdev/6xx-suspend.S b/arch/powerpc/sysdev/6xx-suspend.S
index 21cda08..cf48e9c 100644
--- a/arch/powerpc/sysdev/6xx-suspend.S
+++ b/arch/powerpc/sysdev/6xx-suspend.S
@@ -29,7 +29,7 @@ _GLOBAL(mpc6xx_enter_standby)
ori r5, r5, ret_from_standby@l
mtlr r5
- rlwinm r5, r1, 0, 0, 31-THREAD_SHIFT
+ CURRENT_THREAD_INFO(r5, r1)
lwz r6, TI_LOCAL_FLAGS(r5)
ori r6, r6, _TLF_SLEEPING
stw r6, TI_LOCAL_FLAGS(r5)
--
1.7.3.4
^ permalink raw reply related
* Re: [PATCH] PPC: use CURRENT_THREAD_INFO instead of open coded assembly
From: Alexander Graf @ 2012-07-02 20:59 UTC (permalink / raw)
To: Stuart Yoder; +Cc: linuxppc-dev
In-Reply-To: <1341262574-2841-1-git-send-email-stuart.yoder@freescale.com>
On 02.07.2012, at 22:56, Stuart Yoder wrote:
> From: Stuart Yoder <stuart.yoder@freescale.com>
>=20
> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
> ---
>=20
> -this patch is a pre-requisite for the idle hcall which I
> am trying to get into Alex's KVM tree, so ideally would like
> Ben's ack and get this applied to Alex's tree
>=20
> -built/tested with a 32-bit booke kernel, built a 64-bit
> booke kernel
>=20
> arch/powerpc/include/asm/exception-64s.h | 4 ++--
> arch/powerpc/include/asm/thread_info.h | 6 ++++++
> arch/powerpc/kernel/entry_32.S | 24 =
++++++++++++------------
> arch/powerpc/kernel/entry_64.S | 14 +++++++-------
> arch/powerpc/kernel/exceptions-64e.S | 2 +-
> arch/powerpc/kernel/exceptions-64s.S | 2 +-
> arch/powerpc/kernel/head_fsl_booke.S | 2 +-
> arch/powerpc/kernel/idle_6xx.S | 4 ++--
> arch/powerpc/kernel/idle_book3e.S | 2 +-
> arch/powerpc/kernel/idle_e500.S | 4 ++--
> arch/powerpc/kernel/idle_power4.S | 2 +-
> arch/powerpc/kernel/misc_32.S | 4 ++--
> arch/powerpc/kvm/bookehv_interrupts.S | 6 +-----
> arch/powerpc/mm/hash_low_32.S | 8 ++++----
> arch/powerpc/sysdev/6xx-suspend.S | 2 +-
> 15 files changed, 44 insertions(+), 42 deletions(-)
>=20
> diff --git a/arch/powerpc/include/asm/exception-64s.h =
b/arch/powerpc/include/asm/exception-64s.h
> index d58fc4e..5dbd00d 100644
> --- a/arch/powerpc/include/asm/exception-64s.h
> +++ b/arch/powerpc/include/asm/exception-64s.h
> @@ -293,7 +293,7 @@ label##_hv: =
\
>=20
> #define RUNLATCH_ON \
> BEGIN_FTR_SECTION \
> - clrrdi r3,r1,THREAD_SHIFT; \
> + CURRENT_THREAD_INFO(r3, r1) \
> ld r4,TI_LOCAL_FLAGS(r3); \
> andi. r0,r4,_TLF_RUNLATCH; \
> beql ppc64_runlatch_on_trampoline; \
> @@ -332,7 +332,7 @@ label##_common: =
\
> #ifdef CONFIG_PPC_970_NAP
> #define FINISH_NAP \
> BEGIN_FTR_SECTION \
> - clrrdi r11,r1,THREAD_SHIFT; \
> + CURRENT_THREAD_INFO(r11, r1) \
> ld r9,TI_LOCAL_FLAGS(r11); \
> andi. r10,r9,_TLF_NAPPING; \
> bnel power4_fixup_nap; \
> diff --git a/arch/powerpc/include/asm/thread_info.h =
b/arch/powerpc/include/asm/thread_info.h
> index 68831e9..2e7bc3c 100644
> --- a/arch/powerpc/include/asm/thread_info.h
> +++ b/arch/powerpc/include/asm/thread_info.h
> @@ -22,6 +22,12 @@
>=20
> #define THREAD_SIZE (1 << THREAD_SHIFT)
>=20
> +#ifndef CONFIG_PPC64
I usually way prefer positive to negative logic. So if you could swap =
the 2 cases, I'd be a lot happier ;)
> +#define CURRENT_THREAD_INFO(dest, sp) rlwinm dest, sp, 0, 0, =
31-THREAD_SHIFT
> +#else
> +#define CURRENT_THREAD_INFO(dest, sp) clrrdi dest, sp, =
THREAD_SHIFT
> +#endif
This should go into an #ifdef __ASSEMBLY__ block, right? :)
The rest looks great :)
Alex
^ permalink raw reply
* [PATCH] PPC: use CURRENT_THREAD_INFO instead of open coded assembly
From: Stuart Yoder @ 2012-07-02 20:56 UTC (permalink / raw)
To: agraf, benh; +Cc: linuxppc-dev
From: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
---
-this patch is a pre-requisite for the idle hcall which I
am trying to get into Alex's KVM tree, so ideally would like
Ben's ack and get this applied to Alex's tree
-built/tested with a 32-bit booke kernel, built a 64-bit
booke kernel
arch/powerpc/include/asm/exception-64s.h | 4 ++--
arch/powerpc/include/asm/thread_info.h | 6 ++++++
arch/powerpc/kernel/entry_32.S | 24 ++++++++++++------------
arch/powerpc/kernel/entry_64.S | 14 +++++++-------
arch/powerpc/kernel/exceptions-64e.S | 2 +-
arch/powerpc/kernel/exceptions-64s.S | 2 +-
arch/powerpc/kernel/head_fsl_booke.S | 2 +-
arch/powerpc/kernel/idle_6xx.S | 4 ++--
arch/powerpc/kernel/idle_book3e.S | 2 +-
arch/powerpc/kernel/idle_e500.S | 4 ++--
arch/powerpc/kernel/idle_power4.S | 2 +-
arch/powerpc/kernel/misc_32.S | 4 ++--
arch/powerpc/kvm/bookehv_interrupts.S | 6 +-----
arch/powerpc/mm/hash_low_32.S | 8 ++++----
arch/powerpc/sysdev/6xx-suspend.S | 2 +-
15 files changed, 44 insertions(+), 42 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index d58fc4e..5dbd00d 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -293,7 +293,7 @@ label##_hv: \
#define RUNLATCH_ON \
BEGIN_FTR_SECTION \
- clrrdi r3,r1,THREAD_SHIFT; \
+ CURRENT_THREAD_INFO(r3, r1) \
ld r4,TI_LOCAL_FLAGS(r3); \
andi. r0,r4,_TLF_RUNLATCH; \
beql ppc64_runlatch_on_trampoline; \
@@ -332,7 +332,7 @@ label##_common: \
#ifdef CONFIG_PPC_970_NAP
#define FINISH_NAP \
BEGIN_FTR_SECTION \
- clrrdi r11,r1,THREAD_SHIFT; \
+ CURRENT_THREAD_INFO(r11, r1) \
ld r9,TI_LOCAL_FLAGS(r11); \
andi. r10,r9,_TLF_NAPPING; \
bnel power4_fixup_nap; \
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 68831e9..2e7bc3c 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -22,6 +22,12 @@
#define THREAD_SIZE (1 << THREAD_SHIFT)
+#ifndef CONFIG_PPC64
+#define CURRENT_THREAD_INFO(dest, sp) rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT
+#else
+#define CURRENT_THREAD_INFO(dest, sp) clrrdi dest, sp, THREAD_SHIFT
+#endif
+
#ifndef __ASSEMBLY__
#include <linux/cache.h>
#include <asm/processor.h>
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index ba3aeb4..bad42e3 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -92,7 +92,7 @@ crit_transfer_to_handler:
mfspr r8,SPRN_SPRG_THREAD
lwz r0,KSP_LIMIT(r8)
stw r0,SAVED_KSP_LIMIT(r11)
- rlwimi r0,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r0, r1)
stw r0,KSP_LIMIT(r8)
/* fall through */
#endif
@@ -112,7 +112,7 @@ crit_transfer_to_handler:
mfspr r8,SPRN_SPRG_THREAD
lwz r0,KSP_LIMIT(r8)
stw r0,saved_ksp_limit@l(0)
- rlwimi r0,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r0, r1)
stw r0,KSP_LIMIT(r8)
/* fall through */
#endif
@@ -158,7 +158,7 @@ transfer_to_handler:
tophys(r11,r11)
addi r11,r11,global_dbcr0@l
#ifdef CONFIG_SMP
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r9,TI_CPU(r9)
slwi r9,r9,3
add r11,r11,r9
@@ -179,7 +179,7 @@ transfer_to_handler:
ble- stack_ovf /* then the kernel stack overflowed */
5:
#if defined(CONFIG_6xx) || defined(CONFIG_E500)
- rlwinm r9,r1,0,0,31-THREAD_SHIFT
+ CURRENT_THREAD_INFO(r9, r1)
tophys(r9,r9) /* check local flags */
lwz r12,TI_LOCAL_FLAGS(r9)
mtcrf 0x01,r12
@@ -333,7 +333,7 @@ _GLOBAL(DoSyscall)
mtmsr r11
1:
#endif /* CONFIG_TRACE_IRQFLAGS */
- rlwinm r10,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
+ CURRENT_THREAD_INFO(r10, r1)
lwz r11,TI_FLAGS(r10)
andi. r11,r11,_TIF_SYSCALL_T_OR_A
bne- syscall_dotrace
@@ -354,7 +354,7 @@ ret_from_syscall:
bl do_show_syscall_exit
#endif
mr r6,r3
- rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
+ CURRENT_THREAD_INFO(r12, r1)
/* disable interrupts so current_thread_info()->flags can't change */
LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
/* Note: We don't bother telling lockdep about it */
@@ -815,7 +815,7 @@ ret_from_except:
user_exc_return: /* r10 contains MSR_KERNEL here */
/* Check current_thread_info()->flags */
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r9,TI_FLAGS(r9)
andi. r0,r9,_TIF_USER_WORK_MASK
bne do_work
@@ -835,7 +835,7 @@ restore_user:
/* N.B. the only way to get here is from the beq following ret_from_except. */
resume_kernel:
/* check current_thread_info->preempt_count */
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r0,TI_PREEMPT(r9)
cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
bne restore
@@ -852,7 +852,7 @@ resume_kernel:
bl trace_hardirqs_off
#endif
1: bl preempt_schedule_irq
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r3,TI_FLAGS(r9)
andi. r0,r3,_TIF_NEED_RESCHED
bne- 1b
@@ -1122,7 +1122,7 @@ ret_from_debug_exc:
lwz r10,SAVED_KSP_LIMIT(r1)
stw r10,KSP_LIMIT(r9)
lwz r9,THREAD_INFO-THREAD(r9)
- rlwinm r10,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r10, r1)
lwz r10,TI_PREEMPT(r10)
stw r10,TI_PREEMPT(r9)
RESTORE_xSRR(SRR0,SRR1);
@@ -1156,7 +1156,7 @@ load_dbcr0:
lis r11,global_dbcr0@ha
addi r11,r11,global_dbcr0@l
#ifdef CONFIG_SMP
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r9,TI_CPU(r9)
slwi r9,r9,3
add r11,r11,r9
@@ -1197,7 +1197,7 @@ recheck:
LOAD_MSR_KERNEL(r10,MSR_KERNEL)
SYNC
MTMSRD(r10) /* disable interrupts */
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r9, r1)
lwz r9,TI_FLAGS(r9)
andi. r0,r9,_TIF_NEED_RESCHED
bne- do_resched
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index ed1718f..ba943b9 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -146,7 +146,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
REST_2GPRS(7,r1)
addi r9,r1,STACK_FRAME_OVERHEAD
#endif
- clrrdi r11,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r11, r1)
ld r10,TI_FLAGS(r11)
andi. r11,r10,_TIF_SYSCALL_T_OR_A
bne- syscall_dotrace
@@ -181,7 +181,7 @@ syscall_exit:
bl .do_show_syscall_exit
ld r3,RESULT(r1)
#endif
- clrrdi r12,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r12, r1)
ld r8,_MSR(r1)
#ifdef CONFIG_PPC_BOOK3S
@@ -262,7 +262,7 @@ syscall_dotrace:
ld r7,GPR7(r1)
ld r8,GPR8(r1)
addi r9,r1,STACK_FRAME_OVERHEAD
- clrrdi r10,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r10, r1)
ld r10,TI_FLAGS(r10)
b .Lsyscall_dotrace_cont
@@ -499,7 +499,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
2:
#endif /* !CONFIG_PPC_BOOK3S */
- clrrdi r7,r8,THREAD_SHIFT /* base of new stack */
+ CURRENT_THREAD_INFO(r7, r8) /* base of new stack */
/* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE
because we don't need to leave the 288-byte ABI gap at the
top of the kernel stack. */
@@ -559,7 +559,7 @@ _GLOBAL(ret_from_except_lite)
#endif /* CONFIG_PPC_BOOK3E */
#ifdef CONFIG_PREEMPT
- clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */
+ CURRENT_THREAD_INFO(r9, r1)
li r0,_TIF_NEED_RESCHED /* bits to check */
ld r3,_MSR(r1)
ld r4,TI_FLAGS(r9)
@@ -574,7 +574,7 @@ _GLOBAL(ret_from_except_lite)
beq restore /* if not, just restore regs and return */
/* Check current_thread_info()->flags */
- clrrdi r9,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r9, r1)
ld r4,TI_FLAGS(r9)
andi. r0,r4,_TIF_USER_WORK_MASK
bne do_work
@@ -782,7 +782,7 @@ do_work:
1: bl .preempt_schedule_irq
/* Re-test flags and eventually loop */
- clrrdi r9,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r9, r1)
ld r4,TI_FLAGS(r9)
andi. r0,r4,_TIF_NEED_RESCHED
bne 1b
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 7215cc2..3b60028 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -222,7 +222,7 @@ exc_##n##_bad_stack: \
* interrupts happen before the wait instruction.
*/
#define CHECK_NAPPING() \
- clrrdi r11,r1,THREAD_SHIFT; \
+ CURRENT_THREAD_INFO(r11, r1)
ld r10,TI_LOCAL_FLAGS(r11); \
andi. r9,r10,_TLF_NAPPING; \
beq+ 1f; \
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 1c06d29..8ad3468 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -851,7 +851,7 @@ BEGIN_FTR_SECTION
bne- do_ste_alloc /* If so handle it */
END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
- clrrdi r11,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r11, r1)
lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
bne 77f /* then don't call hash_page now */
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 1f4434a..7e7bd88 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -192,7 +192,7 @@ _ENTRY(__early_start)
li r0,0
stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
- rlwinm r22,r1,0,0,31-THREAD_SHIFT /* current thread_info */
+ CURRENT_THREAD_INFO(r22, r1)
stw r24, TI_CPU(r22)
bl early_init
diff --git a/arch/powerpc/kernel/idle_6xx.S b/arch/powerpc/kernel/idle_6xx.S
index 15c611d..1686916 100644
--- a/arch/powerpc/kernel/idle_6xx.S
+++ b/arch/powerpc/kernel/idle_6xx.S
@@ -135,7 +135,7 @@ BEGIN_FTR_SECTION
DSSALL
sync
END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
- rlwinm r9,r1,0,0,31-THREAD_SHIFT /* current thread_info */
+ CURRENT_THREAD_INFO(r9, r1)
lwz r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
ori r8,r8,_TLF_NAPPING /* so when we take an exception */
stw r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
@@ -158,7 +158,7 @@ _GLOBAL(power_save_ppc32_restore)
stw r9,_NIP(r11) /* make it do a blr */
#ifdef CONFIG_SMP
- rlwinm r12,r11,0,0,31-THREAD_SHIFT
+ CURRENT_THREAD_INFO(r12, r11)
lwz r11,TI_CPU(r12) /* get cpu number * 4 */
slwi r11,r11,2
#else
diff --git a/arch/powerpc/kernel/idle_book3e.S b/arch/powerpc/kernel/idle_book3e.S
index ff007b5..4c7cb400 100644
--- a/arch/powerpc/kernel/idle_book3e.S
+++ b/arch/powerpc/kernel/idle_book3e.S
@@ -60,7 +60,7 @@ _GLOBAL(book3e_idle)
1: /* Let's set the _TLF_NAPPING flag so interrupts make us return
* to the right spot
*/
- clrrdi r11,r1,THREAD_SHIFT
+ CURRENT_THREAD_INFO(r11, r1)
ld r10,TI_LOCAL_FLAGS(r11)
ori r10,r10,_TLF_NAPPING
std r10,TI_LOCAL_FLAGS(r11)
diff --git a/arch/powerpc/kernel/idle_e500.S b/arch/powerpc/kernel/idle_e500.S
index 4f0ab85..1544866 100644
--- a/arch/powerpc/kernel/idle_e500.S
+++ b/arch/powerpc/kernel/idle_e500.S
@@ -21,7 +21,7 @@
.text
_GLOBAL(e500_idle)
- rlwinm r3,r1,0,0,31-THREAD_SHIFT /* current thread_info */
+ CURRENT_THREAD_INFO(r3, r1)
lwz r4,TI_LOCAL_FLAGS(r3) /* set napping bit */
ori r4,r4,_TLF_NAPPING /* so when we take an exception */
stw r4,TI_LOCAL_FLAGS(r3) /* it will return to our caller */
@@ -96,7 +96,7 @@ _GLOBAL(power_save_ppc32_restore)
stw r9,_NIP(r11) /* make it do a blr */
#ifdef CONFIG_SMP
- rlwinm r12,r1,0,0,31-THREAD_SHIFT
+ CURRENT_THREAD_INFO(r12, r1)
lwz r11,TI_CPU(r12) /* get cpu number * 4 */
slwi r11,r11,2
#else
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index 2c71b0f..e3edaa1 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -59,7 +59,7 @@ BEGIN_FTR_SECTION
DSSALL
sync
END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
- clrrdi r9,r1,THREAD_SHIFT /* current thread_info */
+ CURRENT_THREAD_INFO(r9, r1)
ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
ori r8,r8,_TLF_NAPPING /* so when we take an exception */
std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 386d57f..407e293 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -179,7 +179,7 @@ _GLOBAL(low_choose_750fx_pll)
mtspr SPRN_HID1,r4
/* Store new HID1 image */
- rlwinm r6,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r6, r1)
lwz r6,TI_CPU(r6)
slwi r6,r6,2
addis r6,r6,nap_save_hid1@ha
@@ -699,7 +699,7 @@ _GLOBAL(kernel_thread)
#ifdef CONFIG_SMP
_GLOBAL(start_secondary_resume)
/* Reset stack */
- rlwinm r1,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
+ CURRENT_THREAD_INFO(r1, r1)
addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
li r3,0
stw r3,0(r1) /* Zero the stack frame pointer */
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index 0fa2ef7..c8c7a04 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -161,11 +161,7 @@
mtspr SPRN_EPLC, r8
/* disable preemption, so we are sure we hit the fixup handler */
-#ifdef CONFIG_PPC64
- clrrdi r8,r1,THREAD_SHIFT
-#else
- rlwinm r8,r1,0,0,31-THREAD_SHIFT /* current thread_info */
-#endif
+ CURRENT_THREAD_INFO(r8, r1)
li r7, 1
stw r7, TI_PREEMPT(r8)
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index b13d589..115347f 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -184,7 +184,7 @@ _GLOBAL(add_hash_page)
add r3,r3,r0 /* note create_hpte trims to 24 bits */
#ifdef CONFIG_SMP
- rlwinm r8,r1,0,0,(31-THREAD_SHIFT) /* use cpu number to make tag */
+ CURRENT_THREAD_INFO(r8, r1) /* use cpu number to make tag */
lwz r8,TI_CPU(r8) /* to go in mmu_hash_lock */
oris r8,r8,12
#endif /* CONFIG_SMP */
@@ -545,7 +545,7 @@ _GLOBAL(flush_hash_pages)
#ifdef CONFIG_SMP
addis r9,r7,mmu_hash_lock@ha
addi r9,r9,mmu_hash_lock@l
- rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r8, r1)
add r8,r8,r7
lwz r8,TI_CPU(r8)
oris r8,r8,9
@@ -639,7 +639,7 @@ _GLOBAL(flush_hash_patch_B)
*/
_GLOBAL(_tlbie)
#ifdef CONFIG_SMP
- rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r8, r1)
lwz r8,TI_CPU(r8)
oris r8,r8,11
mfmsr r10
@@ -677,7 +677,7 @@ _GLOBAL(_tlbie)
*/
_GLOBAL(_tlbia)
#if defined(CONFIG_SMP)
- rlwinm r8,r1,0,0,(31-THREAD_SHIFT)
+ CURRENT_THREAD_INFO(r8, r1)
lwz r8,TI_CPU(r8)
oris r8,r8,10
mfmsr r10
diff --git a/arch/powerpc/sysdev/6xx-suspend.S b/arch/powerpc/sysdev/6xx-suspend.S
index 21cda08..cf48e9c 100644
--- a/arch/powerpc/sysdev/6xx-suspend.S
+++ b/arch/powerpc/sysdev/6xx-suspend.S
@@ -29,7 +29,7 @@ _GLOBAL(mpc6xx_enter_standby)
ori r5, r5, ret_from_standby@l
mtlr r5
- rlwinm r5, r1, 0, 0, 31-THREAD_SHIFT
+ CURRENT_THREAD_INFO(r5, r1)
lwz r6, TI_LOCAL_FLAGS(r5)
ori r6, r6, _TLF_SLEEPING
stw r6, TI_LOCAL_FLAGS(r5)
--
1.7.3.4
^ permalink raw reply related
* Re: 3.5.0-rc5: BUG: soft lockup - CPU#0 stuck for 22s
From: Christian Kujau @ 2012-07-02 18:46 UTC (permalink / raw)
To: Paul E. McKenney, zhong; +Cc: arjan, linuxppc-dev, LKML
In-Reply-To: <20120702164544.GJ2508@linux.vnet.ibm.com>
On Mon, 2 Jul 2012 at 09:45, Paul E. McKenney wrote:
> On Sun, Jul 01, 2012 at 11:30:40PM -0700, Christian Kujau wrote:
> > On Mon, 2 Jul 2012 at 14:50, Benjamin Herrenschmidt wrote:
> > > Interesting... I observed something roughly similar on a dual G4
> > > the other day associated with a 30s to 1mn pause during boot. RCU
> > > was complaining loudly.
> > >
> > > In my case, it did continue booting normally, is that the case for you ?
> >
> > No, in my case it stopped booting, though there was no "panic" message.
> >
> > > Also if I compile the kernel without CONFIG_SMP, it did go away as well,
> > > do you observe that too ?
> >
> > This PoweBook G4 is UP anyway and I'm always building w/o CONFIG_SMP.
> >
> > > I don't have a spare cycle to investigate this problem this week I'm
> > > afraid, it might help if you could try a bisection though.
> >
> > Yes, I've started a bisection already and will report back.
> >
> > FYI, I've put a netconsole-log below from another boot (in the
> > middle of a bisection), the instruction dump is slightly more complete.
>
> Li Zhong posted a patch to fix this (async_synchronize_full() below):
>
> https://lkml.org/lkml/2012/7/2/32
>
> This gets rid of this problem on my UP testing. If it works for you,
> please give Li Zhong a Tested-by.
Great! When applied to -rc5 Li's patch fixes it for my powerpc UP system
as well.
Tested-by: Christian Kujau <lists@nerdbynature.de>
Many thanks!
Christian.
> > [ 40.345973] BUG: soft lockup - CPU#0 stuck for 22s! [modprobe:691]
> > [ 40.347737] Modules linked in: sd_mod arc4 firewire_sbp2 scsi_mod b43 mac80211 cfg80211
> > [ 40.349443] irq event stamp: 65779272
> > [ 40.351156] hardirqs last enabled at (65779271): [<c052fae8>] _raw_spin_unlock_irqrestore+0x40/0x9c
> > [ 40.352911] hardirqs last disabled at (65779272): [<c0011648>] reenable_mmu+0x40/0x98
> > [ 40.354649] softirqs last enabled at (65769864): [<c000f3c0>] call_do_softirq+0x14/0x24
> > [ 40.356386] softirqs last disabled at (65769857): [<c000f3c0>] call_do_softirq+0x14/0x24
> > [ 40.358098] NIP: c005ee64 LR: c005ee54 CTR: c009c578
> > [ 40.359788] REGS: eece3d70 TRAP: 0901 Not tainted (3.4.0-05609-gc80ddb5)
> > [ 40.361517] MSR: 00009032 <EE,ME,IR,DR,RI> CR: 24042482 XER: 00000000
> > [ 40.363261] TASK = eec30b80[691] 'modprobe' THREAD: eece2000#012
> > [ 40.363261] GPR00: c005ee54 eece3e20 eec30b80 00000000 00000002 c005edd0 00000000 00000000 #012
> > [ 40.363261] GPR08: 00000000 eece2000 00000000 00000001 24042488
> > [ 40.368310] NIP [c005ee64] async_synchronize_cookie_domain+0x70/0x1f4
> > [ 40.369978] LR [c005ee54] async_synchronize_cookie_domain+0x60/0x1f4
> > [ 40.371614] Call Trace:
> > [ 40.373226] [eece3e20] [c005ee54] async_synchronize_cookie_domain+0x60/0x1f4 (unreliable)
> > [ 40.374884] [eece3e70] [c005f034] async_synchronize_full+0x3c/0x74
> > [ 40.376524] [eece3e90] [c0082790] sys_init_module+0x178/0x1164
> > [ 40.378151] [eece3f40] [c00117a8] ret_from_syscall+0x0/0x38
> > [ 40.379783] --- Exception: c01 at 0xff5d694#012[ 40.379783] LR = 0x100041c0
> > [ 40.382928] Instruction dump:
> > [ 40.384489] 93a10044 419e0014 3d20c06f 8009d020 2f800000 419e017c 7fc3f378 4bfffed9
> > [ 40.386081] 7f9f1840 419d0060 7f9f1800 419e0050 <881bf008> 2f800000 419e0014 3d20c06f
--
BOFH excuse #280:
Traceroute says that there is a routing problem in the backbone. It's not our problem.
^ permalink raw reply
* Re: [PATCH] P1021: set IReady in QE Microcode Upload
From: Timur Tabi @ 2012-07-02 18:19 UTC (permalink / raw)
To: Kumar Gala
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Kokoris, Ioannis
In-Reply-To: <9508ABD9-607F-4D41-A169-743ADE625F4A@kernel.crashing.org>
Kumar Gala wrote:
>> > No, I forgot all about it. I'll try it today, assuming the lone 8323
>> > board in the board farm still works.
> Do you remember if you ever tested this?
Well, I tried to test it. We have an 83xx board that has a QE UART that
needs firmware uploaded, but I don't know how to connect that QE to an
actual RS232 port. It needs a riser which I don't think we have.
I can verify that the QE UART driver does not hang which this patch, and
that it appears to still be sending data, but I have no way of knowing for
sure.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCH 1/2] powerpc/mpc85xx: p1022ds support the MTD for NOR and NAND flash
From: Kumar Gala @ 2012-07-02 17:54 UTC (permalink / raw)
To: <Chang-Ming.Huang@freescale.com>; +Cc: linuxppc-dev
In-Reply-To: <1334626955-8069-1-git-send-email-Chang-Ming.Huang@freescale.com>
On Apr 16, 2012, at 8:42 PM, <Chang-Ming.Huang@freescale.com> =
<Chang-Ming.Huang@freescale.com> wrote:
> From: Jerry Huang <Chang-Ming.Huang@freescale.com>
>=20
> The compatilbe 'simple-bus' is removed from the latest DTS for NAND =
and
> NOR flash partition, so we must add the new compatilbe support for =
p1022ds,
> otherwise, the kernel can't parse the partition of NOR and NAND flash.
>=20
> Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
> ---
> arch/powerpc/platforms/85xx/p1022_ds.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
If this is still relevant, please resubmit against my powerpc.git 'next' =
branch.
- k=
^ permalink raw reply
* Re: 3.5.0-rc5: BUG: soft lockup - CPU#0 stuck for 22s
From: Paul E. McKenney @ 2012-07-02 16:45 UTC (permalink / raw)
To: Christian Kujau; +Cc: linuxppc-dev, LKML
In-Reply-To: <alpine.DEB.2.01.1207012326110.5568@trent.utfs.org>
On Sun, Jul 01, 2012 at 11:30:40PM -0700, Christian Kujau wrote:
> On Mon, 2 Jul 2012 at 14:50, Benjamin Herrenschmidt wrote:
> > Interesting... I observed something roughly similar on a dual G4
> > the other day associated with a 30s to 1mn pause during boot. RCU
> > was complaining loudly.
> >
> > In my case, it did continue booting normally, is that the case for you ?
>
> No, in my case it stopped booting, though there was no "panic" message.
>
> > Also if I compile the kernel without CONFIG_SMP, it did go away as well,
> > do you observe that too ?
>
> This PoweBook G4 is UP anyway and I'm always building w/o CONFIG_SMP.
>
> > I don't have a spare cycle to investigate this problem this week I'm
> > afraid, it might help if you could try a bisection though.
>
> Yes, I've started a bisection already and will report back.
>
> FYI, I've put a netconsole-log below from another boot (in the
> middle of a bisection), the instruction dump is slightly more complete.
Li Zhong posted a patch to fix this (async_synchronize_full() below):
https://lkml.org/lkml/2012/7/2/32
This gets rid of this problem on my UP testing. If it works for you,
please give Li Zhong a Tested-by.
Thanx, Paul
> Thanks!
> Christian.
>
> [ 40.345973] BUG: soft lockup - CPU#0 stuck for 22s! [modprobe:691]
> [ 40.347737] Modules linked in: sd_mod arc4 firewire_sbp2 scsi_mod b43 mac80211 cfg80211
> [ 40.349443] irq event stamp: 65779272
> [ 40.351156] hardirqs last enabled at (65779271): [<c052fae8>] _raw_spin_unlock_irqrestore+0x40/0x9c
> [ 40.352911] hardirqs last disabled at (65779272): [<c0011648>] reenable_mmu+0x40/0x98
> [ 40.354649] softirqs last enabled at (65769864): [<c000f3c0>] call_do_softirq+0x14/0x24
> [ 40.356386] softirqs last disabled at (65769857): [<c000f3c0>] call_do_softirq+0x14/0x24
> [ 40.358098] NIP: c005ee64 LR: c005ee54 CTR: c009c578
> [ 40.359788] REGS: eece3d70 TRAP: 0901 Not tainted (3.4.0-05609-gc80ddb5)
> [ 40.361517] MSR: 00009032 <EE,ME,IR,DR,RI> CR: 24042482 XER: 00000000
> [ 40.363261] TASK = eec30b80[691] 'modprobe' THREAD: eece2000#012
> [ 40.363261] GPR00: c005ee54 eece3e20 eec30b80 00000000 00000002 c005edd0 00000000 00000000 #012
> [ 40.363261] GPR08: 00000000 eece2000 00000000 00000001 24042488
> [ 40.368310] NIP [c005ee64] async_synchronize_cookie_domain+0x70/0x1f4
> [ 40.369978] LR [c005ee54] async_synchronize_cookie_domain+0x60/0x1f4
> [ 40.371614] Call Trace:
> [ 40.373226] [eece3e20] [c005ee54] async_synchronize_cookie_domain+0x60/0x1f4 (unreliable)
> [ 40.374884] [eece3e70] [c005f034] async_synchronize_full+0x3c/0x74
> [ 40.376524] [eece3e90] [c0082790] sys_init_module+0x178/0x1164
> [ 40.378151] [eece3f40] [c00117a8] ret_from_syscall+0x0/0x38
> [ 40.379783] --- Exception: c01 at 0xff5d694#012[ 40.379783] LR = 0x100041c0
> [ 40.382928] Instruction dump:
> [ 40.384489] 93a10044 419e0014 3d20c06f 8009d020 2f800000 419e017c 7fc3f378 4bfffed9
> [ 40.386081] 7f9f1840 419d0060 7f9f1800 419e0050 <881bf008> 2f800000 419e0014 3d20c06f
>
>
> --
> BOFH excuse #241:
>
> _Rosin_ core solder? But...
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox