Cleanup add-vmcoreinfo.patch v2
Subsystems (4)
cover Cleanup add-vmcoreinfo.patch v2
Hi Andrew,
I updated the cleanup patchset for add-vmcoreinfo.patch.
* Cleanup add-vmcoreinfo.patch v1:
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/0318.html
This patchset (v2) includes a new patch[4/4] for adding a prefix "VMCOREINFO_" to the vmcoreinfo macros. Other patches ([1/4]-[3/4]) don't have any changes.
Changelog:
- Add "Add a prefix VMCOREINFO_ to the vmcoreinfo macros" patch.
Patchset:
[1/4] Cleanup the coding style according to Andrew's comments:
http://lists.infradead.org/pipermail/kexec/2007-August/000522.html
- vmcoreinfo_append_str() should have suitable __attribute__s so that the compiler can check its use.
- vmcoreinfo_max_size should have size_t.
- Use get_seconds() instead of xtime.tv_sec.
- Use init_uts_ns.name.release instead of UTS_RELEASE.
[2/4] Add nodemask_t's size and NR_FREE_PAGES's value to vmcoreinfo_data.
The dump filetering command 'makedumpfile'(v1.1.6 or before) had assumed the above values, and it was not good from the reliability viewpoint. So makedumpfile v1.2.0 came to need these values and I created the patch to let the kernel output them.
makedumpfile site:
https://sourceforge.net/projects/makedumpfile/
[3/4] Use the existing ia64_tpa() instead of asm code.
[4/4] Add a prefix "VMCOREINFO_" to the vmcoreinfo macros.
Old vmcoreinfo macros were defined as generic names SYMBOL/SIZE/OFFSET /LENGTH/CONFIG, and it is impossible to grep for them. So these names should be changed. This discussion is the following:
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/0415.html
Thanks
Ken'ichi Ohmichi
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/4 Cleanup the coding style according to Andrew's comments
[1/4] Cleanup the coding style according to Andrew's comments:
http://lists.infradead.org/pipermail/kexec/2007-August/000522.html
- vmcoreinfo_append_str() should have suitable __attribute__s so that the compiler can check its use.
- vmcoreinfo_max_size should have size_t.
- Use get_seconds() instead of xtime.tv_sec.
- Use init_uts_ns.name.release instead of UTS_RELEASE.
Thanks
Ken'ichi Ohmichi
---
---
include/linux/kexec.h +9 -7
@@ -123,18 +123,20 @@ int kexec_should_crash(struct task_strucvoid crash_save_cpu (struct pt_regs *regs,int cpu);void crash_save_vmcoreinfo (void );void arch_crash_save_vmcoreinfo (void ); -void vmcoreinfo_append_str (const char *fmt, ...); +void vmcoreinfo_append_str (const char *fmt, ...) + __attribute__ ((format (printf,1 ,2 )));unsigned long paddr_vmcoreinfo_note (void );#define SYMBOL (name) \ vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)#define SIZE (name) \ - vmcoreinfo_append_str("SIZE(%s)=%d\n", #name, sizeof(struct name)) + vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ + (unsigned long)sizeof(struct name))#define OFFSET (name, field) \ - vmcoreinfo_append_str("OFFSET(%s.%s)=%d\n", #name, #field, \ - &(((struct name *)0)->field)) + vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ + (unsigned long)&(((struct name *)0)->field))#define LENGTH (name, value) \ - vmcoreinfo_append_str("LENGTH(%s)=%d\n", #name, value) + vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)#define CONFIG (name) \ vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
@@ -177,8 +179,8 @@ extern struct resource crashk_res;typedef u32 note_buf_t [KEXEC_NOTE_BYTES /4 ];extern note_buf_t *crash_notes;extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE /4 ]; -extern unsigned int vmcoreinfo_size; -extern unsigned int vmcoreinfo_max_size; +extern size_t vmcoreinfo_size; +extern size_t vmcoreinfo_max_size;#else /* !CONFIG_KEXEC */
kernel/kexec.c +5 -5
@@ -38,8 +38,8 @@ note_buf_t* crash_notes;/* vmcoreinfo stuff */ unsigned char vmcoreinfo_data[VMCOREINFO_BYTES ];u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE /4 ]; -unsigned int vmcoreinfo_size =0 ; -unsigned int vmcoreinfo_max_size =sizeof (vmcoreinfo_data); +size_t vmcoreinfo_size; +size_t vmcoreinfo_max_size =sizeof (vmcoreinfo_data);/* Location of the reserved area for the crash kernel */ struct resource crashk_res = {
@@ -1153,7 +1153,7 @@ void crash_save_vmcoreinfo(void)if (!vmcoreinfo_size)return ; -vmcoreinfo_append_str ("CRASHTIME=%d" , xtime.tv_sec); +vmcoreinfo_append_str ("CRASHTIME=%ld" ,get_seconds ()); buf = (u32 *)vmcoreinfo_note;
@@ -1195,8 +1195,8 @@ unsigned long __attribute__ ((weak)) padstatic int __init crash_save_vmcoreinfo_init (void ) { -vmcoreinfo_append_str ("OSRELEASE=%s\n" ,UTS_RELEASE ); -vmcoreinfo_append_str ("PAGESIZE=%d\n" ,PAGE_SIZE ); +vmcoreinfo_append_str ("OSRELEASE=%s\n" , init_uts_ns.name.release); +vmcoreinfo_append_str ("PAGESIZE=%ld\n" ,PAGE_SIZE );SYMBOL (init_uts_ns);SYMBOL (node_online_map);
kernel/ksysfs.c +1 -1
@@ -65,7 +65,7 @@ static ssize_t vmcoreinfo_show(struct ks {return sprintf (page,"%lx %x\n" ,paddr_vmcoreinfo_note (), - vmcoreinfo_max_size); + (unsigned int )vmcoreinfo_max_size); }KERNEL_ATTR_RO (vmcoreinfo);
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/4 Add nodemask_t's size and NR_FREE_PAGES's value to vmcoreinfo_data.
In reply to Ken'ichi Ohmichi[2/4] Add nodemask_t's size and NR_FREE_PAGES's value to vmcoreinfo_data.
The dump filetering command 'makedumpfile'(v1.1.6 or before) had assumed the above values, and it was not good from the reliability viewpoint. So makedumpfile v1.2.0 came to need these values and I created the patch to let the kernel output them.
makedumpfile site:
https://sourceforge.net/projects/makedumpfile/
Thanks
Ken'ichi Ohmichi
---
---
include/linux/kexec.h +5 -0
@@ -132,11 +132,16 @@ unsigned long paddr_vmcoreinfo_note(void#define SIZE (name) \ vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ (unsigned long)sizeof(struct name)) +#define TYPEDEF_SIZE (name) \ + vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ + (unsigned long)sizeof(name))#define OFFSET (name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ (unsigned long)&(((struct name *)0)->field))#define LENGTH (name, value) \ vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value) +#define NUMBER (name) \ + vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)#define CONFIG (name) \ vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
kernel/kexec.c +2 -0
@@ -1218,6 +1218,7 @@ static int __init crash_save_vmcoreinfo_SIZE (zone);SIZE (free_area);SIZE (list_head); +TYPEDEF_SIZE (nodemask_t);OFFSET (page, flags);OFFSET (page, _count);OFFSET (page, mapping);
@@ -1237,6 +1238,7 @@ static int __init crash_save_vmcoreinfo_OFFSET (list_head, next);OFFSET (list_head, prev);LENGTH (zone.free_area,MAX_ORDER ); +NUMBER (NR_FREE_PAGES );arch_crash_save_vmcoreinfo ();
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 2/4] [-mm patch] Add nodemask_t's size and NR_FREE_PAGES's value to vmcoreinfo_data.
Quoted 10 lines · Ken'ichi Ohmichi
diff -rpuN
a/include/linux/kexec.hb/include/linux/kexec.hinclude/linux/kexec.h +3
-0@@ -132,11 +132,16 @@ unsigned long paddr_vmcoreinfo_note(void#define SIZE (name) \ vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ (unsigned long)sizeof(struct name)) +#define TYPEDEF_SIZE (name) \ + vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ + (unsigned long)sizeof(name))
include/linux/kexec.h unsigned long paddr_vmcoreinfo_note(void · line 147
Quoted 10 lines
include/linux/kexec.h +2
-0#define OFFSET (name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ (unsigned long)&(((struct name *)0)->field))#define LENGTH (name, value) \ vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value) +#define NUMBER (name) \ + vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)#define CONFIG (name) \ vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
The #define SIZE() should be renamed STRUCT_SIZE() since it's always returning the size of the struct with a given name. This would allow TYPEDEF_SIZE() to simply become SIZE() since it need not be used exclusively for typedefs.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 2/4] [-mm patch] Add nodemask_t's size and NR_FREE_PAGES's value to vmcoreinfo_data.
Hi David,
Quoted 16 lines · David Rientjes
Quoted 14 lines · Ken'ichi Ohmichi
diff -rpuN
a/include/linux/kexec.hb/include/linux/kexec.hinclude/linux/kexec.h 2007-09-10 23:29:52.000000000 +0900 renamed from include/linux/kexec.h 2007-09-10 23:28:42.000000000 +0900 +3
-0@@ -132,11 +132,16 @@ unsigned long paddr_vmcoreinfo_note(void #define SIZE(name) \ vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ (unsigned long)sizeof(struct name)) +#define TYPEDEF_SIZE(name) \ + vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ + (unsigned long)sizeof(name)) #define OFFSET(name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ (unsigned long)&(((struct name *)0)->field)) #define LENGTH(name, value) \
Quoted 8 lines
include/linux/kexec.h 2007-09-10 23:29:52.000000000 +0900 unsigned long paddr_vmcoreinfo_note(void · line 147
Quoted 6 lines
include/linux/kexec.h 2007-09-10 23:29:52.000000000 +0900 renamed from include/linux/kexec.h 2007-09-10 23:28:42.000000000 +0900 +2
-0vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value) +#define NUMBER(name) \ + vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name) #define CONFIG(name) \ vmcoreinfo_append_str("CONFIG_%s=y\n", #name)The #define
SIZE()should be renamedSTRUCT_SIZE()since it's always returning the size of the struct with a given name. This would allowTYPEDEF_SIZE()to simply becomeSIZE()since it need not be used exclusively for typedefs.
Thank you for the comment.
That sounds good, I'll post a new patch including it.
Thanks
Ken'ichi Ohmichi
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 3/4 Use the existing ia64_tpa() instead of asm code.
In reply to Ken'ichi Ohmichi[3/4] Use the existing ia64_tpa() instead of asm code.
Thanks
Ken'ichi Ohmichi
---
---
arch/ia64/kernel/machine_kexec.c +2 -4
@@ -21,6 +21,7 @@#include <asm/setup.h> #include <asm/delay.h> #include <asm/meminit.h> +#include <asm/processor.h> typedef NORET_TYPE void (*relocate_new_kernel_t)( unsigned long indirection_page,
@@ -149,9 +150,6 @@ void arch_crash_save_vmcoreinfo(void)unsigned long paddr_vmcoreinfo_note (void ) { -unsigned long vaddr, paddr; - vaddr = (unsigned long )(char *)&vmcoreinfo_note; - asmvolatile ("tpa %0 = %1" :"=r" (paddr) :"r" (vaddr) :"memory" ); -return paddr; +return ia64_tpa ((unsigned long )(char *)&vmcoreinfo_note); }
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 4/4 Add a prefix "VMCOREINFO_" to the vmcoreinfo macros.
In reply to Ken'ichi Ohmichi[4/4] Add a prefix "VMCOREINFO_" to the vmcoreinfo macros.
Old vmcoreinfo macros were defined as generic names SYMBOL/SIZE/OFFSET /LENGTH/CONFIG, and it is impossible to grep for them. So these names should be changed. This discussion is the following:
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/0415.html
Thanks
Ken'ichi Ohmichi
---
---
arch/i386/kernel/machine_kexec.c +3 -3
@@ -174,11 +174,11 @@ early_param("crashkernel", parse_crashkevoid arch_crash_save_vmcoreinfo (void ) {#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE -SYMBOL (node_data); -LENGTH (node_data,MAX_NUMNODES ); +VMCOREINFO_SYMBOL (node_data); +VMCOREINFO_LENGTH (node_data,MAX_NUMNODES );#endif #ifdef CONFIG_X86_PAE -CONFIG (X86_PAE ); +VMCOREINFO_CONFIG (X86_PAE );#endif }
arch/ia64/kernel/machine_kexec.c +9 -9
@@ -132,19 +132,19 @@ void machine_kexec(struct kimage *image)void arch_crash_save_vmcoreinfo (void ) {#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE -SYMBOL (pgdat_list); -LENGTH (pgdat_list,MAX_NUMNODES ); +VMCOREINFO_SYMBOL (pgdat_list); +VMCOREINFO_LENGTH (pgdat_list,MAX_NUMNODES ); -SYMBOL (node_memblk); -LENGTH (node_memblk,NR_NODE_MEMBLKS ); -SIZE (node_memblk_s); -OFFSET (node_memblk_s, start_paddr); -OFFSET (node_memblk_s, size); +VMCOREINFO_SYMBOL (node_memblk); +VMCOREINFO_LENGTH (node_memblk,NR_NODE_MEMBLKS ); +VMCOREINFO_SIZE (node_memblk_s); +VMCOREINFO_OFFSET (node_memblk_s, start_paddr); +VMCOREINFO_OFFSET (node_memblk_s, size);#endif #ifdef CONFIG_PGTABLE_3 -CONFIG (PGTABLE_3 ); +VMCOREINFO_CONFIG (PGTABLE_3 );#elif CONFIG_PGTABLE_4 -CONFIG (PGTABLE_4 ); +VMCOREINFO_CONFIG (PGTABLE_4 );#endif }
arch/x86_64/kernel/machine_kexec.c +2 -2
@@ -261,8 +261,8 @@ early_param("crashkernel", setup_crashkevoid arch_crash_save_vmcoreinfo (void ) {#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE -SYMBOL (node_data); -LENGTH (node_data,MAX_NUMNODES ); +VMCOREINFO_SYMBOL (node_data); +VMCOREINFO_LENGTH (node_data,MAX_NUMNODES );#endif }
include/linux/kexec.h +7 -7
@@ -127,22 +127,22 @@ void vmcoreinfo_append_str(const char *f __attribute__ ((format (printf, 1, 2)));unsigned long paddr_vmcoreinfo_note (void ); -#define SYMBOL (name) \ +#define VMCOREINFO_SYMBOL (name) \ vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name) -#define SIZE (name) \ +#define VMCOREINFO_SIZE (name) \ vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ (unsigned long)sizeof(struct name)) -#define TYPEDEF_SIZE (name) \ +#define VMCOREINFO_TYPEDEF_SIZE (name) \ vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ (unsigned long)sizeof(name)) -#define OFFSET (name, field) \ +#define VMCOREINFO_OFFSET (name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ (unsigned long)&(((struct name *)0)->field)) -#define LENGTH (name, value) \ +#define VMCOREINFO_LENGTH (name, value) \ vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value) -#define NUMBER (name) \ +#define VMCOREINFO_NUMBER (name) \ vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name) -#define CONFIG (name) \ +#define VMCOREINFO_CONFIG (name) \ vmcoreinfo_append_str("CONFIG_%s=y\n", #name)extern struct kimage *kexec_image;
kernel/kexec.c +34 -34
81 lines not on this page · raw message
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Andrew Morton
maintainerRe: [PATCH 4/4] [-mm patch] Add a prefix "VMCOREINFO_" to the vmcoreinfo macros.
Quoted 5 lines · On Fri, 14 Sep 2007 12:00:18 +0900 "Ken'ichi Ohmichi"…
[4/4] Add a prefix "
VMCOREINFO_" to the vmcoreinfo macros.
Old vmcoreinfo macros were defined as generic names SYMBOL/SIZE/OFFSET /LENGTH/CONFIG, and it is impossible to grep for them. So these names should be changed. This discussion is the following:http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/0415.html
I already had these patches, except for #4.
Your email client is space-stuffing the patches, so I have to do s/^ / /g to apply them. Please see
http://mbligh.org/linuxdocs/Email/Clients/Thunderbird and/or the soon-to-be-merged Documentation/email-clients.txt
I plan on folding all of
add-vmcoreinfo.patch add-vmcore-cleanup-the-coding-style-according-to-andrews-comments.patch add-vmcore-add-nodemask_ts-size-and-nr_free_pagess-value-to-vmcoreinfo_data.patch add-vmcore-use-the-existing-ia64_tpa-instead-of-asm-code.patch add-vmcore-add-a-prefix-vmcoreinfo_-to-the-vmcoreinfo-macros.patch
into a single patch for upstream.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 4/4] [-mm patch] Add a prefix "VMCOREINFO_" to the vmcoreinfo macros.
Hi Andrew,
Quoted 8 lines · Andrew Morton
Quoted 8 lines · On Fri, 14 Sep 2007 12:00:18 +0900 "Ken'ichi Ohmichi"…
Quoted 6 lines
Quoted 6 lines
[4/4] Add a prefix "
VMCOREINFO_" to the vmcoreinfo macros.
Old vmcoreinfo macros were defined as generic names SYMBOL/SIZE/OFFSET /LENGTH/CONFIG, and it is impossible to grep for them. So these names should be changed. This discussion is the following:http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/0415.html
Quoted 6 lines
Quoted 6 lines
I already had these patches, except for #4.
Your email client is space-stuffing the patches, so I have to do s/^ / /g to apply them. Please see
http://mbligh.org/linuxdocs/Email/Clients/Thunderbird and/or the soon-to-be-mergedDocumentation/email-clients.txt
Sorry for wasting your time.
I changed my thunderbird's setting according to the above site.
Quoted 9 lines
Quoted 9 lines
I plan on folding all of
add-vmcoreinfo.patch add-vmcore-cleanup-the-coding-style-according-to-andrews-comments.patch add-vmcore-add-nodemask_ts-size-and-nr_free_pagess-value-to-vmcoreinfo_data.patch add-vmcore-use-the-existing-ia64_tpa-instead-of-asm-code.patch add-vmcore-add-a-prefix-vmcoreinfo_-to-the-vmcoreinfo-macros.patch
into a single patch for upstream.
Thank you for merging them into linux-2.6.23-rc6-mm1. Additionally, could you merge the following patches to clean up add-vmcoreinfo.patch ?
[PATCH 5/4] [-mm patch] Rename macros returning the size.
The #define SIZE() should be renamed STRUCT_SIZE() since it's always returning the size of the struct with a given name. This would allow TYPEDEF_SIZE() to simply become SIZE() since it need not be used exclusively for typedefs. This idea is David Rientjes's.
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/1964.html
[PATCH 6/4] [-mm patch] use the existing offsetof().
It is better that offsetof() is used for VMCOREINFO_OFFSET(). This idea is Joe Perches's.
Thanks
Ken'ichi Ohmichi
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
[PATCH 5/4] [-mm patch] Rename macros returning the size.
[PATCH 5/4] [-mm patch] Rename macros returning the size.
The #define SIZE() should be renamed STRUCT_SIZE() since it's always returning the size of the struct with a given name. This would allow TYPEDEF_SIZE() to simply become SIZE() since it need not be used exclusively for typedefs. This idea is David Rientjes's.
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/1964.html
Thanks
Ken'ichi Ohmichi
---
---
arch/ia64/kernel/machine_kexec.c +1 -1
@@ -137,7 +137,7 @@ void arch_crash_save_vmcoreinfo(void)VMCOREINFO_SYMBOL (node_memblk);VMCOREINFO_LENGTH (node_memblk,NR_NODE_MEMBLKS ); -VMCOREINFO_SIZE (node_memblk_s); +VMCOREINFO_STRUCT_SIZE (node_memblk_s);VMCOREINFO_OFFSET (node_memblk_s, start_paddr);VMCOREINFO_OFFSET (node_memblk_s, size);#endif
include/linux/kexec.h +3 -3
@@ -131,10 +131,10 @@ unsigned long paddr_vmcoreinfo_note(void vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)#define VMCOREINFO_SIZE (name) \ vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ - (unsigned long)sizeof(struct name)) -#define VMCOREINFO_TYPEDEF_SIZE (name) \ - vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ (unsigned long)sizeof(name)) +#define VMCOREINFO_STRUCT_SIZE (name) \ + vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ + (unsigned long)sizeof(struct name))#define VMCOREINFO_OFFSET (name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ (unsigned long)&(((struct name *)0)->field))
kernel/kexec.c +7 -7
@@ -1210,15 +1210,15 @@ static int __init crash_save_vmcoreinfo_#ifdef CONFIG_SPARSEMEM VMCOREINFO_SYMBOL (mem_section);VMCOREINFO_LENGTH (mem_section,NR_SECTION_ROOTS ); -VMCOREINFO_SIZE (mem_section); +VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);#endif -VMCOREINFO_SIZE (page); -VMCOREINFO_SIZE (pglist_data); -VMCOREINFO_SIZE (zone); -VMCOREINFO_SIZE (free_area); -VMCOREINFO_SIZE (list_head); -VMCOREINFO_TYPEDEF_SIZE (nodemask_t); +VMCOREINFO_STRUCT_SIZE (page); +VMCOREINFO_STRUCT_SIZE (pglist_data); +VMCOREINFO_STRUCT_SIZE (zone); +VMCOREINFO_STRUCT_SIZE (free_area); +VMCOREINFO_STRUCT_SIZE (list_head); +VMCOREINFO_SIZE (nodemask_t);VMCOREINFO_OFFSET (page, flags);VMCOREINFO_OFFSET (page, _count);VMCOREINFO_OFFSET (page, mapping);
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 5/4] [-mm patch] Rename macros returning the size.
Hi,
Quoted 8 lines · Ken'ichi Ohmichi
[PATCH 5/4] [-mm patch] Rename macros returning the size.
The #defineSIZE()should be renamedSTRUCT_SIZE()since it's always returning the size of the struct with a given name. This would allowTYPEDEF_SIZE()to simply becomeSIZE()since it need not be used exclusively for typedefs. This idea is David Rientjes's.
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/1964.html
Quoted 5 lines
Thanks
Ken'ichi Ohmichi---
Signed-off-by David Rientjes <[email protected]>
Hmm, I think adding a s-o-b line for David here isn't quite correct. When someone reviews a patch and gives a suggestion, you only need to copy him on the next iteration (and he may ack it or whatever, if he wants) -- but adding a s-o-b line like that ends up (incorrectly) denoting that he came between the author-to-git-commit chain ...
Quoted 8 lines
Signed-off-by Ken'ichi Ohmichi <[email protected]>include/linux/kexec.h +0
-0@@ -131,10 +131,10 @@ unsigned long paddr_vmcoreinfo_note(void vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)#define VMCOREINFO_SIZE (name) \ vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
include/linux/kexec.h unsigned long paddr_vmcoreinfo_note(void · line 140
Quoted 10 lines
include/linux/kexec.h +3
-3- (unsigned long)sizeof(struct name)) -#define VMCOREINFO_TYPEDEF_SIZE (name) \ - vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ (unsigned long)sizeof(name)) +#define VMCOREINFO_STRUCT_SIZE (name) \ + vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ + (unsigned long)sizeof(struct name))#define VMCOREINFO_OFFSET (name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ (unsigned long)&(((struct name *)0)->field))
Please use %zu and lose all the ugly (unsigned long) casts here.
Otherwise it looks good,
Satyam
David Rientjes
Acked-byRe: [PATCH 5/4] [-mm patch] Rename macros returning the size.
Quoted 10 lines · Satyam Sharma
Quoted 10 lines
[PATCH 5/4] [-mm patch] Rename macros returning the size.
The #defineSIZE()should be renamedSTRUCT_SIZE()since it's always returning the size of the struct with a given name. This would allowTYPEDEF_SIZE()to simply becomeSIZE()since it need not be used exclusively for typedefs. This idea is David Rientjes's.
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/1964.htmlThanks
Ken'ichi Ohmichi
Quoted 9 lines
Quoted 2 lines
---
Signed-off-by David Rientjes <[email protected]>Hmm, I think adding a s-o-b line for David here isn't quite correct. When someone reviews a patch and gives a suggestion, you only need to copy him on the next iteration (and he may ack it or whatever, if he wants) -- but adding a s-o-b line like that ends up (incorrectly) denoting that he came between the author-to-git-commit chain ...
Feel free to add
since I've reviewed the patch and agree with it.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Ken'ichi Ohmichi
Acked-by David RientjesRe: [PATCH 5/4] [-mm patch] Rename macros returning the size.
In reply to Satyam SharmaHi Satyam,
Quoted 11 lines · Satyam Sharma
Quoted 11 lines · Ken'ichi Ohmichi
Quoted 10 lines
Quoted 10 lines
[PATCH 5/4] [-mm patch] Rename macros returning the size.
The #defineSIZE()should be renamedSTRUCT_SIZE()since it's always returning the size of the struct with a given name. This would allowTYPEDEF_SIZE()to simply becomeSIZE()since it need not be used exclusively for typedefs. This idea is David Rientjes's.
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.1/1964.htmlThanks
Ken'ichi Ohmichi
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
---
Signed-off-by David Rientjes <[email protected]>Hmm, I think adding a s-o-b line for David here isn't quite correct. When someone reviews a patch and gives a suggestion, you only need to copy him on the next iteration (and he may ack it or whatever, if he wants) -- but adding a s-o-b line like that ends up (incorrectly) denoting that he came between the author-to-git-commit chain ...
Thank you for kind explanation.
I can understand s-o-b clearly.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Signed-off-by Ken'ichi Ohmichi <[email protected]>include/linux/kexec.h +0
-3@@ -131,10 +131,10 @@ unsigned long paddr_vmcoreinfo_note(void vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)#define VMCOREINFO_SIZE (name) \ vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ - (unsigned long)sizeof(struct name)) -#define VMCOREINFO_TYPEDEF_SIZE (name) \ - vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ (unsigned long)sizeof(name))
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
include/linux/kexec.h unsigned long paddr_vmcoreinfo_note(void · line 140
Quoted 6 lines
include/linux/kexec.h +3
-0+#define VMCOREINFO_STRUCT_SIZE (name) \ + vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ + (unsigned long)sizeof(struct name))#define VMCOREINFO_OFFSET (name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ (unsigned long)&(((struct name *)0)->field))Please use %zu and lose all the ugly (unsigned long) casts here.
That sounds good.
I updated the patch according to your comment.
Thanks
Ken'ichi Ohmichi
---
---
arch/ia64/kernel/machine_kexec.c +1 -1
@@ -137,7 +137,7 @@ void arch_crash_save_vmcoreinfo(void)VMCOREINFO_SYMBOL (node_memblk);VMCOREINFO_LENGTH (node_memblk,NR_NODE_MEMBLKS ); -VMCOREINFO_SIZE (node_memblk_s); +VMCOREINFO_STRUCT_SIZE (node_memblk_s);VMCOREINFO_OFFSET (node_memblk_s, start_paddr);VMCOREINFO_OFFSET (node_memblk_s, size);#endif
include/linux/kexec.h +3 -5
@@ -130,11 +130,9 @@ unsigned long paddr_vmcoreinfo_note(void#define VMCOREINFO_SYMBOL (name) \ vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)#define VMCOREINFO_SIZE (name) \ - vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ - (unsigned long)sizeof(struct name)) -#define VMCOREINFO_TYPEDEF_SIZE (name) \ - vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \ - (unsigned long)sizeof(name)) + vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(name)) +#define VMCOREINFO_STRUCT_SIZE (name) \ + vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(struct name))#define VMCOREINFO_OFFSET (name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ (unsigned long)&(((struct name *)0)->field))
kernel/kexec.c +7 -7
@@ -1210,15 +1210,15 @@ static int __init crash_save_vmcoreinfo_#ifdef CONFIG_SPARSEMEM VMCOREINFO_SYMBOL (mem_section);VMCOREINFO_LENGTH (mem_section,NR_SECTION_ROOTS ); -VMCOREINFO_SIZE (mem_section); +VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);#endif -VMCOREINFO_SIZE (page); -VMCOREINFO_SIZE (pglist_data); -VMCOREINFO_SIZE (zone); -VMCOREINFO_SIZE (free_area); -VMCOREINFO_SIZE (list_head); -VMCOREINFO_TYPEDEF_SIZE (nodemask_t); +VMCOREINFO_STRUCT_SIZE (page); +VMCOREINFO_STRUCT_SIZE (pglist_data); +VMCOREINFO_STRUCT_SIZE (zone); +VMCOREINFO_STRUCT_SIZE (free_area); +VMCOREINFO_STRUCT_SIZE (list_head); +VMCOREINFO_SIZE (nodemask_t);VMCOREINFO_OFFSET (page, flags);VMCOREINFO_OFFSET (page, _count);VMCOREINFO_OFFSET (page, mapping);
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
[PATCH 6/4] [-mm patch] use the existing offsetof().
In reply to Ken'ichi Ohmichi[PATCH 6/4] [-mm patch] use the existing offsetof().
It is better that offsetof() is used for VMCOREINFO_OFFSET(). This idea is Joe Perches's.
Thanks
Ken'ichi Ohmichi
---
---
include/linux/kexec.h +1 -1
@@ -137,7 +137,7 @@ unsigned long paddr_vmcoreinfo_note(void (unsigned long)sizeof(struct name))#define VMCOREINFO_OFFSET (name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ - (unsigned long)&(((struct name *)0)->field)) + (unsigned long)offsetof(struct name, field))#define VMCOREINFO_LENGTH (name, value) \ vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)#define VMCOREINFO_NUMBER (name) \
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 6/4] [-mm patch] use the existing offsetof().
Quoted 7 lines · Ken'ichi Ohmichi
[PATCH 6/4] [-mm patch] use the existing
offsetof().
It is better thatoffsetof()is used forVMCOREINFO_OFFSET(). This idea is Joe Perches's.
Quoted 5 lines
Thanks
Ken'ichi Ohmichi---
Signed-off-by Joe Perches <[email protected]>
Same deal here ...
include/linux/kexec.h unsigned long paddr_vmcoreinfo_note(void · line 142
Quoted 13 lines
Signed-off-by Ken'ichi Ohmichi <[email protected]>---
diff -rpuNa/include/linux/kexec.hb/include/linux/kexec.hinclude/linux/kexec.h +1
-1@@ -137,7 +137,7 @@ unsigned long paddr_vmcoreinfo_note(void (unsigned long)sizeof(struct name))#define VMCOREINFO_OFFSET (name, field) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ - (unsigned long)&(((struct name *)0)->field)) + (unsigned long)offsetof(struct name, field))#define VMCOREINFO_LENGTH (name, value) \ vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
... and here. Use %zu and lose the casts.
BTW I don't think these macros are such a big win in readability or code clarity anyway. And I noticed that there are still some open calls to vmcoreinfo_append_str() in kexec.c (such as for the OS_RELEASE case) which you haven't macro-ized ... we end up having code that looks like:
vmcoreinfo_append_str(...); ... ... VMCOREINFO_OFFSET(...); ...
and it's not even obvious (unless you follow on to the definition of the later macro) that the above two are *exactly* the same. So you could also consider just losing the macros altogether.
Satyam
Re: [PATCH 6/4] [-mm patch] use the existing offsetof().
Hi Satyam,
Quoted 9 lines · Satyam Sharma
Quoted 9 lines
BTW I don't think these macros are such a big win in readability or code clarity anyway. And I noticed that there are still some open calls to
vmcoreinfo_append_str()inkexec.c(such as for theOS_RELEASEcase) which you haven't macro-ized ... we end up having code that looks like:vmcoreinfo_append_str(...); ...
Quoted 7 lines
Quoted 7 lines
... VMCOREINFO_OFFSET(...); ...and it's not even obvious (unless you follow on to the definition of the later macro) that the above two are *exactly* the same. So you could also consider just losing the macros altogether.
I want to use these macros for calls to vmcoreinfo_append_str(), because the strings included in each macro ("SIZE(XXX)=", "OFFSET(XXX)=", etc.) are very important. makedumpfile command reads these strings and gets the debugging information (structure sizes, field offsets, etc.). If losing these macros and there is a typo like "OFESET(page.mapping)=", the command cannot run. To prevent this mistake, these macros are very useful.
For more readability, I think it is good that all the calls are changed to macros having a prefix "VMCOREINFO_" like the attached patch.
Thanks
Ken'ichi Ohmichi
---
---
include/linux/kexec.h +6 -2
@@ -127,6 +127,10 @@ void vmcoreinfo_append_str(const char *f __attribute__ ((format (printf, 1, 2)));unsigned long paddr_vmcoreinfo_note (void ); +#define VMCOREINFO_OSRELEASE (name) \ + vmcoreinfo_append_str("OSRELEASE=%s\n", #name) +#define VMCOREINFO_PAGESIZE (value) \ + vmcoreinfo_append_str("PAGESIZE=%ld\n", value)#define VMCOREINFO_SYMBOL (name) \ vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)#define VMCOREINFO_SIZE (name) \
@@ -134,8 +138,8 @@ unsigned long paddr_vmcoreinfo_note(void#define VMCOREINFO_STRUCT_SIZE (name) \ vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(struct name))#define VMCOREINFO_OFFSET (name, field) \ - vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ - (unsigned long)&(((struct name *)0)->field)) + vmcoreinfo_append_str("OFFSET(%s.%s)=%zu\n", #name, #field, \ + offsetof(struct name, field))#define VMCOREINFO_LENGTH (name, value) \ vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)#define VMCOREINFO_NUMBER (name) \
kernel/kexec.c +2 -2
@@ -1195,8 +1195,8 @@ unsigned long __attribute__ ((weak)) padstatic int __init crash_save_vmcoreinfo_init (void ) { -vmcoreinfo_append_str ("OSRELEASE=%s\n" , init_uts_ns.name.release); -vmcoreinfo_append_str ("PAGESIZE=%ld\n" ,PAGE_SIZE ); +VMCOREINFO_OSRELEASE (init_uts_ns.name.release); +VMCOREINFO_PAGESIZE (PAGE_SIZE );VMCOREINFO_SYMBOL (init_uts_ns);VMCOREINFO_SYMBOL (node_online_map);
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH 4/4] [-mm patch] Add a prefix "VMCOREINFO_" to the vmcoreinfo macros.
In reply to Andrew MortonHi Andrew,
Quoted 9 lines · Andrew Morton
Quoted 9 lines
I plan on folding all of
add-vmcoreinfo.patch add-vmcore-cleanup-the-coding-style-according-to-andrews-comments.patch add-vmcore-add-nodemask_ts-size-and-nr_free_pagess-value-to-vmcoreinfo_data.patch add-vmcore-use-the-existing-ia64_tpa-instead-of-asm-code.patch add-vmcore-add-a-prefix-vmcoreinfo_-to-the-vmcoreinfo-macros.patch
into a single patch for upstream.
I created a new single add-vmcoreinfo.patch with the following cleanup patches.
* Cleanup patches:
1. add-vmcore-cleanup-the-coding-style-according-to-andrews-comments.patch
2. add-vmcore-add-nodemask_ts-size-and-nr_free_pagess-value-to-vmcoreinfo_data.patch
3. add-vmcore-use-the-existing-ia64_tpa-instead-of-asm-code.patch
4. add-vmcore-add-a-prefix-vmcoreinfo_-to-the-vmcoreinfo-macros.patch
5. Re: [PATCH 5/4] [-mm patch] Rename macros returning the size.
from Ken'ichi Ohmichi, 2007/09/25
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.3/0582.html
6. Re: [PATCH 6/4] [-mm patch] use the existing offsetof().
from Ken'ichi Ohmichi, 2007/09/25
http://www.ussg.iu.edu/hypermail/linux/kernel/0709.3/0584.htmlThanks
Ken'ichi Ohmichi
---
---
arch/i386/kernel/machine_kexec.c +13 -0
@@ -10,6 +10,7 @@#include <linux/kexec.h> #include <linux/delay.h> #include <linux/init.h> +#include <linux/numa.h> #include <asm/pgtable.h> #include <asm/pgalloc.h> #include <asm/tlbflush.h>
@@ -169,3 +170,15 @@ static int __init parse_crashkernel(charreturn 0 ; }early_param ("crashkernel" , parse_crashkernel); + +void arch_crash_save_vmcoreinfo (void ) +{ +#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE +VMCOREINFO_SYMBOL (node_data); +VMCOREINFO_LENGTH (node_data,MAX_NUMNODES ); +#endif +#ifdef CONFIG_X86_PAE +VMCOREINFO_CONFIG (X86_PAE ); +#endif +} +
arch/ia64/kernel/machine_kexec.c +28 -0
@@ -15,10 +15,13 @@#include <linux/cpu.h> #include <linux/irq.h> #include <linux/efi.h> +#include <linux/numa.h> +#include <linux/mmzone.h> #include <asm/mmu_context.h> #include <asm/setup.h> #include <asm/delay.h> #include <asm/meminit.h> +#include <asm/processor.h> typedef NORET_TYPE void (*relocate_new_kernel_t)( unsigned long indirection_page,
@@ -125,3 +128,28 @@ void machine_kexec(struct kimage *image)unw_init_running (ia64_machine_kexec, image);for (;;); } + +void arch_crash_save_vmcoreinfo (void ) +{ +#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE +VMCOREINFO_SYMBOL (pgdat_list); +VMCOREINFO_LENGTH (pgdat_list,MAX_NUMNODES ); + +VMCOREINFO_SYMBOL (node_memblk); +VMCOREINFO_LENGTH (node_memblk,NR_NODE_MEMBLKS ); +VMCOREINFO_STRUCT_SIZE (node_memblk_s); +VMCOREINFO_OFFSET (node_memblk_s, start_paddr); +VMCOREINFO_OFFSET (node_memblk_s, size); +#endif +#ifdef CONFIG_PGTABLE_3 +VMCOREINFO_CONFIG (PGTABLE_3 ); +#elif CONFIG_PGTABLE_4 +VMCOREINFO_CONFIG (PGTABLE_4 ); +#endif +} + +unsigned long paddr_vmcoreinfo_note (void ) +{ +return ia64_tpa ((unsigned long )(char *)&vmcoreinfo_note); +} +
arch/ia64/mm/discontig.c +1 -1
@@ -48,7 +48,7 @@ struct early_node_data {static struct early_node_data mem_data[MAX_NUMNODES ]__initdata ;static nodemask_t memory_less_mask__initdata ; -static pg_data_t *pgdat_list[MAX_NUMNODES ]; +pg_data_t *pgdat_list[MAX_NUMNODES ];/* * To prevent cache aliasing effects, align per-node structures so that they
arch/x86_64/kernel/machine_kexec.c +9 -0
@@ -10,6 +10,7 @@#include <linux/kexec.h> #include <linux/string.h> #include <linux/reboot.h> +#include <linux/numa.h> #include <asm/pgtable.h> #include <asm/tlbflush.h> #include <asm/mmu_context.h>
@@ -257,3 +258,11 @@ static int __init setup_crashkernel(char }early_param ("crashkernel" , setup_crashkernel); +void arch_crash_save_vmcoreinfo (void ) +{ +#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE +VMCOREINFO_SYMBOL (node_data); +VMCOREINFO_LENGTH (node_data,MAX_NUMNODES ); +#endif +} +
include/asm-ia64/numa.h +1 -0
@@ -24,6 +24,7 @@ extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned; extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned; +extern pg_data_t *pgdat_list[MAX_NUMNODES ];/* Stuff below this line could be architecture independent */
include/linux/kexec.h +35 -0
@@ -121,6 +121,32 @@ extern struct page *kimage_alloc_controlextern void crash_kexec (struct pt_regs *);int kexec_should_crash (struct task_struct *);void crash_save_cpu (struct pt_regs *regs,int cpu); +void crash_save_vmcoreinfo (void ); +void arch_crash_save_vmcoreinfo (void ); +void vmcoreinfo_append_str (const char *fmt, ...) + __attribute__ ((format (printf,1 ,2 ))); +unsigned long paddr_vmcoreinfo_note (void ); + +#define VMCOREINFO_OSRELEASE (name) \ + vmcoreinfo_append_str("OSRELEASE=%s\n", #name) +#define VMCOREINFO_PAGESIZE (value) \ + vmcoreinfo_append_str("PAGESIZE=%ld\n", value) +#define VMCOREINFO_SYMBOL (name) \ + vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name) +#define VMCOREINFO_SIZE (name) \ + vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(name)) +#define VMCOREINFO_STRUCT_SIZE (name) \ + vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(struct name)) +#define VMCOREINFO_OFFSET (name, field) \ + vmcoreinfo_append_str("OFFSET(%s.%s)=%zu\n", #name, #field, \ + offsetof(struct name, field)) +#define VMCOREINFO_LENGTH (name, value) \ + vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value) +#define VMCOREINFO_NUMBER (name) \ + vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name) +#define VMCOREINFO_CONFIG (name) \ + vmcoreinfo_append_str("CONFIG_%s=y\n", #name) +extern struct kimage *kexec_image;extern struct kimage *kexec_crash_image;
@@ -148,11 +174,20 @@ extern struct kimage *kexec_crash_image;#define KEXEC_FLAGS (KEXEC_ON_CRASH)/* List of defined/legal kexec flags */ +#define VMCOREINFO_BYTES (4096) +#define VMCOREINFO_NOTE_NAME "VMCOREINFO" +#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4) +#define VMCOREINFO_NOTE_SIZE (KEXEC_NOTE_HEAD_BYTES*2 + VMCOREINFO_BYTES \ + + VMCOREINFO_NOTE_NAME_BYTES) +/* Location of a reserved region to hold the crash kernel. */ extern struct resource crashk_res;typedef u32 note_buf_t [KEXEC_NOTE_BYTES /4 ];extern note_buf_t *crash_notes; +extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE /4 ]; +extern size_t vmcoreinfo_size; +extern size_t vmcoreinfo_max_size;#else /* !CONFIG_KEXEC */
kernel/kexec.c +112 -0
137 lines not on this page · raw message
kernel/ksysfs.c +9 -0
@@ -60,6 +60,14 @@ static ssize_t kexec_crash_loaded_show(s return sprintf(page, "%d\n", !!kexec_crash_image); }KERNEL_ATTR_RO (kexec_crash_loaded); + +static ssize_t vmcoreinfo_show (struct kset *kset,char *page) +{ +return sprintf (page,"%lx %zx\n" , +paddr_vmcoreinfo_note (), vmcoreinfo_max_size); +} +KERNEL_ATTR_RO (vmcoreinfo); +#endif /* CONFIG_KEXEC */ /*
@@ -95,6 +103,7 @@ static struct attribute * kernel_attrs[]#ifdef CONFIG_KEXEC &kexec_loaded_attr.attr, &kexec_crash_loaded_attr.attr, + &vmcoreinfo_attr.attr, #endifNULL };
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec