linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Haren Myneni <haren@us.ibm.com>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: paulus@samba.org, linuxppc-dev@ozlabs.org
Subject: Re: _machine removal breaks kexec?
Date: Mon, 03 Apr 2006 11:18:45 -0700	[thread overview]
Message-ID: <44316705.1040202@us.ibm.com> (raw)
In-Reply-To: <1078253E-4B9E-4432-86E3-82B01A4B68D1@kernel.crashing.org>

[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]

Kumar Gala wrote:

>On Apr 3, 2006, at 11:16 AM, Benjamin Herrenschmidt wrote:
>
>  
>
>>On Mon, 2006-04-03 at 11:40 +1000, Anton Blanchard wrote:
>>    
>>
>>>Hi,
>>>
>>>It looks like the _machine removal broke kexec:
>>>
>>> # kexec -l vmlinux
>>> /proc/device-tree/chosen/linux,platform: No such file or directory
>>>
>>>The kexec tools seem to want the linux,platform property:
>>>
>>>        /* if LPAR, no need to read any more from /chosen */
>>>        if (platform != PLATFORM_PSERIES) {
>>>                closedir(cdir);
>>>                continue;
>>>        }
>>>      
>>>
>>Damn.... the platform numbers are gone, we need to fix that. (And  
>>nobody
>>complained when I posted the patch twice over the past couple of  
>>monthes
>>btw).
>>
>>I suppose kexec needs to look for /rtas/hypertas or such ..
>>    
>>
>
>uugh, can we make kexec not depend on something that embedded systems  
>would also have.
>  
>
Basically, kexec-tools looks the platform property to determine whether 
to read tce-base, tce-size and htab-* properties. The attached patch 
find out the platform info based on /proc/device-tree/chosen/htab-base 
property. Not tested yet.
Kumar,  kexec-tools completely depends on device-tree.  Not sure whether 
the embedded system exports the device-tree.

Thanks
Haren

>- k
>_______________________________________________
>Linuxppc-dev mailing list
>Linuxppc-dev@ozlabs.org
>https://ozlabs.org/mailman/listinfo/linuxppc-dev
>  
>


[-- Attachment #2: ppc64-kexec-tools-rm-platform-fix.patch --]
[-- Type: text/x-patch, Size: 1621 bytes --]

--- ./kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c.orig	2006-04-07 17:39:08.000000000 -0700
+++ ./kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c	2006-04-07 17:36:34.000000000 -0700
@@ -40,7 +40,7 @@
 
 static struct exclude_range exclude_range[MAX_MEMORY_RANGES];
 static unsigned long long rmo_top;
-static unsigned int platform;
+static unsigned int platform = PLATFORM_PSERIES_LPAR;
 static struct memory_range memory_range[MAX_MEMORY_RANGES];
 static struct memory_range base_memory_range[MAX_MEMORY_RANGES];
 unsigned long long memory_max = 0;
@@ -179,8 +179,13 @@ static int get_devtree_details(unsigned 
 	DIR *dir, *cdir;
 	FILE *file;
 	struct dirent *dentry;
+	struct stat sbuf;
+
 	int n, i = 0;
 
+	if (!stat("/proc/device-tree/chosen/linux,htab-base", &sbuf))
+		platform = PLATFORM_PSERIES;
+
 	if ((dir = opendir(device_tree)) == NULL) {
 		perror(device_tree);
 		return -1;
@@ -201,26 +206,6 @@ static int get_devtree_details(unsigned 
 		}
 
 		if (strncmp(dentry->d_name, "chosen", 6) == 0) {
-			/* get platform details from /chosen node */
-			strcat(fname, "/linux,platform");
-			if ((file = fopen(fname, "r")) == NULL) {
-				perror(fname);
-				closedir(cdir);
-				closedir(dir);
-				return -1;
-			}
-			if (fread(&platform, sizeof(int), 1, file) != 1) {
-				perror(fname);
-				fclose(file);
-				closedir(cdir);
-				closedir(dir);
-				return -1;
-			}
-			fclose(file);
-
-			memset(fname, 0, sizeof(fname));
-			strcpy(fname, device_tree);
-			strcat(fname, dentry->d_name);
 			strcat(fname, "/linux,kernel-end");
 			if ((file = fopen(fname, "r")) == NULL) {
 				perror(fname);

  reply	other threads:[~2006-04-03 18:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-03  1:40 _machine removal breaks kexec? Anton Blanchard
2006-04-03 16:16 ` Benjamin Herrenschmidt
2006-04-03 17:32   ` Kumar Gala
2006-04-03 18:18     ` Haren Myneni [this message]
2006-04-04  5:40       ` Michael Ellerman
2006-04-04  6:15         ` Haren Myneni
2006-04-04 12:05       ` Benjamin Herrenschmidt
2006-04-03 23:16     ` Segher Boessenkool
2006-04-04  0:43       ` Kumar Gala
2006-04-04 12:04     ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44316705.1040202@us.ibm.com \
    --to=haren@us.ibm.com \
    --cc=galak@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).