[PATCH] Add sample eppic scripts to kexec-tools-eppic package
by WANG Chao
Upstream makedumpfile contains some sample eppic scripts for reference.
Now pull the whole scripts directory into kexec-tools-eppic package.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kexec-tools.spec | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index af0c69b..6411ccf 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -203,6 +203,8 @@ install -m 644 makedumpfile-1.5.6/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/m
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
+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/
%endif
make -C kdump-anaconda-addon install DESTDIR=$RPM_BUILD_ROOT
%find_lang kdump-anaconda-addon
@@ -324,6 +326,7 @@ done
%ifarch %{ix86} x86_64 ppc64 s390x
%files eppic
%{_libdir}/eppic_makedumpfile.so
+/usr/share/makedumpfile/eppic_scripts/
%endif
%files anaconda-addon -f kdump-anaconda-addon.lang
--
1.9.3
9 years, 6 months
[PATCH] mkdumprd: try to get mount options from fstab first
by Baoquan He
Previously if a target need mount info, the relevant mount options
are got from /proc/mounts by below command:
findmnt -k -f -n -r -o OPTIONS $_dev
This will bring problems. Since /proc/mounts will give out a set
which contains each option. Some options have value specified by
user, some options just have default value if user doesn't specify.
If some mount options are not supported very well, bugs occured.
The more options, the worse.
So in this patch, we try to check fstab to get mount options firstly,
this give user a chance to decide which options they really want.
If they don't give a fstab entry, then we trust all options in
/proc/mounts.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
mkdumprd | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index 409235b..e9246f2 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -104,7 +104,12 @@ to_mount() {
# mount under /sysroot in 2nd kernel, and we umount -R /sysroot before exit
_target="/sysroot$_target"
_fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
- _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
+ _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
+ if [ -z "$_options" ]; then
+ _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
+ elif [ "$_options" = "defaults" ]; then
+ _options=""
+ fi
_options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel
# "x-initrd.mount" mount failure will trigger isolate emergency service
# W/o this, systemd won't isolate, thus we won't get to emergency.
--
1.8.5.3
9 years, 6 months
[PATCH] Rebase makedumpfile-1.5.7
by WANG Chao
Rebase makedumpfile-1.5.7 and remove the useless patches.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
.gitignore | 3 +-
...-Makefile-for-eppic_makedumpfile.so-build.patch | 48 --
...pfile-Fix-free-bitmap_buffer_cyclic-error.patch | 111 ----
...makedumpfile-Introduce-the-mdf_pfn_t-type.patch | 738 ---------------------
...Move-counting-pfn_memhole-for-cyclic-mode.patch | 97 ---
...emove-the-1st-bitmap-buffer-from-the-ELF-.patch | 189 ------
...top-maximizing-the-bitmap-buffer-to-reduc.patch | 73 --
kexec-tools.spec | 30 +-
sources | 2 +-
9 files changed, 11 insertions(+), 1280 deletions(-)
delete mode 100644 kexec-tools-2.0.4-makedumpfile-Fix-Makefile-for-eppic_makedumpfile.so-build.patch
delete mode 100644 kexec-tools-2.0.4-makedumpfile-Fix-free-bitmap_buffer_cyclic-error.patch
delete mode 100644 kexec-tools-2.0.4-makedumpfile-Introduce-the-mdf_pfn_t-type.patch
delete mode 100644 kexec-tools-2.0.4-makedumpfile-Move-counting-pfn_memhole-for-cyclic-mode.patch
delete mode 100644 kexec-tools-2.0.4-makedumpfile-Remove-the-1st-bitmap-buffer-from-the-ELF-.patch
delete mode 100644 kexec-tools-2.0.4-makedumpfile-Stop-maximizing-the-bitmap-buffer-to-reduc.patch
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 <chaowang(a)redhat.com>
-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 <chaowang(a)redhat.com>
----
- 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 <zzou(a)redhat.com>
-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 <zzou(a)redhat.com>
-Signed-off-by: Baoquan He <bhe(a)redhat.com>
----
- 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 <ptesarik(a)suse.cz>
-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 <ptesarik(a)suse.cz>
-Signed-off-by: Baoquan He <bhe(a)redhat.com>
----
- 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 <kumagai-atsushi(a)mxc.nes.nec.co.jp>
-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 <kumagai-atsushi(a)mxc.nes.nec.co.jp>
-Signed-off-by: Baoquan He <bhe(a)redhat.com>
----
- 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 <kumagai-atsushi(a)mxc.nes.nec.co.jp>
-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 <kumagai-atsushi(a)mxc.nes.nec.co.jp>
-Signed-off-by: Baoquan He <bhe(a)redhat.com>
----
- 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 <kumagai-atsushi(a)mxc.nes.nec.co.jp>
-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 <kumagai-atsushi(a)mxc.nes.nec.co.jp>
-Signed-off-by: Baoquan He <bhe(a)redhat.com>
----
- 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/...
+Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.5.7/...
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
--
1.9.3
9 years, 6 months
[PATCH] udev-rules: Restart kdump service on cpu ADD/REMOVE events
by Vivek Goyal
This patch changes restart of kdump service from cpu online/offline events
to cpu add/remove events.
Some people have complained that they are running cpu online/offline tests
at high frequency and kdump restarts at high frequency and systemd disables
the service. As a temporary fix, we committed a patch to never disable
kdump service.
In general it probably is a good idea to restart kdump service on cpu
add/remove events.
Toshi Kani confirmed following.
- File for /sys/devices/system/cpu/cpuX/crash_notes will be created first
before ADD event goes out. That means we can not miss creating EFL notes
for newly created cpu.
- For REMOVE event files under /sys/devices/system/cpu/cpuX/ are removed
first and then REMOVE event goes out. That means we will remove the elf
note header for removed cpu.
- There are some race conditions like a cpu is removed but system crashes
before kdump service restarts. In that case vmcore.c has to be more robust
to be able to inspect elf notes and discard empty ones.
Also it is possible that after cpu remove, crash notes memory got reused
for something else and after crash vmcore.c might see some random data.
It does basic size checks and discards elf notes if checks don't pass.
Above rance conditions can happen even with OFFLINE event and there is
no good way to remove these altogether. So making vmcore.c more robust
is the right solution here.
Signed-off-by: Vivek Goyal <vgoyal(a)redhat.com>
---
98-kexec.rules | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: kexec-tools-fedora/98-kexec.rules
===================================================================
--- kexec-tools-fedora.orig/98-kexec.rules 2014-06-03 13:19:04.813120747 -0400
+++ kexec-tools-fedora/98-kexec.rules 2014-09-04 10:59:59.093304225 -0400
@@ -1,4 +1,4 @@
-SUBSYSTEM=="cpu", ACTION=="online", PROGRAM="/bin/systemctl try-restart kdump.service"
-SUBSYSTEM=="cpu", ACTION=="offline", PROGRAM="/bin/systemctl try-restart kdump.service"
+SUBSYSTEM=="cpu", ACTION=="add", PROGRAM="/bin/systemctl try-restart kdump.service"
+SUBSYSTEM=="cpu", ACTION=="remove", PROGRAM="/bin/systemctl try-restart kdump.service"
SUBSYSTEM=="memory", ACTION=="online", PROGRAM="/bin/systemctl try-restart kdump.service"
SUBSYSTEM=="memory", ACTION=="offline", PROGRAM="/bin/systemctl try-restart kdump.service"
9 years, 6 months
[PATCH 0/3] some patches to enable ppc64le
by WANG Chao
There's now three patches we need to pick up to enable ppc64le for kexec/kdump.
These are all upstream and ppc64 related code change. So I wouldn't expect
anything will break on x86.
WANG Chao (3):
kexec/ppc64: move to device tree version 17
kexec/ppc64: disabling exception handling when building the purgatory
ppc64/kdump: Fix ELF header endianess
...-disabling-exception-handling-when-buildi.patch | 37 +++++++++++++++++++
...exec-ppc64-move-to-device-tree-version-17.patch | 42 ++++++++++++++++++++++
....0.7-ppc64-kdump-Fix-ELF-header-endianess.patch | 36 +++++++++++++++++++
kexec-tools.spec | 6 ++++
4 files changed, 121 insertions(+)
create mode 100644 kexec-tools-2.0.7-kexec-ppc64-disabling-exception-handling-when-buildi.patch
create mode 100644 kexec-tools-2.0.7-kexec-ppc64-move-to-device-tree-version-17.patch
create mode 100644 kexec-tools-2.0.7-ppc64-kdump-Fix-ELF-header-endianess.patch
--
1.9.3
9 years, 6 months
[PATCH] dracut-module-setup: Make kdump shell honour and check for PEERDNS
by Minfei Huang
Resolves: rhbz805307
It is useless to configurate the /etc/dhclient.conf to valid in the
second kernel, when get network config by dhcp. Using the following
dhclient configuration, the kernel will not override the
configuration getting from the dhcp server in the file /etc/resolv.conf.
supersede domain-name "machine.test.group";
supersede domain-name-servers 10.125.97.171, 10.126.98.43, 10.125.97.176;
According to the condition, we should determine to modify the
/etc/dhclient.conf or not. If set the PEERDNS="no" in the configuration of
/etc/sysconfig/network-scripts/ifcfg-$net_dev, the dhclient configuration
will override the search domain and dns servers received from dhcp server.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 02a0557..008e560 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -66,6 +66,16 @@ kdump_setup_dns() {
[ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
}
+kdump_setup_dhclient() {
+ _dhclient_file="/etc/dhclient.conf"
+ [ ! -e $_dhclient_file ] && return
+
+ . /etc/sysconfig/network-scripts/ifcfg-$1
+ if [ "x""$PEERDNS" = "xno" ] || [ "x""$PEERDNS" = "xNO" ]; then
+ cat $_dhclient_file | grep ^supersede >> ${initdir}/$_dhclient_file
+ fi
+}
+
#$1: netdev name
#$2: srcaddr
#if it use static ip echo it, or echo null
@@ -252,6 +262,8 @@ kdump_setup_netdev() {
fi
kdump_setup_dns "$_netdev"
+
+ kdump_setup_dhclient "$_netdev"
}
#Function:kdump_install_net
--
1.8.3.1
9 years, 6 months
[Fedora PATCH V2 0/3] kdumpctl: Modifications required to support kdump on secureboot enabled machines
by Vivek Goyal
Hi,
This is V2 of patches. I changed patch 3 a bit. In user visible message,
changed string "secureboot" to "Secure Boot".
Following patch series contains changes to kdumpctl for supporting kdump
on secureboot enabled machines. Kernel patches are not available in
latest fedora kernel.
There is one kexec-tools patch required to be backported. That will follow
in a separate mail.
Thanks
Vivek
Vivek Goyal (3):
kdumpctl: Do not redirect error messages to /dev/null
kdumpctl: Use kexec file based mode to unload kdump kernel
kdumpctl: Use kexec file based syscall for secureboot enabled machines
kdumpctl | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
--
1.9.0
9 years, 6 months
[PATCH 0/3] kdumpctl: Modifications required to support kdump on secureboot enabled machines
by Vivek Goyal
Hi,
Following patch series contains changes to kdumpctl for supporting kdump
on secureboot enabled machines.
There is one kexec-tools patch required to be backported. That will follow
in a separate mail.
Thanks
Vivek
Vivek Goyal (3):
kdumpctl: Do not redirect error messages to /dev/null
kdumpctl: Use kexec file based mode to unload kdump kernel
kdumpctl: Use kexec file based syscall for secureboot enabled machines
kdumpctl | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
--
1.9.0
9 years, 6 months
[PATCH] kexec: Provide an option to use new kexec system call
by Vivek Goyal
Hi,
This is upstream kexec-tools patch which needs to be backported. I built
rpm and it applies without any modifications.
Thanks
Vivek
Hi,
This is v2 of the patch. Since v1, I moved syscall implemented check littler
earlier in the function as per the feedback.
Now a new kexec syscall (kexec_file_load()) has been merged in upstream
kernel. This system call takes file descriptors of kernel and initramfs
as input (as opposed to list of segments to be loaded). This new system
call allows for signature verification of the kernel being loaded.
One use of signature verification of kernel is secureboot systems where
we want to allow kexec into a kernel only if it is validly signed by
a key system trusts.
This patch provides and option --kexec-file-syscall (-s), to force use of
new system call for kexec. Default is to continue to use old syscall.
Currently only bzImage64 on x86_64 can be loaded using this system call.
As kernel adds support for more arches and for more image types, kexec-tools
can be modified accordingly.
Signed-off-by: Vivek Goyal <vgoyal(a)redhat.com>
Acked-by: Baoquan He <bhe(a)redhat.com>
Signed-off-by: Simon Horman <horms(a)verge.net.au>
---
kexec/arch/x86_64/kexec-bzImage64.c | 86 +++++++++++++++++++++++
kexec/kexec-syscall.h | 32 +++++++++
kexec/kexec.c | 132 +++++++++++++++++++++++++++++++++++-
kexec/kexec.h | 11 ++-
4 files changed, 257 insertions(+), 4 deletions(-)
diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
index 1983bcf..8edb3e4 100644
--- a/kexec/arch/x86_64/kexec-bzImage64.c
+++ b/kexec/arch/x86_64/kexec-bzImage64.c
@@ -235,6 +235,89 @@ static int do_bzImage64_load(struct kexec_info *info,
return 0;
}
+/* This assumes file is being loaded using file based kexec syscall */
+int bzImage64_load_file(int argc, char **argv, struct kexec_info *info)
+{
+ int ret = 0;
+ char *command_line = NULL, *tmp_cmdline = NULL;
+ const char *ramdisk = NULL, *append = NULL;
+ int entry_16bit = 0, entry_32bit = 0;
+ int opt;
+ int command_line_len;
+
+ /* See options.h -- add any more there, too. */
+ static const struct option options[] = {
+ KEXEC_ARCH_OPTIONS
+ { "command-line", 1, 0, OPT_APPEND },
+ { "append", 1, 0, OPT_APPEND },
+ { "reuse-cmdline", 0, 0, OPT_REUSE_CMDLINE },
+ { "initrd", 1, 0, OPT_RAMDISK },
+ { "ramdisk", 1, 0, OPT_RAMDISK },
+ { "real-mode", 0, 0, OPT_REAL_MODE },
+ { "entry-32bit", 0, 0, OPT_ENTRY_32BIT },
+ { 0, 0, 0, 0 },
+ };
+ static const char short_options[] = KEXEC_ARCH_OPT_STR "d";
+
+ while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
+ switch (opt) {
+ default:
+ /* Ignore core options */
+ if (opt < OPT_ARCH_MAX)
+ break;
+ case OPT_APPEND:
+ append = optarg;
+ break;
+ case OPT_REUSE_CMDLINE:
+ tmp_cmdline = get_command_line();
+ break;
+ case OPT_RAMDISK:
+ ramdisk = optarg;
+ break;
+ case OPT_REAL_MODE:
+ entry_16bit = 1;
+ break;
+ case OPT_ENTRY_32BIT:
+ entry_32bit = 1;
+ break;
+ }
+ }
+ command_line = concat_cmdline(tmp_cmdline, append);
+ if (tmp_cmdline)
+ free(tmp_cmdline);
+ command_line_len = 0;
+ if (command_line) {
+ command_line_len = strlen(command_line) + 1;
+ } else {
+ command_line = strdup("\0");
+ command_line_len = 1;
+ }
+
+ if (entry_16bit || entry_32bit) {
+ fprintf(stderr, "Kexec2 syscall does not support 16bit"
+ " or 32bit entry yet\n");
+ ret = -1;
+ goto out;
+ }
+
+ if (ramdisk) {
+ info->initrd_fd = open(ramdisk, O_RDONLY);
+ if (info->initrd_fd == -1) {
+ fprintf(stderr, "Could not open initrd file %s:%s\n",
+ ramdisk, strerror(errno));
+ ret = -1;
+ goto out;
+ }
+ }
+
+ info->command_line = command_line;
+ info->command_line_len = command_line_len;
+ return ret;
+out:
+ free(command_line);
+ return ret;
+}
+
int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
struct kexec_info *info)
{
@@ -247,6 +330,9 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
int opt;
int result;
+ if (info->file_mode)
+ return bzImage64_load_file(argc, argv, info);
+
/* See options.h -- add any more there, too. */
static const struct option options[] = {
KEXEC_ARCH_OPTIONS
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index 6238044..ce2e20b 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -53,6 +53,19 @@
#endif
#endif /*ifndef __NR_kexec_load*/
+#ifndef __NR_kexec_file_load
+
+#ifdef __x86_64__
+#define __NR_kexec_file_load 320
+#endif
+
+#ifndef __NR_kexec_file_load
+/* system call not available for the arch */
+#define __NR_kexec_file_load 0xffffffff /* system call not available */
+#endif
+
+#endif /*ifndef __NR_kexec_file_load*/
+
struct kexec_segment;
static inline long kexec_load(void *entry, unsigned long nr_segments,
@@ -61,10 +74,29 @@ static inline long kexec_load(void *entry, unsigned long nr_segments,
return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags);
}
+static inline int is_kexec_file_load_implemented(void) {
+ if (__NR_kexec_file_load != 0xffffffff)
+ return 1;
+ return 0;
+}
+
+static inline long kexec_file_load(int kernel_fd, int initrd_fd,
+ unsigned long cmdline_len, const char *cmdline_ptr,
+ unsigned long flags)
+{
+ return (long) syscall(__NR_kexec_file_load, kernel_fd, initrd_fd,
+ cmdline_len, cmdline_ptr, flags);
+}
+
#define KEXEC_ON_CRASH 0x00000001
#define KEXEC_PRESERVE_CONTEXT 0x00000002
#define KEXEC_ARCH_MASK 0xffff0000
+/* Flags for kexec file based system call */
+#define KEXEC_FILE_UNLOAD 0x00000001
+#define KEXEC_FILE_ON_CRASH 0x00000002
+#define KEXEC_FILE_NO_INITRAMFS 0x00000004
+
/* These values match the ELF architecture values.
* Unless there is a good reason that should continue to be the case.
*/
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 133e622..7e7b604 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -51,6 +51,8 @@
unsigned long long mem_min = 0;
unsigned long long mem_max = ULONG_MAX;
static unsigned long kexec_flags = 0;
+/* Flags for kexec file (fd) based syscall */
+static unsigned long kexec_file_flags = 0;
int kexec_debug = 0;
void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr)
@@ -787,6 +789,19 @@ static int my_load(const char *type, int fileind, int argc, char **argv,
return result;
}
+static int kexec_file_unload(unsigned long kexec_file_flags)
+{
+ int ret = 0;
+
+ ret = kexec_file_load(-1, -1, 0, NULL, kexec_file_flags);
+ if (ret != 0) {
+ /* The unload failed, print some debugging information */
+ fprintf(stderr, "kexec_file_load(unload) failed\n: %s\n",
+ strerror(errno));
+ }
+ return ret;
+}
+
static int k_unload (unsigned long kexec_flags)
{
int result;
@@ -925,6 +940,7 @@ void usage(void)
" (0 means it's not jump back or\n"
" preserve context)\n"
" to original kernel.\n"
+ " -s, --kexec-file-syscall Use file based syscall for kexec operation\n"
" -d, --debug Enable debugging to help spot a failure.\n"
"\n"
"Supported kernel file types and options: \n");
@@ -1072,6 +1088,82 @@ char *concat_cmdline(const char *base, const char *append)
return cmdline;
}
+/* New file based kexec system call related code */
+static int do_kexec_file_load(int fileind, int argc, char **argv,
+ unsigned long flags) {
+
+ char *kernel;
+ int kernel_fd, i;
+ struct kexec_info info;
+ int ret = 0;
+ char *kernel_buf;
+ off_t kernel_size;
+
+ memset(&info, 0, sizeof(info));
+ info.segment = NULL;
+ info.nr_segments = 0;
+ info.entry = NULL;
+ info.backup_start = 0;
+ info.kexec_flags = flags;
+
+ info.file_mode = 1;
+ info.initrd_fd = -1;
+
+ if (!is_kexec_file_load_implemented()) {
+ fprintf(stderr, "syscall kexec_file_load not available.\n");
+ return -1;
+ }
+
+ if (argc - fileind <= 0) {
+ fprintf(stderr, "No kernel specified\n");
+ usage();
+ return -1;
+ }
+
+ kernel = argv[fileind];
+
+ kernel_fd = open(kernel, O_RDONLY);
+ if (kernel_fd == -1) {
+ fprintf(stderr, "Failed to open file %s:%s\n", kernel,
+ strerror(errno));
+ return -1;
+ }
+
+ /* slurp in the input kernel */
+ kernel_buf = slurp_decompress_file(kernel, &kernel_size);
+
+ for (i = 0; i < file_types; i++) {
+ if (file_type[i].probe(kernel_buf, kernel_size) >= 0)
+ break;
+ }
+
+ if (i == file_types) {
+ fprintf(stderr, "Cannot determine the file type " "of %s\n",
+ kernel);
+ return -1;
+ }
+
+ ret = file_type[i].load(argc, argv, kernel_buf, kernel_size, &info);
+ if (ret < 0) {
+ fprintf(stderr, "Cannot load %s\n", kernel);
+ return ret;
+ }
+
+ /*
+ * If there is no initramfs, set KEXEC_FILE_NO_INITRAMFS flag so that
+ * kernel does not return error with negative initrd_fd.
+ */
+ if (info.initrd_fd == -1)
+ info.kexec_flags |= KEXEC_FILE_NO_INITRAMFS;
+
+ ret = kexec_file_load(kernel_fd, info.initrd_fd, info.command_line_len,
+ info.command_line, info.kexec_flags);
+ if (ret != 0)
+ fprintf(stderr, "kexec_file_load failed: %s\n",
+ strerror(errno));
+ return ret;
+}
+
int main(int argc, char *argv[])
{
@@ -1083,6 +1175,7 @@ int main(int argc, char *argv[])
int do_ifdown = 0;
int do_unload = 0;
int do_reuse_initrd = 0;
+ int do_kexec_file_syscall = 0;
void *entry = 0;
char *type = 0;
char *endptr;
@@ -1095,6 +1188,23 @@ int main(int argc, char *argv[])
};
static const char short_options[] = KEXEC_ALL_OPT_STR;
+ /*
+ * First check if --use-kexec-file-syscall is set. That changes lot of
+ * things
+ */
+ while ((opt = getopt_long(argc, argv, short_options,
+ options, 0)) != -1) {
+ switch(opt) {
+ case OPT_KEXEC_FILE_SYSCALL:
+ do_kexec_file_syscall = 1;
+ break;
+ }
+ }
+
+ /* Reset getopt for the next pass. */
+ opterr = 1;
+ optind = 1;
+
while ((opt = getopt_long(argc, argv, short_options,
options, 0)) != -1) {
switch(opt) {
@@ -1127,6 +1237,8 @@ int main(int argc, char *argv[])
do_shutdown = 0;
do_sync = 0;
do_unload = 1;
+ if (do_kexec_file_syscall)
+ kexec_file_flags |= KEXEC_FILE_UNLOAD;
break;
case OPT_EXEC:
do_load = 0;
@@ -1169,7 +1281,10 @@ int main(int argc, char *argv[])
do_exec = 0;
do_shutdown = 0;
do_sync = 0;
- kexec_flags = KEXEC_ON_CRASH;
+ if (do_kexec_file_syscall)
+ kexec_file_flags |= KEXEC_FILE_ON_CRASH;
+ else
+ kexec_flags = KEXEC_ON_CRASH;
break;
case OPT_MEM_MIN:
mem_min = strtoul(optarg, &endptr, 0);
@@ -1194,6 +1309,9 @@ int main(int argc, char *argv[])
case OPT_REUSE_INITRD:
do_reuse_initrd = 1;
break;
+ case OPT_KEXEC_FILE_SYSCALL:
+ /* We already parsed it. Nothing to do. */
+ break;
default:
break;
}
@@ -1238,10 +1356,18 @@ int main(int argc, char *argv[])
}
if (do_unload) {
- result = k_unload(kexec_flags);
+ if (do_kexec_file_syscall)
+ result = kexec_file_unload(kexec_file_flags);
+ else
+ result = k_unload(kexec_flags);
}
if (do_load && (result == 0)) {
- result = my_load(type, fileind, argc, argv, kexec_flags, entry);
+ if (do_kexec_file_syscall)
+ result = do_kexec_file_load(fileind, argc, argv,
+ kexec_file_flags);
+ else
+ result = my_load(type, fileind, argc, argv,
+ kexec_flags, entry);
}
/* Don't shutdown unless there is something to reboot to! */
if ((result == 0) && (do_shutdown || do_exec) && !kexec_loaded()) {
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 2fad7dc..4be2b2f 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -156,6 +156,13 @@ struct kexec_info {
unsigned long kexec_flags;
unsigned long backup_src_start;
unsigned long backup_src_size;
+ /* Set to 1 if we are using kexec file syscall */
+ unsigned long file_mode :1;
+
+ /* Filled by kernel image processing code */
+ int initrd_fd;
+ char *command_line;
+ int command_line_len;
};
struct arch_map_entry {
@@ -207,6 +214,7 @@ extern int file_types;
#define OPT_UNLOAD 'u'
#define OPT_TYPE 't'
#define OPT_PANIC 'p'
+#define OPT_KEXEC_FILE_SYSCALL 's'
#define OPT_MEM_MIN 256
#define OPT_MEM_MAX 257
#define OPT_REUSE_INITRD 258
@@ -230,9 +238,10 @@ extern int file_types;
{ "mem-min", 1, 0, OPT_MEM_MIN }, \
{ "mem-max", 1, 0, OPT_MEM_MAX }, \
{ "reuseinitrd", 0, 0, OPT_REUSE_INITRD }, \
+ { "kexec-file-syscall", 0, 0, OPT_KEXEC_FILE_SYSCALL }, \
{ "debug", 0, 0, OPT_DEBUG }, \
-#define KEXEC_OPT_STR "h?vdfxluet:p"
+#define KEXEC_OPT_STR "h?vdfxluet:ps"
extern void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr);
extern void die(const char *fmt, ...)
--
1.9.0
9 years, 6 months
[PATCH] kdump-anaconda-addon: makefile cleanup
by Dave Young
There's several wrong dependency issues in kdump addon makefiles, fix
them so that we can correctly update pot files before generating po files.
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
kdump-anaconda-addon-003-Makefile-cleanup.patch | 55 +++++++++++++++++++++++++
kexec-tools.spec | 7 ++++
2 files changed, 62 insertions(+)
create mode 100644 kdump-anaconda-addon-003-Makefile-cleanup.patch
diff --git a/kdump-anaconda-addon-003-Makefile-cleanup.patch b/kdump-anaconda-addon-003-Makefile-cleanup.patch
new file mode 100644
index 0000000..99c0054
--- /dev/null
+++ b/kdump-anaconda-addon-003-Makefile-cleanup.patch
@@ -0,0 +1,55 @@
+From f507b2d38a5de8eb75cfd288601943448dcd33e6 Mon Sep 17 00:00:00 2001
+From: Dave Young <dyoung(a)redhat.com>
+Date: Fri, 29 Aug 2014 17:38:13 +0800
+Subject: [PATCH] Makefile: cleanup
+
+po/Makefile:
+1. make all: not necessary to update po file, only update po files when you
+explictly "make update-po"
+2. makefile dependency fixes
+Makefile:
+make dist: not necessary to make update-po
+---
+ Makefile | 1 -
+ po/Makefile | 6 ++----
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/kdump-anaconda-addon/Makefile b/kdump-anaconda-addon/Makefile
+index 8d0c5c1..f7c2fa8 100644
+--- a/kdump-anaconda-addon/Makefile
++++ b/kdump-anaconda-addon/Makefile
+@@ -36,7 +36,6 @@ uninstall:
+ rm -rfv $(DESTDIR)$(ADDONDIR)
+
+ dist: version.sh
+- make -C po update-po
+ rm -rf $(NAME)
+ mkdir -p $(NAME)
+ @if test -d ".git"; \
+diff --git a/kdump-anaconda-addon/po/Makefile b/kdump-anaconda-addon/po/Makefile
+index b82cca4..5aa9042 100644
+--- a/kdump-anaconda-addon/po/Makefile
++++ b/kdump-anaconda-addon/po/Makefile
+@@ -26,7 +26,7 @@ MOFILES = $(patsubst %.po,%.mo,$(POFILES))
+ PYSRC = $(wildcard ../com_redhat_kdump/*.py ../com_redhat_kdump/*/*.py ../com_redhat_kdump/*/*/*.py)
+ GLADEFILES = $(wildcard ../com_redhat_kdump/gui/spokes/*.glade)
+
+-all:: update-po $(MOFILES)
++all: $(MOFILES)
+
+ potfile: $(PYSRC) glade-po
+ $(XGETTEXT) -L Python --keyword=_ --keyword=N_ $(PYSRC) tmp/*.h
+@@ -43,9 +43,7 @@ glade-po: $(GLADEFILES)
+ intltool-extract --type=gettext/glade -l $$f ;\
+ done
+
+-update-po: Makefile refresh-po potfile
+-
+-refresh-po: Makefile
++update-po: potfile
+ for cat in $(POFILES); do \
+ if $(MSGMERGE) $$cat $(POTFILE) --out=$$cat ; then \
+ echo "$(MSGMERGE) of $$cat succeeded" ; \
+--
+1.8.3.1
+
diff --git a/kexec-tools.spec b/kexec-tools.spec
index af0b898..b1e731a 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -85,6 +85,12 @@ Patch605: kexec-tools-2.0.4-makedumpfile-Remove-the-1st-bitmap-buffer-from-the-E
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
+#
+# Patch 701 through 800 are meant for kdump anaconda addon
+#
+
+Patch701: kdump-anaconda-addon-003-Makefile-cleanup.patch
+
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
kernel to boot using the kernel's kexec feature either on a
@@ -126,6 +132,7 @@ tar -z -x -v -f %{SOURCE23}
%patch605 -p1
%patch606 -p1
%patch607 -p1
+%patch701 -p1
%ifarch ppc
%define archdef ARCH=ppc
--
1.8.3.1
9 years, 6 months