Skip to content

Commit

Permalink
Split nvdimm vendor logs
Browse files Browse the repository at this point in the history
Currently there's a 4k hard limit to amount of data sent
and vendor logs alone is above 4k size. Vendor logs is
all or nothing, so if it's above 4k then nothing gets sent.
Solution is to break the logs up into 512 byte chunks so some
data gets sent. Data is sent in reverse order with the most
important data being the most recent logs

Change-Id: I1710a6436d14d8c1ebdcd19ae2810e2b8a083796
CQ:SW488144
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/94102
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
Reviewed-by: Corey V Swenson <cswenson@us.ibm.com>
Reviewed-by: Nicholas E Bofferding <bofferdn@us.ibm.com>
  • Loading branch information
chenduibm authored and Nicholas E Bofferding committed Apr 14, 2020
1 parent ba9db9d commit 85992ee
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion src/usr/isteps/nvdimm/nvdimm.C
Expand Up @@ -66,6 +66,8 @@ TRAC_INIT(&g_trac_nvdimm, NVDIMM_COMP_NAME, 2*KILOBYTE);
// Easy macro replace for unit testing
//#define TRACUCOMP(args...) TRACFCOMP(args)
#define TRACUCOMP(args...)
#define SPLIT_SIZE 512
#define BUFFER_SIZE 100


namespace NVDIMM
Expand Down Expand Up @@ -4556,8 +4558,50 @@ void nvdimmAddVendorLog( TARGETING::Target* i_nvdimm, errlHndl_t& io_err )

// Add vendor data to error log as string
const char* l_fullChar = reinterpret_cast<char*>(l_fullData.data());

const char* l_copyChar = l_fullChar;
int l_length = strlen(l_copyChar);
int l_remaining = l_length;

// Count of number segments
const int l_totalCount = (l_length % SPLIT_SIZE == 0) ?
l_length/SPLIT_SIZE : l_length/SPLIT_SIZE + 1;
int l_count = l_totalCount;

// Move the string forward to the last 512 bytes
if (l_length > SPLIT_SIZE)
{
l_copyChar += l_length - SPLIT_SIZE;
}

ERRORLOG::ErrlUserDetailsStringSet l_stringSet;
l_stringSet.add("Vendor Log", l_fullChar);
size_t l_copySize = SPLIT_SIZE;
while (l_remaining > 0)
{
char buffer[BUFFER_SIZE] = {0};

// If at the last segment
if (l_remaining <= SPLIT_SIZE)
{
l_copySize = l_remaining;
l_copyChar = l_fullChar;
}

char l_blob[l_copySize+1] = {0};
strncpy(l_blob, l_copyChar, l_copySize);
l_blob[l_copySize+1] = '\0';

snprintf(buffer, SPLIT_SIZE, "Vendor Log: page %d of %d, "
"bytes %d to %d", l_count, l_totalCount,
l_remaining - l_copySize, l_remaining - 1);
l_stringSet.add(buffer, l_blob);

// Move string back 512 bytes
l_copyChar -= SPLIT_SIZE;
l_remaining -= l_copySize;
l_count--;
}

l_stringSet.addToLog(io_err);

// Change back to default
Expand Down

0 comments on commit 85992ee

Please sign in to comment.