[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220128220406.4058777-1-jmeurin@google.com>
Date: Fri, 28 Jan 2022 14:04:06 -0800
From: Jean-Marc Eurin <jmeurin@...gle.com>
To: Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>
Cc: linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
Jean-Marc Eurin <jmeurin@...gle.com>
Subject: [PATCH] Add a timestamp to the oops header.
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@...gle.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
Powered by blists - more mailing lists