From patchwork Tue Oct 21 01:37:03 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milton Miller X-Patchwork-Id: 5173 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 6B391DDDF0 for ; Tue, 21 Oct 2008 12:39:55 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from sullivan.realtime.net (sullivan.realtime.net [205.238.132.226]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1D900DDDEC for ; Tue, 21 Oct 2008 12:37:10 +1100 (EST) Received: from sullivan.realtime.net (localhost [127.0.0.1]) by sullivan.realtime.net (8.13.1/8.9.3) with ESMTP id m9L1b38s045439; Mon, 20 Oct 2008 20:37:03 -0500 (CDT) (envelope-from miltonm@sullivan.realtime.net) Received: (from miltonm@localhost) by sullivan.realtime.net (8.13.1/8.12.7/Submit) id m9L1b31Z045438; Mon, 20 Oct 2008 20:37:03 -0500 (CDT) Date: Mon, 20 Oct 2008 20:37:03 -0500 (CDT) From: Milton Miller Message-id: To: linuxppc-dev@ozlabs.org Subject: powerpc: find and destroy possible stale kernel added properties X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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. Signed-off-by: Milton Miller --- 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. --- diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index a168514..4bd8b4f 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c @@ -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);