Skip to contentSkip to conversation

vmcore-dmesg: Collect full dmesg regardless of logged_chars

PATCH In review Dangyi Liu 3 participants 7 messages Oct 28, 2015 – Dec 9, 2015

Subsystems (2)
lore
Share & tools
lore

Dangyi Liu

author
#0 lore raw

PATCH v3 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.
v2->v3: Adjust maximum line length

 vmcore-dmesg/vmcore-dmesg.c | 6 ++++++
 1 file changed, 6 insertions(+)
vmcore-dmesg/vmcore-dmesg.c +6 -0
index f47ee11..0364636 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
Acked-by on v3 1/1
#1 lore raw
Quoted 42 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.
v2->v3: Adjust maximum line length

 vmcore-dmesg/vmcore-dmesg.c | 6 ++++++
 1 file changed, 6 insertions(+)
vmcore-dmesg/vmcore-dmesg.c +6 -0
index f47ee11..0364636 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

Thanks
Dave

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

author
#2 lore raw
In reply to Dangyi Liu

Simon,

Could you help to review this patch?

Thanks,
Dangyi Liu

Quoted 35 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.
  v2->v3: Adjust maximum line length

 vmcore-dmesg/vmcore-dmesg.c | 6 ++++++

 1 file changed, 6 insertions(+)
vmcore-dmesg/vmcore- renamed from vmcore-dmesg/vmcore-dmesg.c +0 -0

dmesg.c
index f47ee11..0364636 100644

vmcore-dmesg/vmcore-dmesg.c +0 -0
@@ -540,6 +540,12 @@ static void dump_dmesg_legacy(int fd)
  		exit(53);
  	}

vmcore-dmesg/vmcore-dmesg.c +3 -1
+	/*
+	 * To collect full dmesg including the part before `dmesg
-c` is useful
+	 * for later debugging. Use same logic as what crash utility

is using.

vmcore-dmesg/vmcore-dmesg.c +2 -0
+	 */
+	logged_chars = log_end < log_buf_len ? log_end :
Quoted 6 lines

log_buf_len;
+
  write_to_stdout(buf + (log_buf_len -  logged_chars), logged_chars);
 }

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

#3 lore raw
Quoted 41 lines · Dangyi Liu

Simon,

Could you help to review this patch?

Thanks,
Dangyi Liu

Quoted 33 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.
  v2->v3: Adjust maximum line length

 vmcore-dmesg/vmcore-dmesg.c | 6 ++++++

 1 file changed, 6 insertions(+)
vmcore-dmesg/vmcore- renamed from vmcore-dmesg/vmcore-dmesg.c +0 -0

dmesg.c
index f47ee11..0364636 100644

vmcore-dmesg/vmcore-dmesg.c +0 -0
@@ -540,6 +540,12 @@ static void dump_dmesg_legacy(int fd)
  		exit(53);
  	}

vmcore-dmesg/vmcore-dmesg.c +3 -1
+	/*
+	 * To collect full dmesg including the part before `dmesg
-c` is useful
+	 * for later debugging. Use same logic as what crash utility

is using.

Quoted 9 lines
Quoted 8 lines
vmcore-dmesg/vmcore-dmesg.c +2 -0
+	 */
+	logged_chars = log_end < log_buf_len ? log_end :

log_buf_len;
+
  write_to_stdout(buf + (log_buf_len -  logged_chars), logged_chars);
 }

Simon,

What's your opinion about this patch? It is a rh internal report. Current code make sense, adding the patch will be slight better though for kdump case. But if you do not like it we can ignore it and close the bug.

Thanks
Dave

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

#4 lore raw
Quoted 52 lines · Dave Young
Quoted 41 lines · Dangyi Liu

Simon,

Could you help to review this patch?

Thanks,
Dangyi Liu

Quoted 33 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.
  v2->v3: Adjust maximum line length

 vmcore-dmesg/vmcore-dmesg.c | 6 ++++++

 1 file changed, 6 insertions(+)
vmcore-dmesg/vmcore- renamed from vmcore-dmesg/vmcore-dmesg.c +0 -0

dmesg.c
index f47ee11..0364636 100644

vmcore-dmesg/vmcore-dmesg.c +0 -0
@@ -540,6 +540,12 @@ static void dump_dmesg_legacy(int fd)
  		exit(53);
  	}

