[Makedumpfile Patch v3 7/7] mem-usage: allow to work only with -f for kernel version < 4.11

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>PT_LOAD of kcore does not have valid p_paddr values for kernel version
>less that v4.11. Therefore, older kernel will no long work for mem-usage
>with current makedumpfile code. They can only work when they are patched
>with fix to "update physical address for kcore ram and text".
>
>This patch fixes the makedumpfile so that it does not allow to work
>older kernel for --mem-usage until someone is sure that kernel is
>rightly patched and so uses -f in command line. It also updates man page
>and usage info accordingly.
>
>Signed-off-by: Pratyush Anand <panand at redhat.com>
>---
> makedumpfile.8 | 9 ++++++++-
> makedumpfile.c | 6 ++++++
> print_info.c   | 3 ++-
> 3 files changed, 16 insertions(+), 2 deletions(-)
>
>diff --git a/makedumpfile.8 b/makedumpfile.8
>index 9069fb18cdb6..993236486e77 100644
>--- a/makedumpfile.8
>+++ b/makedumpfile.8
>@@ -235,13 +235,20 @@ the ELF format does not support compressed data.
>
> .TP
> \fB\-f\fR
>-Force existing DUMPFILE to be overwritten.
>+Force existing DUMPFILE to be overwritten and mem-usage to work with older
>+kernel as well.
> .br
> .B Example:
> .br
> # makedumpfile \-f \-d 31 \-x vmlinux /proc/vmcore dumpfile
> .br
> This command overwrites \fIDUMPFILE\fR even if it already exists.
>+.br
>+# makedumpfile \-f \-\-mem\-usage /proc/kcore
>+.br
>+Kernel version lesser than v4.11 will not work with \-\-mem\-usage
>+functionality until it has been patched with upstream commit 464920104bf7.
>+Therefore if you have patched your older kernel then use \-f.
>
> .TP
> \fB\-x\fR \fIVMLINUX\fR
>diff --git a/makedumpfile.c b/makedumpfile.c
>index 3b8e9810468d..e3be1ab0a9ec 100644
>--- a/makedumpfile.c
>+++ b/makedumpfile.c
>@@ -11269,6 +11269,12 @@ main(int argc, char *argv[])
> 			MSG("Try `makedumpfile --help' for more information.\n");
> 			goto out;
> 		}
>+		if (info->kernel_version < KERNEL_VERSION(4, 11, 0) &&
>+				!info->flag_force) {
>+			MSG("mem-usage not supported for this kernel.\n");
>+			MSG("You can try with -f if your kernel's kcore has valid p_paddr\n");
>+			goto out;
>+		}

You forgot to set COMPLETED to retcd before goto.
The behavior will be different from the v2 patch.


Thanks,
Atsushi Kumagai

>
> 		if (!show_mem_usage())
> 			goto out;
>diff --git a/print_info.c b/print_info.c
>index 392d863a4227..72ed8fa0c059 100644
>--- a/print_info.c
>+++ b/print_info.c
>@@ -309,7 +309,8 @@ print_usage(void)
> 	MSG("      Print debugging message.\n");
> 	MSG("\n");
> 	MSG("  [-f]:\n");
>-	MSG("      Overwrite DUMPFILE even if it already exists.\n");
>+	MSG("      Overwrite DUMPFILE even if it already exists\n");
>+	MSG("      Force mem-usage to work with older kernel as well.\n");
> 	MSG("\n");
> 	MSG("  [-h, --help]:\n");
> 	MSG("      Show help message and LZO/snappy support status (enabled/disabled).\n");
>--
>2.9.3
>




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux