makedumpfile: few ARM fixes
Subsystems (2)
cover makedumpfile: few ARM fixes
Hi,
While using makedumpfile on ARM I found few issues from the current implementation. Basically the current implementation only works on 3G/1G VM split but not others.
These patches should make makedumpfile on ARM to work on other VM split values as well. I've tested with 1G/3G, 2G/2G, 3G/1G, and VMSPLIT_3G_OPT (2.7G/1.3G).
Regards,
MW
Mika Westerberg (2):
ARM: determine PAGE_OFFSET from _stext
ARM: don't depend on vmalloc_start
arm.c | 42 ++++++++++++++++++++---------------------- makedumpfile.h | 1 - 2 files changed, 20 insertions(+), 23 deletions(-)
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/2 ARM: determine PAGE_OFFSET from _stext
It is normal that we can have different values for PAGE_OFFSET depending on selected VM split. We avoid the hard-coded value and derive the value from the _stext symbol instead.
--- arm.c | 2 +- makedumpfile.h | 1 - 2 files changed, 1 insertions(+), 2 deletions(-)
arm.c +1 -1
@@ -81,7 +81,7 @@ get_machdep_info_arm(void) {unsigned long vmlist, vmalloc_start; - info->page_offset = __PAGE_OFFSET; + info->page_offset =SYMBOL (_stext) &0xffff0000UL ; info->max_physmem_bits = _MAX_PHYSMEM_BITS; info->kernel_start =SYMBOL (_stext); info->section_size_bits = _SECTION_SIZE_BITS;
makedumpfile.h +0 -1
@@ -507,7 +507,6 @@ do { \#define VMEMMAP_END (info->vmemmap_end)#ifdef __arm__ -#define __PAGE_OFFSET (0xc0000000)#define KVBASE_MASK (0xffff)#define KVBASE (SYMBOL(_stext) & ~KVBASE_MASK)#define _SECTION_SIZE_BITS (28)
Signature · 7 lines
1.5.6.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/2 ARM: don't depend on vmalloc_start
In reply to Mika WesterbergIn ARM, modules are placed in vmalloc'ed area right above user stack and the rest of the vmalloc area is somewhere after high_memory (this can be different on different platforms). Since this value is not stored in vmcoreinfo, we have no means to find out the correct value for vmalloc_start.
So we assume that all V->P translations are within the kernel direct mapped memory and use translation tables only when '--vtop' option is passed.
--- arm.c | 40 +++++++++++++++++++--------------------- 1 files changed, 19 insertions(+), 21 deletions(-)
arm.c +19 -21
@@ -86,6 +86,9 @@ get_machdep_info_arm(void) info->kernel_start =SYMBOL (_stext); info->section_size_bits = _SECTION_SIZE_BITS; +DEBUG_MSG ("page_offset : %lx\n" , info->page_offset); +DEBUG_MSG ("kernel_start : %lx\n" , info->kernel_start); +/* * For the compatibility, makedumpfile should run without the symbol * vmlist and the offset of vm_struct.addr if they are not necessary.
@@ -95,31 +98,28 @@ get_machdep_info_arm(void)return TRUE; } +/* +* In ARM the VMALLOC_START can be redefined per platform and we have no +* means to read that from the vmcore (there is currently no vmcoreinfo +* which specifies that), so we are not going to use vmalloc_start for +* anything. +*/ if (!readmem (VADDR ,SYMBOL (vmlist), &vmlist,sizeof (vmlist))) {ERRMSG ("Can't get vmlist.\n" ); -return FALSE; +return TRUE; }if (!readmem (VADDR , vmlist +OFFSET (vm_struct.addr), &vmalloc_start,sizeof (vmalloc_start))) {ERRMSG ("Can't get vmalloc_start.\n" ); -return FALSE; +return TRUE; } info->vmalloc_start = vmalloc_start; - -DEBUG_MSG ("page_offset : %lx\n" , info->page_offset); -DEBUG_MSG ("kernel_start : %lx\n" , info->kernel_start);DEBUG_MSG ("vmalloc_start: %lx\n" , vmalloc_start);return TRUE; } -static int -is_vmalloc_addr_arm (unsigned long vaddr) -{ -return (info->vmalloc_start && vaddr >= info->vmalloc_start); -} -/* * vtop_arm() - translate arbitrary virtual address to physical * @vaddr: virtual address to translate
@@ -184,17 +184,15 @@ vtop_arm(unsigned long vaddr)unsigned long long vaddr_to_paddr_arm (unsigned long vaddr) { -unsigned long long paddr =vaddr_to_paddr_general (vaddr); - -if (paddr !=NOT_PADDR ) -return paddr; - -if (is_vmalloc_addr_arm (vaddr)) - paddr =vtop_arm (vaddr); -else - paddr =__pa (vaddr); +/* +* Only use translation tables when user has explicitly requested us to +* perform translation for a given address. Otherwise we assume that the +* translation is done within the kernel direct mapped region. +*/ +if (info->vaddr_for_vtop == vaddr) +return vtop_arm (vaddr); -return paddr; +return __pa (vaddr); }#endif /* __arm__ */
Signature · 7 lines
1.5.6.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 2/2] ARM: don't depend on vmalloc_start
Hi Mika,
Thank you for your patches.
Some comments are below.
From: Mika Westerberg <[email protected]>
Subject: [PATCH 2/2] ARM: don't depend on vmalloc_start
Date: Thu, 4 Nov 2010 10:15:17 +0200
Quoted 38 lines
In ARM, modules are placed in vmalloc'ed area right above user stack and the rest of the vmalloc area is somewhere after
high_memory(this can be different on different platforms). Since this value is not stored in vmcoreinfo, we have no means to find out the correct value forvmalloc_start.So we assume that all
V->Ptranslations are within the kernel direct mapped memory and use translation tables only when '--vtop' option is passed.Signed-off-by Mika Westerberg <[email protected]>--- arm.c | 40 +++++++++++++++++++--------------------- 1 files changed, 19 insertions(+), 21 deletions(-)arm.c +9
-0@@ -86,6 +86,9 @@ get_machdep_info_arm(void) info->kernel_start =SYMBOL (_stext); info->section_size_bits = _SECTION_SIZE_BITS; +DEBUG_MSG ("page_offset : %lx\n" , info->page_offset); +DEBUG_MSG ("kernel_start : %lx\n" , info->kernel_start); +/* * For the compatibility, makedumpfile should run without the symbol * vmlist and the offset of vm_struct.addr if they are not necessary. @@ -95,31 +98,28 @@ get_machdep_info_arm(void)return TRUE; } +/* +* In ARM the VMALLOC_START can be redefined per platform and we have no +* means to read that from the vmcore (there is currently no vmcoreinfo +* which specifies that), so we are not going to use vmalloc_start for +* anything. +*/ if (!readmem (VADDR ,SYMBOL (vmlist), &vmlist,sizeof (vmlist))) {
arm.c get_machdep_info_arm(void) · line 115
Quoted 10 lines
arm.c +2
-2ERRMSG ("Can't get vmlist.\n" ); -return FALSE; +return TRUE; }if (!readmem (VADDR , vmlist +OFFSET (vm_struct.addr), &vmalloc_start,sizeof (vmalloc_start))) {ERRMSG ("Can't get vmalloc_start.\n" ); -return FALSE; +return TRUE; }
I think this code can be removed.
Because this code is easy to misunderstand for users and there are no means to check now.
arm.c get_machdep_info_arm(void) · line 118
Quoted 6 lines
arm.c +0
-3info->vmalloc_start = vmalloc_start; - -DEBUG_MSG ("page_offset : %lx\n" , info->page_offset); -DEBUG_MSG ("kernel_start : %lx\n" , info->kernel_start);DEBUG_MSG ("vmalloc_start: %lx\n" , vmalloc_start);
These codes too?
There is no need 'info->vmalloc_start' by removing is_vmalloc_addr_arm() in ARM now.
Quoted 27 lines
arm.c +1
-15return TRUE; } -static int -is_vmalloc_addr_arm (unsigned long vaddr) -{ -return (info->vmalloc_start && vaddr >= info->vmalloc_start); -} -/* * vtop_arm() - translate arbitrary virtual address to physical * @vaddr: virtual address to translate @@ -184,17 +184,15 @@ vtop_arm(unsigned long vaddr)unsigned long long vaddr_to_paddr_arm (unsigned long vaddr) { -unsigned long long paddr =vaddr_to_paddr_general (vaddr); - -if (paddr !=NOT_PADDR ) -return paddr; - -if (is_vmalloc_addr_arm (vaddr)) - paddr =vtop_arm (vaddr); -else - paddr =__pa (vaddr); +/*
arm.c vtop_arm(unsigned long vaddr) · line 196
Quoted 10 lines
arm.c +7
-1+* Only use translation tables when user has explicitly requested us to +* perform translation for a given address. Otherwise we assume that the +* translation is done within the kernel direct mapped region. +*/ +if (info->vaddr_for_vtop == vaddr) +return vtop_arm (vaddr); -return paddr; +return __pa (vaddr); }
Why do you use vtop tranlation only when '--vtop' option is passed? I think if you don't need vtop translation, vtop_arm() can be removed and vaddr_to_paddr_arm() can be like below.
===
unsigned long longvaddr_to_paddr_arm(unsigned long vaddr)
{
unsigned long long paddr;
paddr = __pa(vaddr);
if (info->vaddr_for_vtop == vaddr)
MSG(" VADDR : %08lx => PADDR : %08lx\n", vaddr, paddr);
return paddr;
}===
Thanks.
-- Masayuki Igawa
Quoted 5 lines
arm.c +0
-0#endif /* __arm__ */ Signature · 1 line
1.5.6.5
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 2/2] ARM: don't depend on vmalloc_start
Quoted 2 lines · ext Masayuki Igawa
Some comments are below.
Thanks for the comments.
Quoted 50 lines
From: Mika Westerberg <[email protected]>
Subject: [PATCH 2/2] ARM: don't depend onvmalloc_start
Date: Thu, 4 Nov 2010 10:15:17 +0200Quoted 44 lines
In ARM, modules are placed in vmalloc'ed area right above user stack and the rest of the vmalloc area is somewhere after
high_memory(this can be different on different platforms). Since this value is not stored in vmcoreinfo, we have no means to find out the correct value forvmalloc_start.So we assume that all
V->Ptranslations are within the kernel direct mapped memory and use translation tables only when '--vtop' option is passed.Signed-off-by Mika Westerberg <[email protected]>--- arm.c | 40 +++++++++++++++++++--------------------- 1 files changed, 19 insertions(+), 21 deletions(-)arm.c +10
-1@@ -86,6 +86,9 @@ get_machdep_info_arm(void) info->kernel_start =SYMBOL (_stext); info->section_size_bits = _SECTION_SIZE_BITS; +DEBUG_MSG ("page_offset : %lx\n" , info->page_offset); +DEBUG_MSG ("kernel_start : %lx\n" , info->kernel_start); +/* * For the compatibility, makedumpfile should run without the symbol * vmlist and the offset of vm_struct.addr if they are not necessary. @@ -95,31 +98,28 @@ get_machdep_info_arm(void)return TRUE; } +/* +* In ARM the VMALLOC_START can be redefined per platform and we have no +* means to read that from the vmcore (there is currently no vmcoreinfo +* which specifies that), so we are not going to use vmalloc_start for +* anything. +*/ if (!readmem (VADDR ,SYMBOL (vmlist), &vmlist,sizeof (vmlist))) {ERRMSG ("Can't get vmlist.\n" ); -return FALSE; +return TRUE; }if (!readmem (VADDR , vmlist +OFFSET (vm_struct.addr), &vmalloc_start,sizeof (vmalloc_start))) {
Quoted 8 lines
arm.c get_machdep_info_arm(void) · line 115
Quoted 4 lines
arm.c +1
-1ERRMSG ("Can't get vmalloc_start.\n" ); -return FALSE; +return TRUE; }I think this code can be removed.
Because this code is easy to misunderstand for users and there are no means to check now.
Ok, will do.
Quoted 11 lines
arm.c get_machdep_info_arm(void) · line 118
Quoted 7 lines
arm.c +0
-3info->vmalloc_start = vmalloc_start; - -DEBUG_MSG ("page_offset : %lx\n" , info->page_offset); -DEBUG_MSG ("kernel_start : %lx\n" , info->kernel_start);DEBUG_MSG ("vmalloc_start: %lx\n" , vmalloc_start);These codes too?
There is no need 'info->vmalloc_start' by removingis_vmalloc_addr_arm()in ARM now.
True, will remove that also.
Quoted 34 lines
Quoted 34 lines
arm.c +7
-15return TRUE; } -static int -is_vmalloc_addr_arm (unsigned long vaddr) -{ -return (info->vmalloc_start && vaddr >= info->vmalloc_start); -} -/* * vtop_arm() - translate arbitrary virtual address to physical * @vaddr: virtual address to translate @@ -184,17 +184,15 @@ vtop_arm(unsigned long vaddr)unsigned long long vaddr_to_paddr_arm (unsigned long vaddr) { -unsigned long long paddr =vaddr_to_paddr_general (vaddr); - -if (paddr !=NOT_PADDR ) -return paddr; - -if (is_vmalloc_addr_arm (vaddr)) - paddr =vtop_arm (vaddr); -else - paddr =__pa (vaddr); +/* +* Only use translation tables when user has explicitly requested us to +* perform translation for a given address. Otherwise we assume that the +* translation is done within the kernel direct mapped region. +*/ +if (info->vaddr_for_vtop == vaddr) +return vtop_arm (vaddr);
Quoted 5 lines
arm.c vtop_arm(unsigned long vaddr) · line 196
Quoted 3 lines
arm.c +1
-1-return paddr; +return __pa (vaddr); }Why do you use vtop tranlation only when '--vtop' option is passed?
Normal makedumpfile run (at least on ARM) only does V->P translation on kernel directly mapped memory so I considered this to save few clock cycles since that translation is trivial compared to the one using page tables.
Quoted 2 lines
I think if you don't need vtop translation,
vtop_arm()can be removed andvaddr_to_paddr_arm()can be like below.
Well my intention was to leave user a option to use '--vtop' for all the kernel memory (not just for kernel directly mapped memory). IMO, it is useful to have such option available for debugging etc. Is it ok for you?
I'll prepare v2 of the patches soonish.
Thanks again,
MW
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 2/2] ARM: don't depend on vmalloc_start
Thanks for quick reply.
Quoted 42 lines · Mika Westerberg
Quoted 34 lines · ext Masayuki Igawa
Quoted 34 lines
arm.c +7
-15return TRUE; } -static int -is_vmalloc_addr_arm (unsigned long vaddr) -{ -return (info->vmalloc_start && vaddr >= info->vmalloc_start); -} -/* * vtop_arm() - translate arbitrary virtual address to physical * @vaddr: virtual address to translate @@ -184,17 +184,15 @@ vtop_arm(unsigned long vaddr)unsigned long long vaddr_to_paddr_arm (unsigned long vaddr) { -unsigned long long paddr =vaddr_to_paddr_general (vaddr); - -if (paddr !=NOT_PADDR ) -return paddr; - -if (is_vmalloc_addr_arm (vaddr)) - paddr =vtop_arm (vaddr); -else - paddr =__pa (vaddr); +/* +* Only use translation tables when user has explicitly requested us to +* perform translation for a given address. Otherwise we assume that the +* translation is done within the kernel direct mapped region. +*/ +if (info->vaddr_for_vtop == vaddr) +return vtop_arm (vaddr);Quoted 5 lines
arm.c vtop_arm(unsigned long vaddr) · line 196
Quoted 3 lines
arm.c +1
-1-return paddr; +return __pa (vaddr); }Why do you use vtop tranlation only when '--vtop' option is passed?
Quoted 3 lines
Normal makedumpfile run (at least on ARM) only does
V->Ptranslation on kernel directly mapped memory so I considered this to save few clock cycles since that translation is trivial compared to the one using page tables.
Unfortunately, I'm not good at ARM. So I have a few questions. In (all) ARM, is all the kernel memory directly mapped?
The result of vtop_arm()'s translation is always equals __pa()'s in ARM?
Quoted 7 lines
Quoted 3 lines
I think if you don't need vtop translation,
vtop_arm()can be removed andvaddr_to_paddr_arm()can be like below.Well my intention was to leave user a option to use '--vtop' for all the kernel memory (not just for kernel directly mapped memory). IMO, it is useful to have such option available for debugging etc. Is it ok for you?
IIUC, is there the kernel memory which isn't directly mapped?
If so, the memory(which isn't directly mapped) is not supported by your patch?
Quoted 2 lines
I'll prepare v2 of the patches soonish.
Thanks!
-- Masayuki Igawa
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 2/2] ARM: don't depend on vmalloc_start
Quoted 8 lines · ext Masayuki Igawa
Quoted 4 lines · Mika Westerberg
Normal makedumpfile run (at least on ARM) only does
V->Ptranslation on kernel directly mapped memory so I considered this to save few clock cycles since that translation is trivial compared to the one using page tables.Unfortunately, I'm not good at ARM. So I have a few questions. In (all) ARM, is all the kernel memory directly mapped?
Not all -- vmalloc() memory is not directly mapped.
Quoted 1 line
The result of vtop_arm()'s translation is always equals __pa()'s in ARM?
vtop_arm() also handles this vmalloc() memory as it uses page tables to perform the translation.
Quoted 5 lines
Quoted 3 lines
Well my intention was to leave user a option to use '--vtop' for all the kernel memory (not just for kernel directly mapped memory). IMO, it is useful to have such option available for debugging etc. Is it ok for you?
IIUC, is there the kernel memory which isn't directly mapped?
Yes, see above.
Quoted 1 line
If so, the memory(which isn't directly mapped) is not supported by your patch?
As makedumpfile uses only values from VMCOREINFO which are in kernel direct mapped memory the patch should work (I've tested this).
For example ppc64 does the same, it only allows V->P translation on kernel direct mapped memory.
Regards,
MW
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec