Hi All,
How does following series of patches look like. I have moved
elfcorehdr_addr out of vmcore.c and pushed it to arch dependent section
of crash dump to make sure that it can be worked with even when
CONFIG_PROC_VMCORE is disabled and CONFIG_CRASH_DUMP is enabled.
I tested it on x86_64. Compile tested it on i386 and ppc64. ia64 and
sh versions are completely untested.
Thanks
Vivek
o elfcorehdr_addr is used by not only the code under CONFIG_PROC_VMCORE but
also by the code which is not inside CONFIG_PROC_VMCORE. For example,
is_kdump_kernel() is used by powerpc code to determine if kernel is booting
after a panic then use previous kernel's TCE table. So even if
CONFIG_PROC_VMCORE is not set in second kernel, one should be able to
correctly determine that we are booting after a panic and setup calgary
iommu accordingly.
o So remove the assumption that elfcorehdr_addr is under CONFIG_PROC_VMCORE.
o Move definition of elfcorehdr_addr to arch dependent crash files.
(Unfortunately crash dump does not have an arch independent file otherwise
that would have been the best place).
o kexec.c is not the right place as one can Have CRASH_DUMP enabled in
second kernel without KEXEC being enabled.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
fs/proc/vmcore.c | 3 ---
include/linux/crash_dump.h | 14 ++++++++++----
2 files changed, 10 insertions(+), 7 deletions(-)
diff -puN fs/proc/vmcore.c~remove-elfcore-hdr-addr-definition-vmcore fs/proc/vmcore.c
@@ -32,9 +32,6 @@ static size_t elfcorebuf_sz;/* Total size of vmcore file. */staticu64vmcore_size;-/* Stores the physical address of elf header of crash image. */-unsignedlonglongelfcorehdr_addr=ELFCORE_ADDR_MAX;-structproc_dir_entry*proc_vmcore=NULL;/* Reads a page from the oldmem device from given offset. */
o Move elfcorehdr_addr definition in arch dependent crash dump file. This is
equivalent to defining elfcorehdr_addr under CONFIG_CRASH_DUMP instead of
CONFIG_PROC_VMCORE. This is needed by is_kdump_kernel() which can be
used irrespective of the fact whether CONFIG_PROC_VMCORE is enabled or
not.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
arch/x86/kernel/crash_dump_32.c | 3 +++
arch/x86/kernel/crash_dump_64.c | 3 +++
arch/x86/kernel/setup.c | 8 +++++++-
3 files changed, 13 insertions(+), 1 deletion(-)
diff -puN arch/x86/kernel/setup.c~fix-elfcorehdr_addr-parsing-x86 arch/x86/kernel/setup.c
@@ -13,6 +13,9 @@staticvoid*kdump_buf_page;+/* Stores the physical address of elf header of crash image. */+unsignedlonglongelfcorehdr_addr=ELFCORE_ADDR_MAX;+/***copy_oldmem_page-copyonepagefrom"oldmem"*@pfn:pageframenumbertobecopied
@@ -11,6 +11,9 @@#include<asm/uaccess.h>#include<asm/io.h>+/* Stores the physical address of elf header of crash image. */+unsignedlonglongelfcorehdr_addr=ELFCORE_ADDR_MAX;+/***copy_oldmem_page-copyonepagefrom"oldmem"*@pfn:pageframenumbertobecopied
o Move elfcorehdr_addr definition in arch dependent crash dump file. This is
equivalent to defining elfcorehdr_addr under CONFIG_CRASH_DUMP instead of
CONFIG_PROC_VMCORE. This is needed by is_kdump_kernel() which can be
used irrespective of the fact whether CONFIG_PROC_VMCORE is enabled or
not.
o I don't see sh setup code parsing the command line for elfcorehdr_addr. I
am wondering how does vmcore interface work on sh. Anyway, I am atleast
defining elfcoredhr_addr so that compilation is not broken on sh.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
arch/sh/kernel/crash_dump.c | 3 +++
1 file changed, 3 insertions(+)
diff -puN arch/sh/kernel/crash_dump.c~fix-elfcorehdr_addr-sh arch/sh/kernel/crash_dump.c
@@ -10,6 +10,9 @@#include<linux/io.h>#include<asm/uaccess.h>+/* Stores the physical address of elf header of crash image. */+unsignedlonglongelfcorehdr_addr=ELFCORE_ADDR_MAX;+/***copy_oldmem_page-copyonepagefrom"oldmem"*@pfn:pageframenumbertobecopied
o Move elfcorehdr_addr definition in arch dependent crash dump file. This is
equivalent to defining elfcorehdr_addr under CONFIG_CRASH_DUMP instead of
CONFIG_PROC_VMCORE. This is needed by is_kdump_kernel() which can be
used irrespective of the fact whether CONFIG_PROC_VMCORE is enabled or
not.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
arch/ia64/kernel/setup.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff -puN arch/ia64/kernel/setup.c~fix-elfcorehdr_addr-parsing-ia64 arch/ia64/kernel/setup.c
o Move elfcorehdr_addr definition in arch dependent crash dump file. This is
equivalent to defining elfcorehdr_addr under CONFIG_CRASH_DUMP instead of
CONFIG_PROC_VMCORE. This is needed by is_kdump_kernel() which can be
used irrespective of the fact whether CONFIG_PROC_VMCORE is enabled or
not.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
arch/powerpc/kernel/crash_dump.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff -puN arch/powerpc/kernel/crash_dump.c~fix-elfcorehdr_addr-parsing-ppc64 arch/powerpc/kernel/crash_dump.c
From: Simon Horman <horms@verge.net.au> Date: 2008-07-29 04:42:56
On Mon, Jul 28, 2008 at 05:13:14PM -0400, Vivek Goyal wrote:
quoted hunk
o Move elfcorehdr_addr definition in arch dependent crash dump file. This is
equivalent to defining elfcorehdr_addr under CONFIG_CRASH_DUMP instead of
CONFIG_PROC_VMCORE. This is needed by is_kdump_kernel() which can be
used irrespective of the fact whether CONFIG_PROC_VMCORE is enabled or
not.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
arch/ia64/kernel/setup.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff -puN arch/ia64/kernel/setup.c~fix-elfcorehdr_addr-parsing-ia64 arch/ia64/kernel/setup.c
@@ -478,7 +478,12 @@ static __init int setup_nomca(char *s)}early_param("nomca",setup_nomca);-#ifdef CONFIG_PROC_VMCORE+/*+*Note:elfcorehdr_addrisnotjustlimitedtovmcore.Itisalsousedby+*is_kdump_kernel()todetermineifwearebootingafterapanic.Hence+*ifdefitunderCONFIG_CRASH_DUMPandnotCONFIG_PROC_VMCORE.+*/+#ifdef CONFIG_CRASH_DUMP/* elfcorehdr= specifies the location of elf core header*storedbythecrashedkernel.*/
@@ -491,7 +496,9 @@ static int __init parse_elfcorehdr(char return0;}early_param("elfcorehdr",parse_elfcorehdr);+#endif+#ifdef CONFIG_PROC_VMCOREint__initreserve_elfcorehdr(unsignedlong*start,unsignedlong*end){unsignedlonglength;
_
Hi Vivek,
I think that you also need the following in arch/ia64/kernel/crash_dump.c.
With this change your code compiles on ia64.
Signed-off-by: Simon Horman <horms@verge.net.au>
Index: linux-2.6/arch/ia64/kernel/crash_dump.c
===================================================================
@@ -8,10 +8,14 @@#include<linux/errno.h>#include<linux/types.h>+#include<linux/crash_dump.h>#include<asm/page.h>#include<asm/uaccess.h>+/* Stores the physical address of elf header of crash image. */+unsignedlonglongelfcorehdr_addr=ELFCORE_ADDR_MAX;+/***copy_oldmem_page-copyonepagefrom"oldmem"*@pfn:pageframenumbertobecopied
On Tue, Jul 29, 2008 at 02:42:43PM +1000, Simon Horman wrote:
On Mon, Jul 28, 2008 at 05:13:14PM -0400, Vivek Goyal wrote:
quoted
o Move elfcorehdr_addr definition in arch dependent crash dump file. This is
equivalent to defining elfcorehdr_addr under CONFIG_CRASH_DUMP instead of
CONFIG_PROC_VMCORE. This is needed by is_kdump_kernel() which can be
used irrespective of the fact whether CONFIG_PROC_VMCORE is enabled or
not.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
arch/ia64/kernel/setup.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff -puN arch/ia64/kernel/setup.c~fix-elfcorehdr_addr-parsing-ia64 arch/ia64/kernel/setup.c
@@ -478,7 +478,12 @@ static __init int setup_nomca(char *s)}early_param("nomca",setup_nomca);-#ifdef CONFIG_PROC_VMCORE+/*+*Note:elfcorehdr_addrisnotjustlimitedtovmcore.Itisalsousedby+*is_kdump_kernel()todetermineifwearebootingafterapanic.Hence+*ifdefitunderCONFIG_CRASH_DUMPandnotCONFIG_PROC_VMCORE.+*/+#ifdef CONFIG_CRASH_DUMP/* elfcorehdr= specifies the location of elf core header*storedbythecrashedkernel.*/
@@ -491,7 +496,9 @@ static int __init parse_elfcorehdr(char return0;}early_param("elfcorehdr",parse_elfcorehdr);+#endif+#ifdef CONFIG_PROC_VMCOREint__initreserve_elfcorehdr(unsignedlong*start,unsignedlong*end){unsignedlonglength;
_
Hi Vivek,
I think that you also need the following in arch/ia64/kernel/crash_dump.c.
With this change your code compiles on ia64.
Signed-off-by: Simon Horman <horms@verge.net.au>
Thanks Simon. I had done these changes locally but somehow forgot to
include the changes in patches.
I will include these changes in my next posting of consolidated single
patch.
Thanks
Vivek
From: Paul Mundt <hidden> Date: 2008-07-29 14:20:28
On Mon, Jul 28, 2008 at 05:15:14PM -0400, Vivek Goyal wrote:
o Move elfcorehdr_addr definition in arch dependent crash dump file. This is
equivalent to defining elfcorehdr_addr under CONFIG_CRASH_DUMP instead of
CONFIG_PROC_VMCORE. This is needed by is_kdump_kernel() which can be
used irrespective of the fact whether CONFIG_PROC_VMCORE is enabled or
not.
o I don't see sh setup code parsing the command line for elfcorehdr_addr. I
am wondering how does vmcore interface work on sh. Anyway, I am atleast
defining elfcoredhr_addr so that compilation is not broken on sh.
Hmm, you are correct, it seems like it was either lost in a merge
somewhere or I simply neglected to check it in it when I was testing this
stuff initially. Thanks for noticing!
o Move elfcorehdr_addr definition in arch dependent crash dump file. This is
equivalent to defining elfcorehdr_addr under CONFIG_CRASH_DUMP instead of
CONFIG_PROC_VMCORE. This is needed by is_kdump_kernel() which can be
used irrespective of the fact whether CONFIG_PROC_VMCORE is enabled or
not.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
arch/x86/kernel/crash_dump_32.c | 3 +++
arch/x86/kernel/crash_dump_64.c | 3 +++
arch/x86/kernel/setup.c | 8 +++++++-
3 files changed, 13 insertions(+), 1 deletion(-)
the x86 bits look fine to me.
Acked-by: Ingo Molnar <redacted>
Ingo