Re: [Crash-utility] [PATCH] Fix for the "log" command

2020-02-13 Thread Dave Anderson



- Original Message -
> On Thu, Feb 13, 2020 at 08:16:37AM -0500, Dave Anderson wrote:
> > 
> > What does this patch have to do with "log -a"?
> > 
> Sorry, I just use "log" command to dump the kernel message buffer.
> The option fails with the following error message "invalid log_buf
> entry encountered". The issue has only happened on one arm64's dump
> once up to now.

OK thanks -- queued for crash-7.2.9:

  
https://github.com/crash-utility/crash/commit/dcd6e6bbdf0c32ca61f02d52a5250c9eeb499430

Dave

   
> The dump doesn't print all log filled with log_buf due to the failure.
> The symbol data values related with printk as followed:
> crash_test> log_next_idx
> log_next_idx = $1 = 1491656
> crash_test> log_first_idx
> log_first_idx = $2 = 1507956
> crash_test> log_buf_len
> log_buf_len = $3 = 2097152
> 
> We can see the log idx has exceed the value of log_buf_len.
> crash_test> log > dmesg.txt
> 
> log: invalid log_buf entry encountered. idx=2115950
> 
> The original code just break loop simply with a error message.
> We need to take case of the issue.
> 
> Thanks!
> Qiwu
> 
> 
> 

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility



Re: [Crash-utility] [PATCH] Fix for the "log -a" option

2020-02-13 Thread chenqiwu
On Thu, Feb 13, 2020 at 08:16:37AM -0500, Dave Anderson wrote:
> 
> What does this patch have to do with "log -a"?
> 
Sorry, I just use "log" command to dump the kernel message buffer.
The option fails with the following error message "invalid log_buf
entry encountered". The issue has only happened on one arm64's dump
once up to now.
The dump doesn't print all log filled with log_buf due to the failure. 
The symbol data values related with printk as followed:
crash_test> log_next_idx
log_next_idx = $1 = 1491656
crash_test> log_first_idx
log_first_idx = $2 = 1507956
crash_test> log_buf_len
log_buf_len = $3 = 2097152

We can see the log idx has exceed the value of log_buf_len.
crash_test> log > dmesg.txt

log: invalid log_buf entry encountered. idx=2115950

The original code just break loop simply with a error message. 
We need to take case of the issue.

Thanks!
Qiwu



--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility



Re: [Crash-utility] [PATCH] Fix for the "log -a" option

2020-02-13 Thread Dave Anderson


What does this patch have to do with "log -a"?

Dave

- Original Message -
> From: chenqiwu 
> 
> Fix for the "log -a" option. The printk logbuf is a ring buffer,
> if log_first_idx is larger than log_next_idx, there are two buffer
> zones must be handled for logdump:
> 1) [log_first_idx, log_buf_len]
> 2) [0, log_next_idx]
> 
> However, the original code ignores the logdump for the second buffer
> zone if log_first_idx is larger than log_next_idx. Without this patch,
> the option fails with the following error message "duplicate log_buf
> message pointer".
> 
> Signed-off-by: chenqiwu 
> ---
>  kernel.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel.c b/kernel.c
> index 68ee282..7604fac 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -5278,8 +5278,12 @@ dump_variable_length_record_log(int msg_flags)
>   idx = log_next(idx, logbuf);
>  
>   if (idx >= log_buf_len) {
> - error(INFO, "\ninvalid log_buf entry encountered\n");
> - break;
> + if (log_first_idx > log_next_idx)
> + idx = 0;
> + else {
> + error(INFO, "\ninvalid log_buf entry 
> encountered\n");
> + break;
> + }
>   }
>  
>   if (CRASHDEBUG(1) && (idx == log_next_idx))
> --
> 1.9.1
> 
> 

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility