Skip to contentSkip to conversation

powerpc: find and destroy possible stale kernel added properties

PATCH Milton Miller 2 participants 2 messages Oct 21, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

64 bit powerpc requires the kexec user space tools avoid overwriting the static kernel image and translation hash table when choosing where to put memory image data because it copies the data into place using the kernels virtual memory system. Kexec userspace determines these and other areas blocked by reading properties the kernel adds, but does not filter these properties when creating the device tree for the next kernel.

When the second kernel tries to add its values for these properties, the export via /proc/device-tree is hidden by the pre-existing but stale values from the flat tree. Kexec userspace reads the old property, allocates the new kernel at the old kernel's end, and gets rejected by the overlap check.

Search and remove these stale properties before adding the new values.

---
X-Patchwork-ID: 19579
tested in July, compile tested on next-20081017

While there is an override flag to tell kexec a minimum memory to use, that is a crude and manual workaround; this should be applied to stable.

---

arch/powerpc/kernel/machine_kexec_64.c +13 -0
index a168514..4bd8b4f 100644
@@ -312,11 +312,24 @@ static struct property kernel_end_prop = {
 static void __init export_htab_values(void)
 {
 	struct device_node *node;
+	struct property *prop;
 
 	node = of_find_node_by_path("/chosen");
 	if (!node)
 		return;
 
+	/* remove any stale propertys so ours can be found */
+	prop = of_find_property(node, kernel_end_prop.name, NULL);
+	if (prop)
+		prom_remove_property(node, prop);
+	prop = of_find_property(node, htab_base_prop.name, NULL);
+	if (prop)
+		prom_remove_property(node, prop);
+	prop = of_find_property(node, htab_size_prop.name, NULL);
+	if (prop)
+		prom_remove_property(node, prop);
+
+	/* information needed by userspace when using default_machine_kexec */
 	kernel_end = __pa(_end);
 	prom_add_property(node, &kernel_end_prop);
 
#1 lore raw

arch/powerpc/kernel/machine_kexec_64.c static struct property kernel_end_prop = { · line 321

Quoted 2 lines · Milton Miller
arch/powerpc/kernel/machine_kexec_64.c +1 -0
+	/* remove any stale propertys so ours can be found */

s/propertys/properties

?

Signature · 2 lines
Matt Sealey <[email protected]>
Genesi, Manager, Developer Relations