Skip to contentSkip to conversation

vmcore-dmesg: Collect full dmesg regardless of logged_chars

PATCH Superseded Dangyi Liu 2 participants 3 messages Oct 28, 2015

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Dangyi Liu

author
#0 lore raw

PATCH v2 1/1 vmcore-dmesg: Collect full dmesg regardless of logged_chars

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.

---
Changes:
v1->v2: Update comment and commit message

 vmcore-dmesg/vmcore-dmesg.c | 6 ++++++
 1 file changed, 6 insertions(+)
vmcore-dmesg/vmcore-dmesg.c +6 -0
index f47ee11..134a4ef 100644
@@ -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);
 }
 
Signature · 7 lines
2.4.3


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw

Hi, Dangyi

Quoted 20 lines · Dangyi Liu

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.

---
Changes:
v1->v2: Update comment and commit message

 vmcore-dmesg/vmcore-dmesg.c | 6 ++++++
 1 file changed, 6 insertions(+)
vmcore-dmesg/vmcore-dmesg.c +0 -0
index f47ee11..134a4ef 100644

vmcore-dmesg/vmcore-dmesg.c static void dump_dmesg_legacy(int fd) · line 544

Quoted 5 lines
vmcore-dmesg/vmcore-dmesg.c +2 -0
@@ -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

Sorry I did not consider about the line length when replying your V1. Although I'm not sure if kexec-tools strictly use 80 lines coding style but IMO I still think it is better to do it.

vmcore-dmesg/vmcore-dmesg.c static void dump_dmesg_legacy(int fd) · line 551

Quoted 7 lines
vmcore-dmesg/vmcore-dmesg.c +4 -0
+	 * 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);
 }
 

Thanks
Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
Quoted 4 lines

vmcore-dmesg/vmcore-dmesg.c static void dump_dmesg_legacy(int fd) · line 544

Quoted 1 line
vmcore-dmesg/vmcore-dmesg.c +1 -0
+	 * To collect full dmesg including the part before `dmesg -c` is useful for

Sorry I did not consider about the line length when replying your V1. Although I'm not sure if kexec-tools strictly use 80 lines coding style

s/80 lines/80 columns

BTW, usually you should cc the person who commented about your patch. There's a kernel doc in kernel tree Documentation/SubmittingPatches Though it is only for kernel but some of the rules is generic.

Thanks
Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec