/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* Ereport-handling routines for memory errors
*/
#include <cmd_mem.h>
#include <cmd_dimm.h>
#include <cmd_bank.h>
#include <cmd_page.h>
#include <cmd_cpu.h>
#ifdef sun4u
#include <cmd_dp.h>
#include <cmd_dp_page.h>
#endif
#include <cmd.h>
#include <strings.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <sys/errclassify.h>
#include <assert.h>
#ifdef sun4v
#include <cmd_hc_sun4v.h>
#endif /* sun4v */
struct ce_name2type {
const char *name;
};
{
{ NULL }
};
{ CE_DISP_DESC_P, CE_DISP_PERS },
{ CE_DISP_DESC_L, CE_DISP_LEAKY },
{ CE_DISP_DESC_S, CE_DISP_STICKY },
{ NULL }
};
return (CE_DISP_UNKNOWN);
}
/*
* check if a dimm has n CEs with the same symbol-in-error
*/
static int
{
int i;
int count = 0;
for (i = 0; i < CMD_MAX_CKWDS; i++) {
count++;
return (1);
}
}
}
return (0);
}
/*
* check if smaller number of retired pages > 1/16 of larger
* number of retired pages
*/
static int
{
double ratio;
if (d2_nretired < d1_nretired) {
sret = d2_nretired;
lret = d1_nretired;
} else if (d2_nretired > d1_nretired) {
sret = d1_nretired;
lret = d2_nretired;
} else
return (0);
return (1);
}
return (0);
}
/*
* check bad rw between two DIMMs
* the check succeeds if
* - each DIMM has 4 CEs with the same symbol-in-error.
* - the smaller number of retired pages > 1/16 larger number of retired pages
*/
static int
{
int i;
for (i = 0; i < CMD_MAX_CKWDS; i++) {
return (1);
}
}
}
}
}
return (0);
}
static void
{
next = cmd_list_next(d);
if (d == ce_dimm)
continue;
if (!cmd_same_datapath_dimms(ce_dimm, d))
continue;
"check_bad_rw_dimms succeeded: %s %s",
return;
}
}
}
/*
* rule 5a checking. The check succeeds if
* - nretired >= 512
* - nretired >= 128 and (addr_hi - addr_low) / (nretired - 1) > 512KB
*/
static void
{
/* We've already complained about this DIMM */
return;
return;
(nret - 1);
"fault.memory.dimm-page-retires-excessive", CMD_FLTMAXCONF);
nret);
}
}
/*
* rule 5b checking. The check succeeds if
* more than 120 non-intermittent CEs are reported against one symbol
* position of one afar in 72 hours.
*/
static void
{
int cw;
"fault.memory.dimm-page-retires-excessive",
"mq_5b_check succeeded: duplicate CE=%d",
ip->mq_dupce_count);
return;
}
}
}
}
/*
* delete the expired duplicate CE time stamps
*/
void
{
ip->mq_dupce_count--;
}
}
}
void
{
ip->mq_dupce_count++;
}
/* Create a fresh index block for MQSC CE correlation. */
cmd_mq_t *
{
/*
* Create SERD to keep this event from being removed
* by fmd which may not know there is an event pointer
* saved here. This SERD is *never* meant to fire.
* NOTE: wouldn't need to do this if there were an fmd
* api to 'hold' an event.
*/
/* clean up dup */
}
return (cp);
}
/* Destroy MQSC tracking block as well as event tracking SERD. */
cmd_mq_t *
{
}
}
return (jp);
}
/*
* Add an index block for a new CE, sorted
* a) by ascending unit position
* b) order of arrival (~= time order)
*/
void
{
return; /* not a CE */
/* list is in unit position order */
break;
/*
* Found a duplicate cw, unit_position, and afar.
* update the mq_t with the new information
*/
return;
} else {
}
}
else
}
/*
* Prune the MQSC index lists (one for each checkword), by deleting
* outdated index blocks from each list.
*/
void
{
int cw;
/*
* This event has timed out - delete the
* mq block as well as serd for the event.
*/
} else {
/* tstamp < now - ce_t */
}
} /* per checkword */
} /* cw = 0...3 */
}
/*
* Check the MQSC index lists (one for each checkword) by making a
* complete pass through each list, checking if the criteria for
* Rule 4A has been met. Rule 4A checking is done for each checkword.
*
* Rule 4A: fault a DIMM "whenever Solaris reports two or more CEs from
* two or more different physical addresses on each of two or more different
* bit positions from the same DIMM within 72 hours of each other, and all
* the addresses are in the same relative checkword (that is, the AFARs
* are all the same modulo 64). [Note: This means at least 4 CEs; two
* from one bit position, with unique addresses, and two from another,
* also with unique addresses, and the lower 6 bits of all the addresses
* are the same."
*/
void
{
typedef struct upos_pair {
int upos;
} upos_pair_t;
/*
* Each upos_array[] member represents a pair of CEs for the same
* unit position (symbol) which on a sun4u is a bit, and on sun4v
* is a (4 bit) nibble.
* MQSC rule 4 requires pairs of CEs from the same symbol (same DIMM
* for rule 4A, and same DRAM for rule 4B) for a violation - this
* is why CE pairs are tracked.
*/
upos_pairs = 0;
/* Loop through all checkwords */
i = upos_pairs;
curr_upos = -1;
/*
* mq_root[] is an array of cumulative lists of CEs
* indexed by checkword where the list is in unit position
* order. Loop through checking for duplicate unit position
* entries (filled in at mq_create()).
* The upos_array[] is filled in each time a duplicate
* unit position is found; the first time through the loop
* of a unit position sets curr_upos but does not fill in
* upos_array[] until the second symbol is found.
*/
/* Set initial current position */
} else if (i > upos_pairs &&
/*
* Only keep track of CE pairs; skip
* triples, quads, etc...
*/
continue;
/*
* Have a pair, add to upos_array[].
*/
}
}
if (i - upos_pairs >= 2) {
/* Rule 4A Violation. */
dimm, "fault.memory.dimm-ue-imminent",
for (j = upos_pairs; j < i; j++) {
}
return;
}
upos_pairs = i;
}
}
/*ARGSUSED*/
{
const char *uuid;
int skip_error = 0;
if (afar_status != AFLT_STAT_VALID ||
return (CMD_EVD_UNUSED);
return (CMD_EVD_REDUND);
#ifdef sun4u
return (CMD_EVD_UNUSED);
}
#endif /* sun4u */
return (CMD_EVD_BAD);
}
return (CMD_EVD_UNUSED);
}
return (CMD_EVD_BAD);
/*
* Add to MQSC correlation lists all CEs which pass validity
* checks above.
* Add mq_t when there is no bad r/w or dimm fault.
* Always prune the expired mq_t.
*/
!= 0)
}
if (!skip_error)
}
}
switch (type) {
case CE_DISP_UNKNOWN:
return (CMD_EVD_UNUSED);
case CE_DISP_INTERMITTENT:
return (CMD_EVD_UNUSED);
case CE_DISP_POSS_PERS:
break;
case CE_DISP_PERS:
break;
case CE_DISP_LEAKY:
break;
case CE_DISP_POSS_STICKY:
{
if (CE_XDIAG_TESTVALID(ptnrinfo)) {
/* Should have been CE_DISP_STICKY */
return (CMD_EVD_BAD);
} else if (ce1) {
/* Partner could see and could fix CE */
} else {
/* Partner could not see ce1 (ignore ce2) */
}
} else {
}
return (CMD_EVD_UNUSED);
}
case CE_DISP_STICKY:
break;
default:
return (CMD_EVD_BAD);
}
return (CMD_EVD_REDUND);
}
switch (type) {
case CE_DISP_POSS_PERS:
case CE_DISP_PERS:
}
return (CMD_EVD_OK); /* engine hasn't fired */
break; /* to retire */
case CE_DISP_LEAKY:
case CE_DISP_STICKY:
break; /* to retire */
}
return (CMD_EVD_OK);
/*
* convert a unhashed address to hashed address
*/
dimm->dimm_nretired++;
return (CMD_EVD_OK);
}
/*
* Solve a bank case with suspect "fault.memory.bank". The caller must
* have populated bank->bank_case.cc_cp and is also responsible for adding
* associated ereport(s) to that case.
*/
void
{
return; /* Only complain once per bank */
#ifdef sun4u
#else /* sun4v */
{
cmd_bank_memb_t *d;
/* create separate fault for each dimm in bank */
d != NULL; d = cmd_list_next(d)) {
"fault.memory.bank", CMD_FLTMAXCONF);
}
}
#endif /* sun4u */
}
/*ARGSUSED*/
{
#ifdef sun4u
/*
* Note: Currently all sun4u processors using this code share
* L2 and L3 cache at CMD_CPU_LEVEL_CORE.
*/
#else /* sun4v */
#endif /* sun4u */
return (CMD_EVD_UNUSED);
}
/*
* The following code applies only to sun4u, because sun4u does
* not poison data in L2 cache resulting from the fetch of a
* memory UE.
*/
#ifdef sun4u
if (afar_status != AFLT_STAT_VALID) {
/*
* Had this report's AFAR been valid, it would have
* contributed an address to the UE cache. We don't
* know what the AFAR would have been, and thus we can't
* add anything to the cache. If a xxU is caused by
* this UE, we won't be able to detect it, and will thus
* erroneously offline the CPU. To prevent this
* situation, we need to assume that all xxUs generated
* through the next E$ flush are attributable to the UE.
*/
} else {
}
#endif /* sun4u */
if (synd_status != AFLT_STAT_VALID) {
return (CMD_EVD_UNUSED);
}
cpu) == CMD_EVD_UNUSED)
return (CMD_EVD_UNUSED);
if (afar_status != AFLT_STAT_VALID)
return (CMD_EVD_UNUSED);
return (CMD_EVD_REDUND);
return (NULL);
}
return (CMD_EVD_UNUSED);
#ifdef sun4v
{
char **snarray;
unsigned int i, n;
/*
* 1: locate the array of serial numbers inside the bank asru.
* 2: for each serial #, lookup its mem: FMRI in libtopo
* 3: ensure that each DIMM's FMRI is on bank's dimmlist
*/
FM_FMRI_MEM_SERIAL_ID, &snarray, &n) != 0)
for (i = 0; i < n; i++) {
snarray[i]);
/*
* If dimm structure doesn't already exist for
* each dimm, create and link to bank.
*/
}
}
#endif /* sun4v */
const char *uuid;
}
#ifdef sun4u
if (cmd_dp_error(hdl)) {
return (CMD_EVD_OK);
return (CMD_EVD_UNUSED);
}
#endif /* sun4u */
bank->bank_nretired++;
return (CMD_EVD_OK);
}
void
{
}
void
{
}