* [PATCH] Add a timestamp to the oops header.
@ 2022-01-28 22:04 Jean-Marc Eurin
0 siblings, 0 replies; only message in thread
From: Jean-Marc Eurin @ 2022-01-28 22:04 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Jean-Marc Eurin
The saved panics in the mtdoops partition now include a timestamp
in the expanded header after the existing sequence number.
This patch depends on patch 2268aeacced1.
Signed-off-by: Jean-Marc Eurin <jmeurin@google.com>
---
drivers/mtd/mtdoops.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 09a26747f490..7f5869c209a8 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>
@@ -23,7 +24,7 @@
#define MTDOOPS_MAX_MTD_SIZE (8 * 1024 * 1024)
#define MTDOOPS_KERNMSG_MAGIC 0x5d005d00
-#define MTDOOPS_HEADER_SIZE 8
+#define MTDOOPS_HEADER_SIZE 16
static unsigned long record_size = 4096;
module_param(record_size, ulong, 0400);
@@ -180,6 +181,7 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic)
size_t retlen;
u32 *hdr;
int ret;
+ ktime_t ktime = ktime_get_real();
if (test_and_set_bit(0, &cxt->oops_buf_busy))
return;
@@ -188,6 +190,8 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic)
hdr = cxt->oops_buf;
hdr[0] = cxt->nextcount;
hdr[1] = MTDOOPS_KERNMSG_MAGIC;
+ hdr[2] = (u32) (ktime >> 32);
+ hdr[3] = (u32) (ktime & 0xffffffff);
if (panic) {
ret = mtd_panic_write(mtd, cxt->nextpage * record_size,
--
2.35.0.rc2.247.g8bbb082509-goog
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-28 22:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28 22:04 [PATCH] Add a timestamp to the oops header Jean-Marc Eurin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).