vmcore-dmesg/vmcore-dmesg.c +3 -1
+	/*
+	 * To collect full dmesg including the part before `dmesg
-c` is useful
+	 * for later debugging. Use same logic as what crash utility

is using.

Quoted 9 lines
Quoted 8 lines
vmcore-dmesg/vmcore-dmesg.c +2 -0
+	 */
+	logged_chars = log_end < log_buf_len ? log_end :

log_buf_len;
+
  write_to_stdout(buf + (log_buf_len -  logged_chars), logged_chars);
 }

Quoted 6 lines

Simon,

What's your opinion about this patch? It is a rh internal report. Current code make sense, adding the patch will be slight better though for kdump case. But if you do not like it we can ignore it and close the bug.

This seems reasonable to me, but perhaps the logic should only kick in if logged_chars is 0?

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

#5 lore raw
Quoted 55 lines · Simon Horman
Quoted 54 lines · Dave Young
Quoted 41 lines · Dangyi Liu

Simon,

Could you help to review this patch?

Thanks,
Dangyi Liu

Quoted 33 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.
  v2->v3: Adjust maximum line length

 vmcore-dmesg/vmcore-dmesg.c | 6 ++++++

 1 file changed, 6 insertions(+)
vmcore-dmesg/vmcore- renamed from vmcore-dmesg/vmcore-dmesg.c +0 -0

dmesg.c
index f47ee11..0364636 100644

vmcore-dmesg/vmcore-dmesg.c +0 -0
@@ -540,6 +540,12 @@ static void dump_dmesg_legacy(int fd)
  		exit(53);
  	}

vmcore-dmesg/vmcore-dmesg.c +3 -1
+	/*
+	 * To collect full dmesg including the part before `dmesg
-c` is useful
+	 * for later debugging. Use same logic as what crash utility

is using.

Quoted 9 lines
Quoted 8 lines
vmcore-dmesg/vmcore-dmesg.c +2 -0
+	 */
+	logged_chars = log_end < log_buf_len ? log_end :

log_buf_len;
+
  write_to_stdout(buf + (log_buf_len -  logged_chars), logged_chars);
 }

Simon,

Quoted 8 lines
Quoted 4 lines

What's your opinion about this patch? It is a rh internal report. Current code make sense, adding the patch will be slight better though for kdump case. But if you do not like it we can ignore it and close the bug.

This seems reasonable to me, but perhaps the logic should only kick in if logged_chars is 0?

It will contain at least panic messages to it is unlikely logged_chars = 0?

Thanks
Dave

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

#6 lore raw
Quoted 61 lines · Dave Young
Quoted 60 lines · Simon Horman
Quoted 58 lines · Dave Young
Quoted 41 lines · Dangyi Liu

Simon,

Could you help to review this patch?

Thanks,
Dangyi Liu

Quoted 33 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.
  v2->v3: Adjust maximum line length

 vmcore-dmesg/vmcore-dmesg.c | 6 ++++++

 1 file changed, 6 insertions(+)
vmcore-dmesg/vmcore- renamed from vmcore-dmesg/vmcore-dmesg.c +0 -0

dmesg.c
index f47ee11..0364636 100644

vmcore-dmesg/vmcore-dmesg.c +0 -0
@@ -540,6 +540,12 @@ static void dump_dmesg_legacy(int fd)
  		exit(53);
  	}

vmcore-dmesg/vmcore-dmesg.c +3 -1
+	/*
+	 * To collect full dmesg including the part before `dmesg
-c` is useful
+	 * for later debugging. Use same logic as what crash utility

is using.

Quoted 9 lines
Quoted 8 lines
vmcore-dmesg/vmcore-dmesg.c +2 -0
+	 */
+	logged_chars = log_end < log_buf_len ? log_end :

log_buf_len;
+
  write_to_stdout(buf + (log_buf_len -  logged_chars), logged_chars);
 }

Simon,

What's your opinion about this patch? It is a rh internal report. Current code make sense, adding the patch will be slight better though for kdump case. But if you do not like it we can ignore it and close the bug.

Quoted 5 lines
Quoted 3 lines

This seems reasonable to me, but perhaps the logic should only kick in if logged_chars is 0?

It will contain at least panic messages to it is unlikely logged_chars = 0?

Understood. I have applied the patch.

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