aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeepthi Dharwar <deepthi@linux.vnet.ibm.com>2014-07-24 12:01:08 +0530
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-07-25 14:10:51 +1000
commit8b23f08361ef62310b93bba5f330158b1f6c3729 (patch)
treecab52c711b9388b7c33361e8d33062f79bf742c8
parent78a02e39e57b4441fd1901e9d08c454baedcc399 (diff)
downloadskiboot-8b23f08361ef62310b93bba5f330158b1f6c3729.zip
skiboot-8b23f08361ef62310b93bba5f330158b1f6c3729.tar.gz
skiboot-8b23f08361ef62310b93bba5f330158b1f6c3729.tar.bz2
elog: Fix race conditions in assigning platform log id
Currently the Platform Log ID is generated during conversion of an error into PEL format. Logging of generic errors and panic errors to FSP are done in parallel through seperate TCE buffers. This patch attempts to serialise assigning of Platform Log ID during PEL creation. Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--hw/fsp/fsp-elog-write.c18
-rw-r--r--include/opal.h1
2 files changed, 14 insertions, 5 deletions
diff --git a/hw/fsp/fsp-elog-write.c b/hw/fsp/fsp-elog-write.c
index ee79c4d..28d3824 100644
--- a/hw/fsp/fsp-elog-write.c
+++ b/hw/fsp/fsp-elog-write.c
@@ -162,6 +162,10 @@ struct opal_errorlog *opal_elog_create(struct opal_err_info *e_info)
buf->event_subtype = e_info->event_subtype;
buf->reason_code = e_info->reason_code;
buf->elog_origin = ORG_SAPPHIRE;
+
+ lock(&elog_write_lock);
+ buf->plid = ++sapphire_elog_id;
+ unlock(&elog_write_lock);
}
return buf;
@@ -312,6 +316,7 @@ static int opal_commit_log_to_fsp(struct opal_errorlog *buf)
{
struct opal_errorlog *opal_buf;
int rc = OPAL_SUCCESS;
+ uint32_t plid;
/* Copy the buffer to Sapphire and queue it to push
* to FSP and return
@@ -323,9 +328,13 @@ static int opal_commit_log_to_fsp(struct opal_errorlog *buf)
return -1;
}
opal_buf = list_pop(&elog_write_free, struct opal_errorlog, link);
+ plid = ++powernv_elog_id;
unlock(&elog_write_lock);
+
memcpy(opal_buf, buf, sizeof(struct opal_errorlog));
opal_buf->elog_origin = ORG_POWERNV;
+ opal_buf->plid = plid;
+
rc = elog_fsp_commit(opal_buf);
return rc;
}
@@ -511,6 +520,7 @@ static void create_private_header_section(struct opal_errorlog *elog_data,
privhdr->v6header.version = OPAL_ELOG_VERSION;
privhdr->v6header.subtype = OPAL_ELOG_SST;
privhdr->v6header.component_id = elog_data->component_id;
+ privhdr->plid = elog_data->plid;
fsp_rtc_get_cached_tod(&privhdr->create_date, &ctime);
privhdr->create_time = ctime >> 32;
@@ -519,13 +529,11 @@ static void create_private_header_section(struct opal_errorlog *elog_data,
privhdr->creator_subid_hi = 0x00;
privhdr->creator_subid_lo = 0x00;
- if (elog_data->elog_origin == ORG_SAPPHIRE) {
- privhdr->plid = ++sapphire_elog_id;
+ if (elog_data->elog_origin == ORG_SAPPHIRE)
privhdr->creator_id = OPAL_CID_SAPPHIRE;
- } else {
- privhdr->plid = ++powernv_elog_id;
+ else
privhdr->creator_id = OPAL_CID_POWERNV;
- }
+
privhdr->log_entry_id = 0x00; /* entry id is updated by FSP */
*pel_offset += PRIVATE_HEADER_SECTION_SIZE;
diff --git a/include/opal.h b/include/opal.h
index 43b7c80..f219867 100644
--- a/include/opal.h
+++ b/include/opal.h
@@ -883,6 +883,7 @@ struct __attribute__((__packed__)) opal_errorlog {
uint32_t user_section_size;
uint32_t reason_code;
uint32_t additional_info[4];
+ uint32_t plid;
char user_data_dump[OPAL_LOG_MAX_DUMP];
struct list_node link;