From c88a6bb5b679abcf411616ec7bd026018ab8c06c Mon Sep 17 00:00:00 2001 From: WANG Chao Date: Sep 19 2014 03:29:35 +0000 Subject: Rebase makedumpfile-1.5.7 Rebase makedumpfile-1.5.7 and remove the useless patches. Signed-off-by: WANG Chao Acked-by: Vivek Goyal --- diff --git a/.gitignore b/.gitignore index b4a182c..ad1fdf6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /eppic_030413.tar.gz -/kexec-tools-po-20131224.tgz -/makedumpfile-1.5.6.tar.gz /kexec-tools-2.0.7.tar.xz /kdump-anaconda-addon-003.tar.gz +/makedumpfile-1.5.7.tar.gz diff --git a/kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch b/kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch deleted file mode 100644 index 37da5f4..0000000 --- a/kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 45fc42c5c980e2d5b755ed24a6983f44798d958e Mon Sep 17 00:00:00 2001 -From: WANG Chao -Date: Tue, 10 Jun 2014 14:11:27 +0900 -Subject: [PATCH] [PATCH] Fix Makefile for eppic_makedumpfile.so build. - -When libeppic isn't installed on a standard location, building -eppic_makedumpfile.so with -leppic directly doesn't work. - -Add LDFLAGS to build arguments, so that one can pass LDFLAGS="-Ldir --Idir" to tell where to search for libeppic library and its header -files. - -For example, if eppic source is installed on the same directory level -with makedumpfile as the following: - -makedumpfile - |--- arch - +--- eeppic_scripts -eppic - |--- applications - +--- libeppic - -After compiling libeppic, one can use the following command to build -eppic_makedumpfile.so: - -make LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so - -Signed-off-by: WANG Chao ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index d87638b..0cc07ef 100644 ---- a/makedumpfile-1.5.6/Makefile -+++ b/makedumpfile-1.5.6/Makefile -@@ -87,7 +87,7 @@ makedumpfile: $(SRC_BASE) $(OBJ_PART) $(OBJ_ARCH) - gzip -c ./makedumpfile.conf.5 > ./makedumpfile.conf.5.gz - - eppic_makedumpfile.so: extension_eppic.c -- $(CC) $(CFLAGS) -shared -rdynamic -o $@ extension_eppic.c -fPIC -leppic -ltinfo -+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -rdynamic -o $@ extension_eppic.c -fPIC -leppic -ltinfo - - clean: - rm -f $(OBJ) $(OBJ_PART) $(OBJ_ARCH) makedumpfile makedumpfile.8.gz makedumpfile.conf.5.gz --- -1.9.3 - diff --git a/kexec-tools-2.0.4-makedumpfile-Fix-free-bitmap_buffer_cyclic-error.patch b/kexec-tools-2.0.4-makedumpfile-Fix-free-bitmap_buffer_cyclic-error.patch deleted file mode 100644 index f95d1c9..0000000 --- a/kexec-tools-2.0.4-makedumpfile-Fix-free-bitmap_buffer_cyclic-error.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 0e7b1a6e3c1919c9222b662d458637ddf802dd04 Mon Sep 17 00:00:00 2001 -From: Arthur Zou -Date: Wed, 7 May 2014 17:54:16 +0900 -Subject: [PATCH] [PATCH v3] Fix free bitmap_buffer_cyclic error. - -Description: -In create_dump_bitmap() and write_kdump_pages_and_bitmap_cyclic(), -What should be freed is info->partial_bitmap instead of info->bitmap. - -Solution: -Add two functions to free the bitmap_buffer_cyclic. info->partial_bitmap1 -is freed by free_bitmap1_buffer_cyclic(). info->partial_bitmap2 is -freed by free_bitmap2_buffer_cyclic(). At the same time, remove -thoes frees that free partial_bitmap1 or partial_bitmap2 at the end -of main() because partial_bitmap1 and partial_bitmap2 has been freed -after dump file has been written out, so there is no need to free it -again at the end of main. - -Signed-off-by: Arthur Zou -Signed-off-by: Baoquan He ---- - makedumpfile.c | 38 ++++++++++++++++++++++++++++++-------- - 1 file changed, 30 insertions(+), 8 deletions(-) - -diff --git a/makedumpfile.c b/makedumpfile.c -index 16081a5..ef8a750 100644 ---- a/makedumpfile-1.5.6/makedumpfile.c -+++ b/makedumpfile-1.5.6/makedumpfile.c -@@ -5130,6 +5130,31 @@ free_bitmap_buffer(void) - free_bitmap2_buffer(); - } - -+void -+free_bitmap1_buffer_cyclic() -+{ -+ if (info->partial_bitmap1 != NULL){ -+ free(info->partial_bitmap1); -+ info->partial_bitmap1 = NULL; -+ } -+} -+ -+void -+free_bitmap2_buffer_cyclic() -+{ -+ if (info->partial_bitmap2 != NULL){ -+ free(info->partial_bitmap2); -+ info->partial_bitmap2 = NULL; -+ } -+} -+ -+void -+free_bitmap_buffer_cyclic() -+{ -+ free_bitmap1_buffer_cyclic(); -+ free_bitmap2_buffer_cyclic(); -+} -+ - int - create_dump_bitmap(void) - { -@@ -5147,8 +5172,7 @@ create_dump_bitmap(void) - goto out; - - info->num_dumpable = get_num_dumpable_cyclic(); -- -- free_bitmap2_buffer(); -+ free_bitmap2_buffer_cyclic(); - } - - } else { -@@ -6190,6 +6214,8 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - if (!write_cache_bufsz(cd_page)) - return FALSE; - -+ free_bitmap_buffer_cyclic(); -+ - /* - * print [100 %] - */ -@@ -6947,7 +6973,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d - } - - -- free_bitmap1_buffer(); -+ free_bitmap1_buffer_cyclic(); - - if (!prepare_bitmap2_buffer_cyclic()) - return FALSE; -@@ -6970,7 +6996,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d - return FALSE; - } - -- -+ free_bitmap2_buffer_cyclic(); - - gettimeofday(&tv_start, NULL); - -@@ -9349,10 +9375,6 @@ out: - free(info->splitting_info); - if (info->p2m_mfn_frame_list != NULL) - free(info->p2m_mfn_frame_list); -- if (info->partial_bitmap1 != NULL) -- free(info->partial_bitmap1); -- if (info->partial_bitmap2 != NULL) -- free(info->partial_bitmap2); - free(info); - } - free_elf_info(); --- -1.8.5.3 - diff --git a/kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch b/kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch deleted file mode 100644 index 14fad22..0000000 --- a/kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch +++ /dev/null @@ -1,738 +0,0 @@ -From 9dc6440c63320066bc6344c6e3ca3c3af88bcc42 Mon Sep 17 00:00:00 2001 -From: Petr Tesarik -Date: Thu, 24 Apr 2014 10:58:43 +0900 -Subject: [PATCH] [PATCH v3] Introduce the mdf_pfn_t type. - -Replace unsigned long long with mdf_pfn_t where: - - a. the variable denotes a PFN - b. the variable is a number of pages - -The number of pages is converted to a mdf_pfn_t, because it is a result -of subtracting two PFNs or incremented in a loop over a range of PFNs, -so it can get as large as a PFN. - -Note: The mdf_ (i.e. makedumpfile) prefix is used to prevent possible -conflicts with other software that defines a pfn_t type. - -Signed-off-by: Petr Tesarik -Signed-off-by: Baoquan He ---- - makedumpfile.c | 152 ++++++++++++++++++++++++++++++--------------------------- - makedumpfile.h | 48 +++++++++--------- - sadump_info.c | 15 +++--- - sadump_info.h | 4 +- - 4 files changed, 115 insertions(+), 104 deletions(-) - -diff --git a/makedumpfile.c b/makedumpfile.c -index ce4a866..0b31932 100644 ---- a/makedumpfile-1.5.6/makedumpfile.c -+++ b/makedumpfile-1.5.6/makedumpfile.c -@@ -37,7 +37,7 @@ struct DumpInfo *info = NULL; - - char filename_stdout[] = FILENAME_STDOUT; - --static void first_cycle(unsigned long long start, unsigned long long max, struct cycle *cycle) -+static void first_cycle(mdf_pfn_t start, mdf_pfn_t max, struct cycle *cycle) - { - cycle->start_pfn = round(start, info->pfn_cyclic); - cycle->end_pfn = cycle->start_pfn + info->pfn_cyclic; -@@ -46,7 +46,7 @@ static void first_cycle(unsigned long long start, unsigned long long max, struct - cycle->end_pfn = max; - } - --static void update_cycle(unsigned long long max, struct cycle *cycle) -+static void update_cycle(mdf_pfn_t max, struct cycle *cycle) - { - cycle->start_pfn= cycle->end_pfn; - cycle->end_pfn= cycle->start_pfn + info->pfn_cyclic; -@@ -55,7 +55,7 @@ static void update_cycle(unsigned long long max, struct cycle *cycle) - cycle->end_pfn = max; - } - --static int end_cycle(unsigned long long max, struct cycle *cycle) -+static int end_cycle(mdf_pfn_t max, struct cycle *cycle) - { - return (cycle->start_pfn >= max)?TRUE:FALSE; - } -@@ -67,15 +67,15 @@ static int end_cycle(unsigned long long max, struct cycle *cycle) - /* - * The numbers of the excluded pages - */ --unsigned long long pfn_zero; --unsigned long long pfn_memhole; --unsigned long long pfn_cache; --unsigned long long pfn_cache_private; --unsigned long long pfn_user; --unsigned long long pfn_free; --unsigned long long pfn_hwpoison; -+mdf_pfn_t pfn_zero; -+mdf_pfn_t pfn_memhole; -+mdf_pfn_t pfn_cache; -+mdf_pfn_t pfn_cache_private; -+mdf_pfn_t pfn_user; -+mdf_pfn_t pfn_free; -+mdf_pfn_t pfn_hwpoison; - --unsigned long long num_dumped; -+mdf_pfn_t num_dumped; - - int retcd = FAILED; /* return code */ - -@@ -122,7 +122,9 @@ unsigned long long - ptom_xen(unsigned long long paddr) - { - unsigned long mfn; -- unsigned long long maddr, pfn, mfn_idx, frame_idx; -+ unsigned long long maddr; -+ mdf_pfn_t pfn; -+ unsigned long long mfn_idx, frame_idx; - - pfn = paddr_to_pfn(paddr); - mfn_idx = pfn / MFNS_PER_FRAME; -@@ -226,12 +228,13 @@ is_in_same_page(unsigned long vaddr1, unsigned long vaddr2) - } - - #define BITMAP_SECT_LEN 4096 --static inline int is_dumpable(struct dump_bitmap *, unsigned long long); --static inline int is_dumpable_cyclic(char *bitmap, unsigned long long, struct cycle *cycle); -+static inline int is_dumpable(struct dump_bitmap *, mdf_pfn_t); -+static inline int is_dumpable_cyclic(char *bitmap, mdf_pfn_t, struct cycle *cycle); - unsigned long --pfn_to_pos(unsigned long long pfn) -+pfn_to_pos(mdf_pfn_t pfn) - { -- unsigned long desc_pos, i; -+ unsigned long desc_pos; -+ mdf_pfn_t i; - - desc_pos = info->valid_pages[pfn / BITMAP_SECT_LEN]; - for (i = round(pfn, BITMAP_SECT_LEN); i < pfn; i++) -@@ -246,7 +249,7 @@ read_page_desc(unsigned long long paddr, page_desc_t *pd) - { - struct disk_dump_header *dh; - unsigned long desc_pos; -- unsigned long long pfn; -+ mdf_pfn_t pfn; - off_t offset; - - /* -@@ -2375,8 +2378,8 @@ pgdat4: - } - - void --dump_mem_map(unsigned long long pfn_start, -- unsigned long long pfn_end, unsigned long mem_map, int num_mm) -+dump_mem_map(mdf_pfn_t pfn_start, mdf_pfn_t pfn_end, -+ unsigned long mem_map, int num_mm) - { - struct mem_map_data *mmd; - -@@ -2802,7 +2805,7 @@ int - get_mm_sparsemem(void) - { - unsigned int section_nr, mem_section_size, num_section; -- unsigned long long pfn_start, pfn_end; -+ mdf_pfn_t pfn_start, pfn_end; - unsigned long section, mem_map; - unsigned long *mem_sec = NULL; - -@@ -2886,7 +2889,7 @@ get_mem_map_without_mm(void) - int - get_mem_map(void) - { -- unsigned long long max_pfn = 0; -+ mdf_pfn_t max_pfn = 0; - unsigned int i; - int ret; - -@@ -2944,7 +2947,7 @@ initialize_bitmap_memory(void) - struct dump_bitmap *bmp; - off_t bitmap_offset; - off_t bitmap_len, max_sect_len; -- unsigned long pfn; -+ mdf_pfn_t pfn; - int i, j; - long block_size; - -@@ -3309,8 +3312,7 @@ initialize_2nd_bitmap(struct dump_bitmap *bitmap) - } - - int --set_bitmap(struct dump_bitmap *bitmap, unsigned long long pfn, -- int val) -+set_bitmap(struct dump_bitmap *bitmap, mdf_pfn_t pfn, int val) - { - int byte, bit; - off_t old_offset, new_offset; -@@ -3358,7 +3360,7 @@ set_bitmap(struct dump_bitmap *bitmap, unsigned long long pfn, - } - - int --set_bitmap_cyclic(char *bitmap, unsigned long long pfn, int val, struct cycle *cycle) -+set_bitmap_cyclic(char *bitmap, mdf_pfn_t pfn, int val, struct cycle *cycle) - { - int byte, bit; - static int warning = 0; -@@ -3425,7 +3427,7 @@ sync_2nd_bitmap(void) - } - - int --set_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle) -+set_bit_on_1st_bitmap(mdf_pfn_t pfn, struct cycle *cycle) - { - if (info->flag_cyclic) { - return set_bitmap_cyclic(info->partial_bitmap1, pfn, 1, cycle); -@@ -3435,7 +3437,7 @@ set_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle) - } - - int --clear_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle) -+clear_bit_on_1st_bitmap(mdf_pfn_t pfn, struct cycle *cycle) - { - if (info->flag_cyclic) { - return set_bitmap_cyclic(info->partial_bitmap1, pfn, 0, cycle); -@@ -3445,7 +3447,7 @@ clear_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle) - } - - int --clear_bit_on_2nd_bitmap(unsigned long long pfn, struct cycle *cycle) -+clear_bit_on_2nd_bitmap(mdf_pfn_t pfn, struct cycle *cycle) - { - if (info->flag_cyclic) { - return set_bitmap_cyclic(info->partial_bitmap2, pfn, 0, cycle); -@@ -3455,7 +3457,7 @@ clear_bit_on_2nd_bitmap(unsigned long long pfn, struct cycle *cycle) - } - - int --clear_bit_on_2nd_bitmap_for_kernel(unsigned long long pfn, struct cycle *cycle) -+clear_bit_on_2nd_bitmap_for_kernel(mdf_pfn_t pfn, struct cycle *cycle) - { - unsigned long long maddr; - -@@ -3472,7 +3474,7 @@ clear_bit_on_2nd_bitmap_for_kernel(unsigned long long pfn, struct cycle *cycle) - } - - int --set_bit_on_2nd_bitmap(unsigned long long pfn, struct cycle *cycle) -+set_bit_on_2nd_bitmap(mdf_pfn_t pfn, struct cycle *cycle) - { - if (info->flag_cyclic) { - return set_bitmap_cyclic(info->partial_bitmap2, pfn, 1, cycle); -@@ -3482,7 +3484,7 @@ set_bit_on_2nd_bitmap(unsigned long long pfn, struct cycle *cycle) - } - - int --set_bit_on_2nd_bitmap_for_kernel(unsigned long long pfn, struct cycle *cycle) -+set_bit_on_2nd_bitmap_for_kernel(mdf_pfn_t pfn, struct cycle *cycle) - { - unsigned long long maddr; - -@@ -3793,11 +3795,11 @@ rearrange_dumpdata(void) - return TRUE; - } - --unsigned long long -+mdf_pfn_t - page_to_pfn(unsigned long page) - { - unsigned int num; -- unsigned long long pfn = ULONGLONG_MAX; -+ mdf_pfn_t pfn = ULONGLONG_MAX; - unsigned long long index = 0; - struct mem_map_data *mmd; - -@@ -3827,7 +3829,7 @@ reset_bitmap_of_free_pages(unsigned long node_zones, struct cycle *cycle) - int order, i, migrate_type, migrate_types; - unsigned long curr, previous, head, curr_page, curr_prev; - unsigned long addr_free_pages, free_pages = 0, found_free_pages = 0; -- unsigned long long pfn, start_pfn; -+ mdf_pfn_t pfn, start_pfn; - - /* - * On linux-2.6.24 or later, free_list is divided into the array. -@@ -4430,7 +4432,7 @@ create_1st_bitmap(void) - int i; - unsigned int num_pt_loads = get_num_pt_loads(); - char buf[info->page_size]; -- unsigned long long pfn, pfn_start, pfn_end, pfn_bitmap1; -+ mdf_pfn_t pfn, pfn_start, pfn_end, pfn_bitmap1; - unsigned long long phys_start, phys_end; - struct timeval tv_start; - off_t offset_page; -@@ -4502,10 +4504,10 @@ int - create_1st_bitmap_cyclic(struct cycle *cycle) - { - int i; -- unsigned long long pfn, pfn_bitmap1; -+ mdf_pfn_t pfn, pfn_bitmap1; - unsigned long long phys_start, phys_end; -- unsigned long long pfn_start, pfn_end; -- unsigned long long pfn_start_roundup, pfn_end_round; -+ mdf_pfn_t pfn_start, pfn_end; -+ mdf_pfn_t pfn_start_roundup, pfn_end_round; - unsigned long pfn_start_byte, pfn_end_byte; - - /* -@@ -4563,7 +4565,8 @@ create_1st_bitmap_cyclic(struct cycle *cycle) - int - exclude_zero_pages(void) - { -- unsigned long long pfn, paddr; -+ mdf_pfn_t pfn; -+ unsigned long long paddr; - struct dump_bitmap bitmap2; - struct timeval tv_start; - unsigned char buf[info->page_size]; -@@ -4615,10 +4618,10 @@ static int - initialize_2nd_bitmap_cyclic(struct cycle *cycle) - { - int i; -- unsigned long long pfn; -+ mdf_pfn_t pfn; - unsigned long long phys_start, phys_end; -- unsigned long long pfn_start, pfn_end; -- unsigned long long pfn_start_roundup, pfn_end_round; -+ mdf_pfn_t pfn_start, pfn_end; -+ mdf_pfn_t pfn_start_roundup, pfn_end_round; - unsigned long pfn_start_byte, pfn_end_byte; - - /* -@@ -4666,10 +4669,12 @@ initialize_2nd_bitmap_cyclic(struct cycle *cycle) - - int - __exclude_unnecessary_pages(unsigned long mem_map, -- unsigned long long pfn_start, unsigned long long pfn_end, struct cycle *cycle) -+ mdf_pfn_t pfn_start, mdf_pfn_t pfn_end, struct cycle *cycle) - { -- unsigned long long pfn, pfn_mm, maddr; -- unsigned long long pfn_read_start, pfn_read_end, index_pg; -+ mdf_pfn_t pfn; -+ unsigned long index_pg, pfn_mm; -+ unsigned long long maddr; -+ mdf_pfn_t pfn_read_start, pfn_read_end; - unsigned char page_cache[SIZE(page) * PGMM_CACHED]; - unsigned char *pcache; - unsigned int _count, _mapcount = 0; -@@ -5169,7 +5174,7 @@ get_loads_dumpfile(void) - { - int i, phnum, num_new_load = 0; - long page_size = info->page_size; -- unsigned long long pfn, pfn_start, pfn_end, num_excluded; -+ mdf_pfn_t pfn, pfn_start, pfn_end, num_excluded; - unsigned long frac_head, frac_tail; - Elf64_Phdr load; - struct dump_bitmap bitmap2; -@@ -5619,10 +5624,10 @@ out: - return ret; - } - --unsigned long long -+mdf_pfn_t - get_num_dumpable(void) - { -- unsigned long long pfn, num_dumpable; -+ mdf_pfn_t pfn, num_dumpable; - struct dump_bitmap bitmap2; - - initialize_2nd_bitmap(&bitmap2); -@@ -5634,10 +5639,10 @@ get_num_dumpable(void) - return num_dumpable; - } - --unsigned long long -+mdf_pfn_t - get_num_dumpable_cyclic(void) - { -- unsigned long long pfn, num_dumpable=0; -+ mdf_pfn_t pfn, num_dumpable=0; - struct cycle cycle = {0}; - - for_each_cycle(0, info->max_mapnr, &cycle) -@@ -5699,8 +5704,9 @@ write_elf_pages(struct cache_data *cd_header, struct cache_data *cd_page) - { - int i, phnum; - long page_size = info->page_size; -- unsigned long long pfn, pfn_start, pfn_end, paddr, num_excluded; -- unsigned long long num_dumpable, per; -+ mdf_pfn_t pfn, pfn_start, pfn_end, num_excluded; -+ unsigned long long paddr; -+ mdf_pfn_t num_dumpable, per; - unsigned long long memsz, filesz; - unsigned long frac_head, frac_tail; - off_t off_seg_load, off_memory; -@@ -5885,7 +5891,7 @@ write_elf_pages(struct cache_data *cd_header, struct cache_data *cd_page) - } - - int --read_pfn(unsigned long long pfn, unsigned char *buf) -+read_pfn(mdf_pfn_t pfn, unsigned char *buf) - { - unsigned long long paddr; - -@@ -5904,7 +5910,7 @@ get_loads_dumpfile_cyclic(void) - int i, phnum, num_new_load = 0; - long page_size = info->page_size; - unsigned char buf[info->page_size]; -- unsigned long long pfn, pfn_start, pfn_end, num_excluded; -+ mdf_pfn_t pfn, pfn_start, pfn_end, num_excluded; - unsigned long frac_head, frac_tail; - Elf64_Phdr load; - struct cycle cycle = {0}; -@@ -5976,8 +5982,8 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - int i, phnum; - long page_size = info->page_size; - unsigned char buf[info->page_size]; -- unsigned long long pfn, pfn_start, pfn_end, paddr, num_excluded; -- unsigned long long num_dumpable, per; -+ mdf_pfn_t pfn, pfn_start, pfn_end, num_excluded, num_dumpable, per; -+ unsigned long long paddr; - unsigned long long memsz, filesz; - unsigned long frac_head, frac_tail; - off_t off_seg_load, off_memory; -@@ -6197,8 +6203,8 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - int - write_kdump_pages(struct cache_data *cd_header, struct cache_data *cd_page) - { -- unsigned long long pfn, per, num_dumpable; -- unsigned long long start_pfn, end_pfn; -+ mdf_pfn_t pfn, per, num_dumpable; -+ mdf_pfn_t start_pfn, end_pfn; - unsigned long size_out; - struct page_desc pd, pd_zero; - off_t offset_data = 0; -@@ -6404,8 +6410,8 @@ int - write_kdump_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page, - struct page_desc *pd_zero, off_t *offset_data, struct cycle *cycle) - { -- unsigned long long pfn, per; -- unsigned long long start_pfn, end_pfn; -+ mdf_pfn_t pfn, per; -+ mdf_pfn_t start_pfn, end_pfn; - unsigned long size_out; - struct page_desc pd; - unsigned char buf[info->page_size], *buf_out = NULL; -@@ -7511,7 +7517,7 @@ read_vmcoreinfo_xen(void) - } - - int --allocated_in_map(unsigned long long pfn) -+allocated_in_map(mdf_pfn_t pfn) - { - static unsigned long long cur_idx = -1; - static unsigned long cur_word; -@@ -7557,8 +7563,8 @@ exclude_xen3_user_domain(void) - unsigned int num_pt_loads = get_num_pt_loads(); - unsigned long page_info_addr; - unsigned long long phys_start, phys_end; -- unsigned long long pfn, pfn_end; -- unsigned long long j, size; -+ mdf_pfn_t pfn, pfn_end; -+ mdf_pfn_t j, size; - - /* - * NOTE: the first half of bitmap is not used for Xen extraction -@@ -7621,8 +7627,8 @@ exclude_xen4_user_domain(void) - unsigned int num_pt_loads = get_num_pt_loads(); - unsigned long page_info_addr; - unsigned long long phys_start, phys_end; -- unsigned long long pfn, pfn_end; -- unsigned long long j, size; -+ mdf_pfn_t pfn, pfn_end; -+ mdf_pfn_t j, size; - - /* - * NOTE: the first half of bitmap is not used for Xen extraction -@@ -7847,7 +7853,7 @@ print_vtop(void) - void - print_report(void) - { -- unsigned long long pfn_original, pfn_excluded, shrinking; -+ mdf_pfn_t pfn_original, pfn_excluded, shrinking; - - /* - * /proc/vmcore doesn't contain the memory hole area. -@@ -7952,9 +7958,9 @@ int - setup_splitting(void) - { - int i; -- unsigned long long j, pfn_per_dumpfile; -- unsigned long long start_pfn, end_pfn; -- unsigned long long num_dumpable = get_num_dumpable(); -+ mdf_pfn_t j, pfn_per_dumpfile; -+ mdf_pfn_t start_pfn, end_pfn; -+ mdf_pfn_t num_dumpable = get_num_dumpable(); - struct dump_bitmap bitmap2; - - if (info->num_dumpfile <= 1) -@@ -8281,7 +8287,7 @@ void - sort_splitting_info(void) - { - int i, j; -- unsigned long long start_pfn, end_pfn; -+ mdf_pfn_t start_pfn, end_pfn; - char *name_dumpfile; - - /* -@@ -8317,7 +8323,7 @@ int - check_splitting_info(void) - { - int i; -- unsigned long long end_pfn; -+ mdf_pfn_t end_pfn; - - /* - * Check whether there are not lack of /proc/vmcore. -@@ -8544,8 +8550,8 @@ reassemble_kdump_pages(void) - int i, fd = 0, ret = FALSE; - off_t offset_first_ph, offset_ph_org, offset_eraseinfo; - off_t offset_data_new, offset_zero_page = 0; -- unsigned long long pfn, start_pfn, end_pfn; -- unsigned long long num_dumpable; -+ mdf_pfn_t pfn, start_pfn, end_pfn; -+ mdf_pfn_t num_dumpable; - unsigned long size_eraseinfo; - struct dump_bitmap bitmap2; - struct disk_dump_header dh; -diff --git a/makedumpfile.h b/makedumpfile.h -index ad064a4..eb03688 100644 ---- a/makedumpfile-1.5.6/makedumpfile.h -+++ b/makedumpfile-1.5.6/makedumpfile.h -@@ -767,13 +767,15 @@ unsigned long long vaddr_to_paddr_ia64(unsigned long vaddr); - #define VADDR_REGION(X) (((unsigned long)(X)) >> REGION_SHIFT) - #endif /* ia64 */ - -+typedef unsigned long long mdf_pfn_t; -+ - #ifndef ARCH_PFN_OFFSET - #define ARCH_PFN_OFFSET 0 - #endif - #define paddr_to_pfn(X) \ - (((unsigned long long)(X) >> PAGESHIFT()) - ARCH_PFN_OFFSET) - #define pfn_to_paddr(X) \ -- (((unsigned long long)(X) + ARCH_PFN_OFFSET) << PAGESHIFT()) -+ (((mdf_pfn_t)(X) + ARCH_PFN_OFFSET) << PAGESHIFT()) - - /* Format of Xen crash info ELF note */ - typedef struct { -@@ -813,8 +815,8 @@ typedef struct { - } xen_crash_info_v2_t; - - struct mem_map_data { -- unsigned long long pfn_start; -- unsigned long long pfn_end; -+ mdf_pfn_t pfn_start; -+ mdf_pfn_t pfn_end; - unsigned long mem_map; - }; - -@@ -866,8 +868,8 @@ struct makedumpfile_data_header { - struct splitting_info { - char *name_dumpfile; - int fd_bitmap; -- unsigned long long start_pfn; -- unsigned long long end_pfn; -+ mdf_pfn_t start_pfn; -+ mdf_pfn_t end_pfn; - off_t offset_eraseinfo; - unsigned long size_eraseinfo; - } splitting_info_t; -@@ -914,7 +916,7 @@ struct DumpInfo { - unsigned long vaddr_for_vtop; /* virtual address for debugging */ - long page_size; /* size of page */ - long page_shift; -- unsigned long long max_mapnr; /* number of page descriptor */ -+ mdf_pfn_t max_mapnr; /* number of page descriptor */ - unsigned long page_offset; - unsigned long section_size_bits; - unsigned long max_physmem_bits; -@@ -1025,10 +1027,10 @@ struct DumpInfo { - * 1 .. xen_crash_info_t - * 2 .. xen_crash_info_v2_t */ - -- unsigned long long dom0_mapnr; /* The number of page in domain-0. -- * Different from max_mapnr. -- * max_mapnr is the number of page -- * in system. */ -+ mdf_pfn_t dom0_mapnr; /* The number of page in domain-0. -+ * Different from max_mapnr. -+ * max_mapnr is the number of page -+ * in system. */ - unsigned long xen_phys_start; - unsigned long xen_heap_start; /* start mfn of xen heap area */ - unsigned long xen_heap_end; /* end mfn(+1) of xen heap area */ -@@ -1048,15 +1050,15 @@ struct DumpInfo { - /* - * for splitting - */ -- unsigned long long split_start_pfn; -- unsigned long long split_end_pfn; -+ mdf_pfn_t split_start_pfn; -+ mdf_pfn_t split_end_pfn; - - /* - * for cyclic processing - */ - char *partial_bitmap1; - char *partial_bitmap2; -- unsigned long long num_dumpable; -+ mdf_pfn_t num_dumpable; - unsigned long bufsize_cyclic; - unsigned long pfn_cyclic; - -@@ -1453,7 +1455,7 @@ int readmem(int type_addr, unsigned long long addr, void *bufptr, size_t size); - int get_str_osrelease_from_vmlinux(void); - int read_vmcoreinfo_xen(void); - int exclude_xen_user_domain(void); --unsigned long long get_num_dumpable(void); -+mdf_pfn_t get_num_dumpable(void); - int __read_disk_dump_header(struct disk_dump_header *dh, char *filename); - int read_disk_dump_header(struct disk_dump_header *dh, char *filename); - int read_kdump_sub_header(struct kdump_sub_header *kh, char *filename); -@@ -1589,18 +1591,18 @@ int get_xen_info_ia64(void); - #endif /* s390x */ - - struct cycle { -- unsigned long long start_pfn; -- unsigned long long end_pfn; -+ mdf_pfn_t start_pfn; -+ mdf_pfn_t end_pfn; - }; - - static inline int --is_on(char *bitmap, unsigned long long i) -+is_on(char *bitmap, mdf_pfn_t i) - { - return bitmap[i>>3] & (1 << (i & 7)); - } - - static inline int --is_dumpable(struct dump_bitmap *bitmap, unsigned long long pfn) -+is_dumpable(struct dump_bitmap *bitmap, mdf_pfn_t pfn) - { - off_t offset; - if (pfn == 0 || bitmap->no_block != pfn/PFN_BUFBITMAP) { -@@ -1616,7 +1618,7 @@ is_dumpable(struct dump_bitmap *bitmap, unsigned long long pfn) - } - - static inline int --is_dumpable_cyclic(char *bitmap, unsigned long long pfn, struct cycle *cycle) -+is_dumpable_cyclic(char *bitmap, mdf_pfn_t pfn, struct cycle *cycle) - { - if (pfn < cycle->start_pfn || cycle->end_pfn <= pfn) - return FALSE; -@@ -1625,7 +1627,7 @@ is_dumpable_cyclic(char *bitmap, unsigned long long pfn, struct cycle *cycle) - } - - static inline int --is_cyclic_region(unsigned long long pfn, struct cycle *cycle) -+is_cyclic_region(mdf_pfn_t pfn, struct cycle *cycle) - { - if (pfn < cycle->start_pfn || cycle->end_pfn <= pfn) - return FALSE; -@@ -1647,8 +1649,8 @@ is_zero_page(unsigned char *buf, long page_size) - } - - void write_vmcoreinfo_data(void); --int set_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle); --int clear_bit_on_1st_bitmap(unsigned long long pfn, struct cycle *cycle); -+int set_bit_on_1st_bitmap(mdf_pfn_t pfn, struct cycle *cycle); -+int clear_bit_on_1st_bitmap(mdf_pfn_t pfn, struct cycle *cycle); - - #ifdef __x86__ - -@@ -1759,7 +1761,7 @@ struct elf_prstatus { - /* - * Function Prototype. - */ --unsigned long long get_num_dumpable_cyclic(void); -+mdf_pfn_t get_num_dumpable_cyclic(void); - int get_loads_dumpfile_cyclic(void); - int initial_xen(void); - unsigned long long get_free_memory_size(void); -diff --git a/sadump_info.c b/sadump_info.c -index f14ffc9..9434ff7 100644 ---- a/makedumpfile-1.5.6/sadump_info.c -+++ b/makedumpfile-1.5.6/sadump_info.c -@@ -94,7 +94,7 @@ static int read_device_diskset(struct sadump_diskset_info *sdi, void *buf, - size_t bytes, ulong *offset); - static int read_sadump_header(char *filename); - static int read_sadump_header_diskset(int diskid, struct sadump_diskset_info *sdi); --static unsigned long long pfn_to_block(unsigned long long pfn); -+static unsigned long long pfn_to_block(mdf_pfn_t pfn); - static int lookup_diskset(unsigned long long whole_offset, int *diskid, - unsigned long long *disk_offset); - static int max_mask_cpu(void); -@@ -202,7 +202,8 @@ sadump_copy_1st_bitmap_from_memory(void) - * modify bitmap accordingly. - */ - if (si->kdump_backed_up) { -- unsigned long long paddr, pfn, backup_src_pfn; -+ unsigned long long paddr; -+ mdf_pfn_t pfn, backup_src_pfn; - - for (paddr = si->backup_src_start; - paddr < si->backup_src_start + si->backup_src_size; -@@ -754,7 +755,8 @@ sadump_initialize_bitmap_memory(void) - struct sadump_header *sh = si->sh_memory; - struct dump_bitmap *bmp; - unsigned long dumpable_bitmap_offset; -- unsigned long long section, max_section, pfn; -+ unsigned long long section, max_section; -+ mdf_pfn_t pfn; - unsigned long long *block_table; - - dumpable_bitmap_offset = -@@ -901,7 +903,7 @@ sadump_set_timestamp(struct timeval *ts) - return TRUE; - } - --unsigned long long -+mdf_pfn_t - sadump_get_max_mapnr(void) - { - return si->sh_memory->max_mapnr; -@@ -951,7 +953,8 @@ failed: - int - readpage_sadump(unsigned long long paddr, void *bufptr) - { -- unsigned long long pfn, block, whole_offset, perdisk_offset; -+ mdf_pfn_t pfn; -+ unsigned long long block, whole_offset, perdisk_offset; - int fd_memory; - - if (si->kdump_backed_up && -@@ -1117,7 +1120,7 @@ sadump_check_debug_info(void) - } - - static unsigned long long --pfn_to_block(unsigned long long pfn) -+pfn_to_block(mdf_pfn_t pfn) - { - unsigned long long block, section, p; - -diff --git a/sadump_info.h b/sadump_info.h -index c0175dd..131687a 100644 ---- a/makedumpfile-1.5.6/sadump_info.h -+++ b/makedumpfile-1.5.6/sadump_info.h -@@ -42,7 +42,7 @@ int sadump_copy_1st_bitmap_from_memory(void); - int sadump_initialize_bitmap_memory(void); - int sadump_num_online_cpus(void); - int sadump_set_timestamp(struct timeval *ts); --unsigned long long sadump_get_max_mapnr(void); -+mdf_pfn_t sadump_get_max_mapnr(void); - int readpage_sadump(unsigned long long paddr, void *bufptr); - int sadump_check_debug_info(void); - int sadump_generate_vmcoreinfo_from_vmlinux(size_t *vmcoreinfo_size); -@@ -92,7 +92,7 @@ static inline int sadump_set_timestamp(struct timeval *ts) - return FALSE; - } - --static inline unsigned long long sadump_get_max_mapnr(void) -+static inline mdf_pfn_t sadump_get_max_mapnr(void) - { - return 0; - } --- -1.8.5.3 - diff --git a/kexec-tools-2.0.4-makedumpfile-Move-counting-pfn_memhole-for-cyclic-mode.patch b/kexec-tools-2.0.4-makedumpfile-Move-counting-pfn_memhole-for-cyclic-mode.patch deleted file mode 100644 index fbed9df..0000000 --- a/kexec-tools-2.0.4-makedumpfile-Move-counting-pfn_memhole-for-cyclic-mode.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 2648a8f7caa63e3ec82fd4bce471cec0a895b704 Mon Sep 17 00:00:00 2001 -From: Atsushi Kumagai -Date: Mon, 9 Jun 2014 17:48:30 +0900 -Subject: [PATCH] [PATCH 2/3] Move counting pfn_memhole for cyclic mode. - -In cyclic mode, memory holes are checked in initialize_2nd_bitmap_cyclic() -in both the kdump path and the ELF path, so pfn_memhole should be -counted there. - -Signed-off-by: Atsushi Kumagai -Signed-off-by: Baoquan He ---- - makedumpfile.c | 18 ++++++++---------- - 1 file changed, 8 insertions(+), 10 deletions(-) - -diff --git a/makedumpfile.c b/makedumpfile.c -index f62e94c..b8f1ec4 100644 ---- a/makedumpfile-1.5.6/makedumpfile.c -+++ b/makedumpfile-1.5.6/makedumpfile.c -@@ -4450,7 +4450,7 @@ int - create_1st_bitmap_cyclic(struct cycle *cycle) - { - int i; -- mdf_pfn_t pfn, pfn_bitmap1; -+ mdf_pfn_t pfn; - unsigned long long phys_start, phys_end; - mdf_pfn_t pfn_start, pfn_end; - mdf_pfn_t pfn_start_roundup, pfn_end_round; -@@ -4465,7 +4465,6 @@ create_1st_bitmap_cyclic(struct cycle *cycle) - * If page is on memory hole, set bit on the 1st-bitmap. - * (note that this is not done in cyclic mode) - */ -- pfn_bitmap1 = 0; - for (i = 0; get_pt_load(i, &phys_start, &phys_end, NULL, NULL); i++) { - pfn_start = MAX(paddr_to_pfn(phys_start), cycle->start_pfn); - pfn_end = MIN(paddr_to_pfn(phys_end), cycle->end_pfn); -@@ -4478,8 +4477,7 @@ create_1st_bitmap_cyclic(struct cycle *cycle) - pfn_end_round = MAX(round(pfn_end, BITPERBYTE), pfn_start); - - for (pfn = pfn_start; pfn < pfn_start_roundup; pfn++) { -- if (set_bit_on_1st_bitmap(pfn, cycle)) -- pfn_bitmap1++; -+ set_bit_on_1st_bitmap(pfn, cycle); - } - - pfn_start_byte = (pfn_start_roundup - cycle->start_pfn) >> 3; -@@ -4489,18 +4487,14 @@ create_1st_bitmap_cyclic(struct cycle *cycle) - memset(info->partial_bitmap1 + pfn_start_byte, - 0xff, - pfn_end_byte - pfn_start_byte); -- -- pfn_bitmap1 += (pfn_end_byte - pfn_start_byte) * BITPERBYTE; - } - - if (pfn_end_round >= pfn_start) { - for (pfn = pfn_end_round; pfn < pfn_end; pfn++) { -- if (set_bit_on_1st_bitmap(pfn, cycle)) -- pfn_bitmap1++; -+ set_bit_on_1st_bitmap(pfn, cycle); - } - } - } -- pfn_memhole -= pfn_bitmap1; - - return TRUE; - } -@@ -4589,9 +4583,11 @@ initialize_2nd_bitmap_cyclic(struct cycle *cycle) - pfn_end); - pfn_end_round = MAX(round(pfn_end, BITPERBYTE), pfn_start); - -- for (pfn = pfn_start; pfn < pfn_start_roundup; ++pfn) -+ for (pfn = pfn_start; pfn < pfn_start_roundup; ++pfn) { - if (!set_bit_on_2nd_bitmap_for_kernel(pfn, cycle)) - return FALSE; -+ pfn_memhole--; -+ } - - pfn_start_byte = (pfn_start_roundup - cycle->start_pfn) >> 3; - pfn_end_byte = (pfn_end_round - cycle->start_pfn) >> 3; -@@ -4600,12 +4596,14 @@ initialize_2nd_bitmap_cyclic(struct cycle *cycle) - memset(info->partial_bitmap2 + pfn_start_byte, - 0xff, - pfn_end_byte - pfn_start_byte); -+ pfn_memhole -= (pfn_end_byte - pfn_start_byte) << 3; - } - - if (pfn_end_round >= pfn_start) { - for (pfn = pfn_end_round; pfn < pfn_end; ++pfn) { - if (!set_bit_on_2nd_bitmap_for_kernel(pfn, cycle)) - return FALSE; -+ pfn_memhole--; - } - } - } --- -1.8.5.3 - diff --git a/kexec-tools-2.0.4-makedumpfile-Remove-the-1st-bitmap-buffer-from-the-ELF-.patch b/kexec-tools-2.0.4-makedumpfile-Remove-the-1st-bitmap-buffer-from-the-ELF-.patch deleted file mode 100644 index 0efcda0..0000000 --- a/kexec-tools-2.0.4-makedumpfile-Remove-the-1st-bitmap-buffer-from-the-ELF-.patch +++ /dev/null @@ -1,189 +0,0 @@ -From 16b94ab7fad6744d8b77f2b26838f220307e3118 Mon Sep 17 00:00:00 2001 -From: Atsushi Kumagai -Date: Mon, 9 Jun 2014 17:44:43 +0900 -Subject: [PATCH] [PATCH 1/3] Remove the 1st bitmap buffer from the ELF path in - cyclic mode. - -We can create the 2nd bitmap without creating the 1st bitmap by commit -363d53fc8, so we don't need to create the 1st bitmap in cyclic mode -in the ELF path since it isn't used. Thus, we can use the whole bitmap -buffer only for the 2nd bitmap like the kdump path. - -Signed-off-by: Atsushi Kumagai -Signed-off-by: Baoquan He ---- - makedumpfile.8 | 1 - - makedumpfile.c | 88 ++++++---------------------------------------------------- - print_info.c | 1 - - 3 files changed, 9 insertions(+), 81 deletions(-) - -diff --git a/makedumpfile.8 b/makedumpfile.8 -index 529335c..25fe74e 100644 ---- a/makedumpfile-1.5.6/makedumpfile.8 -+++ b/makedumpfile-1.5.6/makedumpfile.8 -@@ -371,7 +371,6 @@ The default value is 4. - .TP - \fB\-\-cyclic\-buffer\fR \fIbuffer_size\fR - Specify the buffer size in kilo bytes for analysis in the cyclic mode. --Actually, the double of \fIbuffer_size\fR kilo bytes will be allocated in memory. - In the cyclic mode, the number of cycles is represented as: - - num_of_cycles = system_memory / (\fIbuffer_size\fR * 1024 * bit_per_bytes * page_size ) -diff --git a/makedumpfile.c b/makedumpfile.c -index 34db997..f62e94c 100644 ---- a/makedumpfile-1.5.6/makedumpfile.c -+++ b/makedumpfile-1.5.6/makedumpfile.c -@@ -3195,24 +3195,7 @@ out: - MSG("Specified buffer size is larger than free memory.\n"); - MSG("The buffer size for the cyclic mode will "); - MSG("be truncated to %lld byte.\n", free_memory); -- /* -- * On conversion from ELF to ELF, -- * bufsize_cyclic is used to allocate -- * 1st and 2nd bitmap, so it should be -- * truncated to the half of -- * free_memory. -- * -- * On conversion from ELF to -- * kdump-compressed format, a whole -- * part of the 1st bitmap is created -- * first, so a whole part of -- * free_memory is used for the 2nd -- * bitmap. -- */ -- if (info->flag_elf_dumpfile) -- info->bufsize_cyclic = free_memory / 2; -- else -- info->bufsize_cyclic = free_memory; -+ info->bufsize_cyclic = free_memory; - } - } - -@@ -5016,38 +4999,6 @@ prepare_bitmap_buffer(void) - } - - int --prepare_bitmap_buffer_cyclic(void) --{ -- unsigned long long tmp; -- -- /* -- * Create 2 bitmaps (1st-bitmap & 2nd-bitmap) on block_size boundary. -- * The crash utility requires both of them to be aligned to block_size -- * boundary. -- */ -- tmp = divideup(divideup(info->max_mapnr, BITPERBYTE), info->page_size); -- info->len_bitmap = tmp*info->page_size*2; -- -- /* -- * Prepare partial bitmap buffers for cyclic processing. -- */ -- if ((info->partial_bitmap1 = (char *)malloc(info->bufsize_cyclic)) == NULL) { -- ERRMSG("Can't allocate memory for the 1st-bitmap. %s\n", -- strerror(errno)); -- return FALSE; -- } -- if ((info->partial_bitmap2 = (char *)malloc(info->bufsize_cyclic)) == NULL) { -- ERRMSG("Can't allocate memory for the 2nd-bitmap. %s\n", -- strerror(errno)); -- return FALSE; -- } -- initialize_bitmap_cyclic(info->partial_bitmap1); -- initialize_bitmap_cyclic(info->partial_bitmap2); -- -- return TRUE; --} -- --int - prepare_bitmap1_buffer_cyclic(void) - { - /* -@@ -5132,32 +5083,18 @@ free_bitmap2_buffer_cyclic() - } - } - --void --free_bitmap_buffer_cyclic() --{ -- free_bitmap1_buffer_cyclic(); -- free_bitmap2_buffer_cyclic(); --} -- - int - create_dump_bitmap(void) - { - int ret = FALSE; - - if (info->flag_cyclic) { -+ if (!prepare_bitmap2_buffer_cyclic()) -+ goto out; -+ info->num_dumpable = get_num_dumpable_cyclic(); - -- if (info->flag_elf_dumpfile) { -- if (!prepare_bitmap_buffer_cyclic()) -- goto out; -- -- info->num_dumpable = get_num_dumpable_cyclic(); -- } else { -- if (!prepare_bitmap2_buffer_cyclic()) -- goto out; -- -- info->num_dumpable = get_num_dumpable_cyclic(); -+ if (!info->flag_elf_dumpfile) - free_bitmap2_buffer_cyclic(); -- } - - } else { - if (!prepare_bitmap_buffer()) -@@ -6051,8 +5988,6 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - /* - * Update target region and partial bitmap if necessary. - */ -- if (!create_1st_bitmap_cyclic(&cycle)) -- return FALSE; - if (!exclude_unnecessary_pages_cyclic(&cycle)) - return FALSE; - -@@ -6198,7 +6133,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) - if (!write_cache_bufsz(cd_page)) - return FALSE; - -- free_bitmap_buffer_cyclic(); -+ free_bitmap2_buffer_cyclic(); - - /* - * print [100 %] -@@ -9027,15 +8962,10 @@ calculate_cyclic_buffer_size(void) { - } - - /* -- * free_size will be used to allocate 1st and 2nd bitmap, so it -- * should be 40% of free memory to keep the size of cyclic buffer -- * within 80% of free memory. -+ * We should keep the size of cyclic buffer within 80% of free memory -+ * for safety. - */ -- if (info->flag_elf_dumpfile) { -- limit_size = get_free_memory_size() * 0.4; -- } else { -- limit_size = get_free_memory_size() * 0.8; -- } -+ limit_size = get_free_memory_size() * 0.8; - bitmap_size = info->max_mapnr / BITPERBYTE; - - /* if --split was specified cyclic buffer allocated per dump file */ -diff --git a/print_info.c b/print_info.c -index 104ec1c..7592690 100644 ---- a/makedumpfile-1.5.6/print_info.c -+++ b/makedumpfile-1.5.6/print_info.c -@@ -191,7 +191,6 @@ print_usage(void) - MSG("\n"); - MSG(" [--cyclic-buffer BUFFER_SIZE]:\n"); - MSG(" Specify the buffer size in kilo bytes for analysis in the cyclic mode.\n"); -- MSG(" Actually, the double of BUFFER_SIZE kilo bytes will be allocated in memory.\n"); - MSG(" In the cyclic mode, the number of cycles is represented as:\n"); - MSG("\n"); - MSG(" num_of_cycles = system_memory / \n"); --- -1.8.5.3 - diff --git a/kexec-tools-2.0.4-makedumpfile-Stop-maximizing-the-bitmap-buffer-to-reduc.patch b/kexec-tools-2.0.4-makedumpfile-Stop-maximizing-the-bitmap-buffer-to-reduc.patch deleted file mode 100644 index db8ee92..0000000 --- a/kexec-tools-2.0.4-makedumpfile-Stop-maximizing-the-bitmap-buffer-to-reduc.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0b732828091a545185ad13d0b2e6800600788d61 Mon Sep 17 00:00:00 2001 -From: Atsushi Kumagai -Date: Tue, 10 Jun 2014 13:57:29 +0900 -Subject: [PATCH] [PATCH 3/3] Stop maximizing the bitmap buffer to reduce the - risk of OOM. - -We tried to maximize the bitmap buffer to get the best performance, -but the performance degradation caused by multi-cycle processing -looks very small according to the benchmark on 2TB memory: - - https://lkml.org/lkml/2013/3/26/914 - -This result means we don't need to make an effort to maximize the -bitmap buffer, it will just increase the risk of OOM. - -This patch sets a small fixed value (4MB) as a safety limit, -it may be safer and enough in most cases. - -Signed-off-by: Atsushi Kumagai -Signed-off-by: Baoquan He ---- - makedumpfile.c | 17 ++++++++++------- - 1 file changed, 10 insertions(+), 7 deletions(-) - -diff --git a/makedumpfile.c b/makedumpfile.c -index b8f1ec4..3884aa5 100644 ---- a/makedumpfile-1.5.6/makedumpfile.c -+++ b/makedumpfile-1.5.6/makedumpfile.c -@@ -8946,13 +8946,15 @@ out: - - - /* -- * Choose the lesser value of the two below as the size of cyclic buffer. -- * - the size enough for storing the 1st/2nd bitmap for the whole of vmcore -- * - 80% of free memory (as safety limit) -+ * Choose the less value of the three below as the size of cyclic buffer. -+ * - the size enough for storing the 1st or 2nd bitmap for the whole of vmcore -+ * - 4MB as sufficient value -+ * - 60% of free memory as safety limit - */ - int - calculate_cyclic_buffer_size(void) { - unsigned long long limit_size, bitmap_size; -+ const unsigned long long maximum_size = 4 * 1024 * 1024; - - if (info->max_mapnr <= 0) { - ERRMSG("Invalid max_mapnr(%llu).\n", info->max_mapnr); -@@ -8960,17 +8962,18 @@ calculate_cyclic_buffer_size(void) { - } - - /* -- * We should keep the size of cyclic buffer within 80% of free memory -- * for safety. -+ * At least, we should keep the size of cyclic buffer within 60% of -+ * free memory for safety. - */ -- limit_size = get_free_memory_size() * 0.8; -+ limit_size = get_free_memory_size() * 0.6; - bitmap_size = info->max_mapnr / BITPERBYTE; - - /* if --split was specified cyclic buffer allocated per dump file */ - if (info->num_dumpfile > 1) - bitmap_size /= info->num_dumpfile; - -- info->bufsize_cyclic = MIN(limit_size, bitmap_size); -+ /* 4MB will be enough for performance according to benchmarks. */ -+ info->bufsize_cyclic = MIN(MIN(limit_size, maximum_size), bitmap_size); - - return TRUE; - } --- -1.8.5.3 - diff --git a/kexec-tools.spec b/kexec-tools.spec index 6411ccf..017b801 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -12,7 +12,7 @@ Source4: kdump.sysconfig.i386 Source5: kdump.sysconfig.ppc64 Source7: mkdumprd Source8: kdump.conf -Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.5.6/makedumpfile-1.5.6.tar.gz +Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.5.7/makedumpfile-1.5.7.tar.gz Source10: kexec-kdump-howto.txt Source12: mkdumprd.8 Source14: 98-kexec.rules @@ -82,12 +82,6 @@ Patch303: kexec-tools-2.0.7-ppc64-kdump-Fix-ELF-header-endianess.patch # Patches 601 onward are generic patches # Patch601: kexec-tools-2.0.3-disable-kexec-test.patch -Patch602: kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch -Patch603: kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch -Patch604: kexec-tools-2.0.4-makedumpfile-Fix-free-bitmap_buffer_cyclic-error.patch -Patch605: kexec-tools-2.0.4-makedumpfile-Remove-the-1st-bitmap-buffer-from-the-ELF-.patch -Patch606: kexec-tools-2.0.4-makedumpfile-Move-counting-pfn_memhole-for-cyclic-mode.patch -Patch607: kexec-tools-2.0.4-makedumpfile-Stop-maximizing-the-bitmap-buffer-to-reduc.patch %description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -125,12 +119,6 @@ tar -z -x -v -f %{SOURCE23} %patch101 -p1 %patch601 -p1 -%patch602 -p1 -%patch603 -p1 -%patch604 -p1 -%patch605 -p1 -%patch606 -p1 -%patch607 -p1 %patch301 -p1 %patch302 -p1 %patch303 -p1 @@ -155,8 +143,8 @@ cp %{SOURCE21} . make %ifarch %{ix86} x86_64 ppc64 s390x make -C eppic/libeppic -make -C makedumpfile-1.5.6 LINKTYPE=dynamic USELZO=on USESNAPPY=on -make -C makedumpfile-1.5.6 LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so +make -C makedumpfile-1.5.7 LINKTYPE=dynamic USELZO=on USESNAPPY=on +make -C makedumpfile-1.5.7 LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so %endif make -C kdump-anaconda-addon/po @@ -198,13 +186,13 @@ mkdir -p $RPM_BUILD_ROOT/usr/sbin install -m 755 %{SOURCE17} $RPM_BUILD_ROOT/usr/sbin/rhcrashkernel-param %ifarch %{ix86} x86_64 ppc64 s390x -install -m 755 makedumpfile-1.5.6/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile -install -m 644 makedumpfile-1.5.6/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz -install -m 644 makedumpfile-1.5.6/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz -install -m 644 makedumpfile-1.5.6/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample -install -m 755 makedumpfile-1.5.6/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so +install -m 755 makedumpfile-1.5.7/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile +install -m 644 makedumpfile-1.5.7/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz +install -m 644 makedumpfile-1.5.7/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz +install -m 644 makedumpfile-1.5.7/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample +install -m 755 makedumpfile-1.5.7/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ -install -m 644 makedumpfile-1.5.6/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ +install -m 644 makedumpfile-1.5.7/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ %endif make -C kdump-anaconda-addon install DESTDIR=$RPM_BUILD_ROOT %find_lang kdump-anaconda-addon diff --git a/sources b/sources index ee68cce..b7279b0 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ b48eb2726d602c1aa3abfd3739441f54 eppic_030413.tar.gz -874990aedbdd28689a238917169852f8 makedumpfile-1.5.6.tar.gz 457f49ad1708eea1f6b332484855fe25 kexec-tools-2.0.7.tar.xz bfa29b813ed6d266150a684ad34a6c21 kdump-anaconda-addon-003.tar.gz +31668a6dfb8823dd0b7ac09d06fb902e makedumpfile-1.5.7.tar.gz