* powerpc: find and destroy possible stale kernel added properties
2008-07-10 21:12 [RFC] (almost) booting allyesconfig -- please don't poke super-io without request_region Milton Miller
@ 2008-07-10 21:22 ` Milton Miller
0 siblings, 0 replies; 3+ messages in thread
From: Milton Miller @ 2008-07-10 21:22 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
Because we copy the image using the kernels virtual memory system, we
require kexec user space to avoid overwriting the static kernel image, tce
tables, and the hash table. Kexec userspace gets this information by
reading propertys the kernel adds, but does not filter these propertys when
starting the next kernel.
When the second kernel trys to add its propertys, the export via
/proc/device-tree is hidden by the pre-existing but stale value 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 check
Search and remove these stale properties before adding the new values.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
While there is an override flag to tell kexec a minimum memory to use, that
is a crude workaround and 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);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* powerpc: find and destroy possible stale kernel added properties
@ 2008-10-21 1:37 Milton Miller
2008-10-21 14:21 ` Matt Sealey
0 siblings, 1 reply; 3+ messages in thread
From: Milton Miller @ 2008-10-21 1:37 UTC (permalink / raw)
To: linuxppc-dev
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 <miltonm@bga.com>
---
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);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: powerpc: find and destroy possible stale kernel added properties
2008-10-21 1:37 powerpc: find and destroy possible stale kernel added properties Milton Miller
@ 2008-10-21 14:21 ` Matt Sealey
0 siblings, 0 replies; 3+ messages in thread
From: Matt Sealey @ 2008-10-21 14:21 UTC (permalink / raw)
To: Milton Miller; +Cc: linuxppc-dev
Milton Miller wrote:
>
> + /* remove any stale propertys so ours can be found */
s/propertys/properties
?
--
Matt Sealey <matt@genesi-usa.com>
Genesi, Manager, Developer Relations
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-10-21 14:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-21 1:37 powerpc: find and destroy possible stale kernel added properties Milton Miller
2008-10-21 14:21 ` Matt Sealey
-- strict thread matches above, loose matches on Subject: below --
2008-07-10 21:12 [RFC] (almost) booting allyesconfig -- please don't poke super-io without request_region Milton Miller
2008-07-10 21:22 ` powerpc: find and destroy possible stale kernel added properties Milton Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).