[Skiboot] [PATCH] opal/errorlog : Fixes the problem of different create date/time for same error log

Mukesh Ojha mukesh02 at linux.vnet.ibm.com
Thu Sep 15 04:03:08 AEST 2016


In a situation when same OPAL error log sent both to the host and
service processor, in both of the cases the create date/time is generated
individually which eventually lead to the different create date/time
for the same error log, which is meaningless.

This patch solves this problem by adding field create date and time in
the error log structure and filling it up much early in opal_elog_create()
before handing over the error log buffer to the infrastructure that
sends the log both to the host and service processor.

Signed-off-by: Mukesh Ojha <mukesh02 at linux.vnet.ibm.com>
---
This patch depends on the patchset "[PATCH V7] ELOG generalization" sent
by me and it should be applied after that.

 core/errorlog.c    | 4 ++++
 core/pel.c         | 5 ++---
 include/errorlog.h | 2 ++
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/core/errorlog.c b/core/errorlog.c
index b2a0a3f..5cb4876 100644
--- a/core/errorlog.c
+++ b/core/errorlog.c
@@ -24,6 +24,7 @@
 #include <errorlog.h>
 #include <pel.h>
 #include <pool.h>
+#include <rtc.h>
 
 /*
  * Maximum number buffers that are pre-allocated
@@ -103,6 +104,7 @@ static struct errorlog *get_write_buffer(int opal_event_severity)
 struct errorlog *opal_elog_create(struct opal_err_info *e_info, uint32_t tag)
 {
 	struct errorlog *buf;
+	uint64_t ctime;
 
 	buf = get_write_buffer(e_info->sev);
 	if (buf) {
@@ -113,6 +115,8 @@ struct errorlog *opal_elog_create(struct opal_err_info *e_info, uint32_t tag)
 		buf->event_subtype = e_info->event_subtype;
 		buf->reason_code = e_info->reason_code;
 		buf->elog_origin = ORG_SAPPHIRE;
+		rtc_cache_get_datetime(&buf->create_date, &ctime);
+		buf->create_time = ctime >> 32;
 
 		lock(&elog_lock);
 		buf->plid = ++sapphire_elog_id;
diff --git a/core/pel.c b/core/pel.c
index 5df3e91..d0f7637 100644
--- a/core/pel.c
+++ b/core/pel.c
@@ -148,7 +148,6 @@ static void create_user_header_section(struct errorlog *elog_data,
 static void create_private_header_section(struct errorlog *elog_data,
 					char *pel_buffer, int *pel_offset)
 {
-	uint64_t ctime;
 	struct opal_private_header_section *privhdr =
 				(struct opal_private_header_section *)
 								pel_buffer;
@@ -160,8 +159,8 @@ static void create_private_header_section(struct errorlog *elog_data,
 	privhdr->v6header.component_id = elog_data->component_id;
 	privhdr->plid = elog_data->plid;
 
-	rtc_cache_get_datetime(&privhdr->create_date, &ctime);
-	privhdr->create_time = ctime >> 32;
+	privhdr->create_date = elog_data->create_date;
+	privhdr->create_time = elog_data->create_time;
 	privhdr->section_count = 5;
 
 	privhdr->creator_subid_hi = 0x00;
diff --git a/include/errorlog.h b/include/errorlog.h
index 46a9aa7..772dc11 100644
--- a/include/errorlog.h
+++ b/include/errorlog.h
@@ -138,6 +138,8 @@ struct __attribute__((__packed__)) errorlog {
 	uint32_t log_size;
 	uint64_t elog_timeout;
 	uint32_t ref_count;
+	uint32_t create_date;
+	uint32_t create_time;
 
 	char user_data_dump[OPAL_LOG_MAX_DUMP];
 	struct list_node link;
-- 
2.7.4



More information about the Skiboot mailing list