From: Jean-Marc Eurin <jmeurin@google.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Jean-Marc Eurin <jmeurin@google.com>
Subject: [PATCH v4 3/3] mtd: mtdoops: Add a timestamp to the mtdoops header.
Date: Mon, 25 Apr 2022 09:09:27 -0700 [thread overview]
Message-ID: <20220425160927.3823016-1-jmeurin@google.com> (raw)
In-Reply-To: <20220415001321.252848-1-jmeurin@google.com>
On some systems, the oops only has relative time from boot.
Signed-off-by: Jean-Marc Eurin <jmeurin@google.com>
---
drivers/mtd/mtdoops.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 186eeb01bee1..3d4a2ffb5b01 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -16,6 +16,7 @@
#include <linux/wait.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
+#include <linux/timekeeping.h>
#include <linux/mtd/mtd.h>
#include <linux/kmsg_dump.h>
@@ -37,11 +38,13 @@ module_param(dump_oops, int, 0600);
MODULE_PARM_DESC(dump_oops,
"set to 1 to dump oopses, 0 to only dump panics (default 1)");
-#define MTDOOPS_KERNMSG_MAGIC 0x5d005d00
+#define MTDOOPS_KERNMSG_MAGIC_v1 0x5d005d00 /* Original */
+#define MTDOOPS_KERNMSG_MAGIC_v2 0x5d005e00 /* Adds the timestamp */
struct mtdoops_hdr {
u32 seq;
u32 magic;
+ ktime_t timestamp;
} __packed;
static struct mtdoops_context {
@@ -191,7 +194,8 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic)
/* Add mtdoops header to the buffer */
hdr = (struct mtdoops_hdr *)cxt->oops_buf;
hdr->seq = cxt->nextcount;
- hdr->magic = MTDOOPS_KERNMSG_MAGIC;
+ hdr->magic = MTDOOPS_KERNMSG_MAGIC_v2;
+ hdr->timestamp = ktime_get_real();
if (panic) {
ret = mtd_panic_write(mtd, cxt->nextpage * record_size,
@@ -247,7 +251,9 @@ static void find_next_position(struct mtdoops_context *cxt)
if (hdr.seq == 0xffffffff && hdr.magic == 0xffffffff)
mark_page_unused(cxt, page);
- if (hdr.seq == 0xffffffff || hdr.magic != MTDOOPS_KERNMSG_MAGIC)
+ if (hdr.seq == 0xffffffff ||
+ (hdr.magic != MTDOOPS_KERNMSG_MAGIC_v1 &&
+ hdr.magic != MTDOOPS_KERNMSG_MAGIC_v2))
continue;
if (maxcount == 0xffffffff) {
maxcount = hdr.seq;
--
2.36.0.rc2.479.g8af0fa9b8e-goog
next prev parent reply other threads:[~2022-04-25 16:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 22:01 [PATCH] Fix the size of the header read buffer Jean-Marc Eurin
2022-01-31 10:00 ` Miquel Raynal
2022-02-04 1:53 ` [PATCH v2] mtdoops: " Jean-Marc Eurin
2022-02-07 15:34 ` Miquel Raynal
2022-03-30 18:28 ` [PATCH] " Jean-Marc Eurin
2022-03-30 18:28 ` [PATCH v2 0/2] mtd: mtdoops: Structure the header of the dumped oops Jean-Marc Eurin
2022-03-30 18:28 ` [PATCH v2 1/2] mtd: mtdoops: Fix the size of the header read buffer Jean-Marc Eurin
2022-03-30 18:28 ` [PATCH v2 2/2] mtd: mtdoops: Create a header structure for the saved mtdoops Jean-Marc Eurin
2022-03-30 22:23 ` kernel test robot
2022-03-31 0:14 ` kernel test robot
2022-03-30 19:59 ` [PATCH] Fix the size of the header read buffer Jean-Marc Eurin
2022-04-15 0:13 ` [PATCH v3 0/3] mtd: mtdoops: Add timestamp to the dumped oops header Jean-Marc Eurin
2022-04-15 0:13 ` [PATCH v3 1/3] mtd: mtdoops: Fix the size of the header read buffer Jean-Marc Eurin
2022-04-21 7:35 ` Miquel Raynal
2022-04-15 0:13 ` [PATCH v3 2/3] mtd: mtdoops: Create a header structure for the saved mtdoops Jean-Marc Eurin
2022-04-21 7:35 ` Miquel Raynal
2022-04-15 0:13 ` [PATCH v3 3/3] mtd: mtdoops: Add a timestamp to the mtdoops header Jean-Marc Eurin
2022-04-21 7:35 ` Miquel Raynal
2022-04-21 23:42 ` [PATCH v4 0/3] mtd: mtdoops: Add timestamp to the dumped oops header Jean-Marc Eurin
2022-04-21 23:42 ` [PATCH v4 1/3] mtd: mtdoops: Fix the size of the header read buffer Jean-Marc Eurin
2022-04-26 7:34 ` Miquel Raynal
2022-04-21 23:42 ` [PATCH v4 2/3] mtd: mtdoops: Create a header structure for the saved mtdoops Jean-Marc Eurin
2022-04-26 7:34 ` Miquel Raynal
2022-04-25 8:42 ` [PATCH v4 0/3] mtd: mtdoops: Add timestamp to the dumped oops header Miquel Raynal
2022-04-25 16:14 ` Jean-Marc Eurin
2022-04-26 7:28 ` Miquel Raynal
2022-04-25 16:09 ` Jean-Marc Eurin [this message]
2022-04-26 7:34 ` [PATCH v4 3/3] mtd: mtdoops: Add a timestamp to the mtdoops header Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220425160927.3823016-1-jmeurin@google.com \
--to=jmeurin@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®