[PATCH v3] vmcore-dmesg: Collect full dmesg regardless of logged_chars

Dave Young dyoung at redhat.com
Sun Nov 8 18:26:12 PST 2015


On 10/28/15 at 05:15pm, Dangyi Liu wrote:
> logged_chars would be set to 0 by `dmesg -c`, but full dmesg is useful
> for debugging. So instead of using logged_chars directly, we calculate
> it by ourselves.
> 
> Now logged_chars is set to the minimum of log_end and log_buf_len, as
> the same logic as crash utility is using.
> 
> Signed-off-by: Dangyi Liu <dliu at redhat.com>
> Cc: Dave Young <dyoung at redhat.com>
> ---
> Changes:
>   v1->v2: Update comment and commit message.
>   v2->v3: Adjust maximum line length
> 
>  vmcore-dmesg/vmcore-dmesg.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
> index f47ee11..0364636 100644
> --- a/vmcore-dmesg/vmcore-dmesg.c
> +++ b/vmcore-dmesg/vmcore-dmesg.c
> @@ -540,6 +540,12 @@ static void dump_dmesg_legacy(int fd)
>  		exit(53);
>  	}
>  
> +	/*
> +	 * To collect full dmesg including the part before `dmesg -c` is useful
> +	 * for later debugging. Use same logic as what crash utility is using.
> +	 */
> +	logged_chars = log_end < log_buf_len ? log_end : log_buf_len;
> +
>  	write_to_stdout(buf + (log_buf_len -  logged_chars), logged_chars);
>  }
>  
> -- 
> 2.4.3
> 
> 
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

Acked-by: Dave Young <dyoung at redhat.com>

Thanks
Dave



More information about the kexec mailing list