cma_page.c revision 24db46411fd54f70c35b94bb952eb7ba040e43b4
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CDDL HEADER START
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The contents of this file are subject to the terms of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Common Development and Distribution License (the "License").
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * You may not use this file except in compliance with the License.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * or http://www.opensolaris.org/os/licensing.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * See the License for the specific language governing permissions
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and limitations under the License.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * When distributing Covered Code, include this CDDL HEADER in each
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * If applicable, add the following below this CDDL HEADER, with the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * fields enclosed by brackets "[]" replaced with your own identifying
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * information: Portions Copyright [yyyy] [name of copyright owner]
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CDDL HEADER END
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Use is subject to license terms.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#pragma ident "%Z%%M% %I% %E% SMI"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Page retirement can be an extended process due to the fact that a retirement
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * may not be possible when the original request is made. The kernel will
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * repeatedly attempt to retire a given page, but will not let us know when the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * page has been retired. We therefore have to poll to see if the retirement
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * has been completed. This poll is implemented with a bounded exponential
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * backoff to reduce the burden which we impose upon the system.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * To reduce the burden on fmd in the face of retirement storms, we schedule
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * all retries as a group. In the simplest case, we attempt to retire a single
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * page. When forced to retry, we initially schedule a retry at a configurable
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * interval t. If the retry fails, we schedule another at 2 * t, and so on,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * until t reaches the maximum interval (also configurable). Future retries
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * for that page will occur with t equal to the maximum interval value. We
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * will never give up on a retirement.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor *
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * With multiple retirements, the situation gets slightly more complicated. As
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * indicated above, we schedule retries as a group. We don't want to deny new
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * pages their short retry intervals, so we'll (re)set the retry interval to the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * value appropriate for the newest page.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <cma.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <time.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <fcntl.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <errno.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <unistd.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <strings.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <fm/fmd_api.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <fm/libtopo.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/fm/protocol.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#include <sys/mem.h>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorstatic int
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorcma_page_cmd(fmd_hdl_t *hdl, int cmd, nvlist_t *nvl)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor{
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor mem_page_t mpage;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor char *fmribuf;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor size_t fmrisz;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor int fd, rc, err;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if ((fd = open("/dev/mem", O_RDONLY)) < 0)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor return (-1); /* errno is set for us */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if ((errno = nvlist_size(nvl, &fmrisz, NV_ENCODE_NATIVE)) != 0 ||
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor fmrisz > MEM_FMRI_MAX_BUFSIZE ||
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (fmribuf = fmd_hdl_alloc(hdl, fmrisz, FMD_SLEEP)) == NULL) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (void) close(fd);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor return (-1); /* errno is set for us */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor }
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if ((errno = nvlist_pack(nvl, &fmribuf, &fmrisz,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor NV_ENCODE_NATIVE, 0)) != 0) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor fmd_hdl_free(hdl, fmribuf, fmrisz);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (void) close(fd);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor return (-1); /* errno is set for us */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor }
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor mpage.m_fmri = fmribuf;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor mpage.m_fmrisz = fmrisz;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if ((rc = ioctl(fd, cmd, &mpage)) < 0)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor err = errno;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor fmd_hdl_free(hdl, fmribuf, fmrisz);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (void) close(fd);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if (rc < 0) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor errno = err;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor return (-1);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor }
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor return (0);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor}
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorstatic void
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorcma_page_free(fmd_hdl_t *hdl, cma_page_t *page)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor{
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if (page->pg_fmri != NULL)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor nvlist_free(page->pg_fmri);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor fmd_hdl_free(hdl, page, sizeof (cma_page_t));
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor}
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Retire the specified ASRU, referring to a memory page by PA or by DIMM
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * offset (i.e. the encoded coordinates internal bank, row, and column).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * In the initial FMA implementation, fault.memory.page exported an ASRU
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * with an explicit physical address, which is valid at the initial time of
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * diagnosis but may not be later following DR, DIMM removal, or interleave
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * changes. On SPARC, this issue was solved by exporting the DIMM offset
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and pushing the entire FMRI to the platform memory controller through
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * /dev/mem so it can derive the current PA from the DIMM and offset.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * On x64, we also use DIMM and offset, but the mem:/// unum string is an
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * encoded hc:/// FMRI that is then used by the x64 memory controller driver.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * At some point these three approaches need to be rationalized: all platforms
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * should use the same scheme, either with decoding in the kernel or decoding
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * in userland (i.e. with a libtopo method to compute and update the PA).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor/*ARGSUSED*/
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorcma_page_retire(fmd_hdl_t *hdl, nvlist_t *nvl, nvlist_t *asru, const char *uuid)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor{
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor cma_page_t *page;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t pageaddr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor char *unumstr;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor nvlist_t *asrucp = NULL;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor /* It should already be expanded, but we'll do it again anyway */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if (fmd_nvl_fmri_expand(hdl, asru) < 0) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor fmd_hdl_debug(hdl, "failed to expand page asru\n");
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor cma_stats.bad_flts.fmds_value.ui64++;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor return (CMA_RA_FAILURE);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor }
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if (nvlist_lookup_uint64(asru, FM_FMRI_MEM_PHYSADDR, &pageaddr) != 0) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor fmd_hdl_debug(hdl, "mem fault missing '%s'\n",
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor FM_FMRI_MEM_PHYSADDR);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor cma_stats.bad_flts.fmds_value.ui64++;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor return (CMA_RA_FAILURE);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor }
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if (!cma.cma_page_doretire) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor fmd_hdl_debug(hdl, "suppressed retire of page %llx\n",
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (u_longlong_t)pageaddr);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor cma_stats.page_supp.fmds_value.ui64++;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor return (CMA_RA_FAILURE);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor }
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if (!fmd_nvl_fmri_present(hdl, asru)) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor fmd_hdl_debug(hdl, "page retire overtaken by events\n");
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor cma_stats.page_nonent.fmds_value.ui64++;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor return (CMA_RA_SUCCESS);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor }
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor /*
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * If the unum is an hc fmri string expand it to an fmri and include
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * that in a modified asru nvlist.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor */
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if (nvlist_lookup_string(asru, FM_FMRI_MEM_UNUM, &unumstr) == 0 &&
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor strncmp(unumstr, "hc:/", 4) == 0) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor int err;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor nvlist_t *unumfmri;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor struct topo_hdl *thp = fmd_hdl_topo_hold(hdl, TOPO_VERSION);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if (topo_fmri_str2nvl(thp, unumstr, &unumfmri, &err) != 0) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor fmd_hdl_topo_rele(hdl, thp);
fmd_hdl_debug(hdl, "page retire str2nvl failed: %s\n",
topo_strerror(err));
return (CMA_RA_FAILURE);
}
fmd_hdl_topo_rele(hdl, thp);
if (nvlist_dup(asru, &asrucp, 0) != 0) {
fmd_hdl_debug(hdl, "page retire nvlist dup failed\n");
nvlist_free(unumfmri);
return (CMA_RA_FAILURE);
}
if (nvlist_add_nvlist(asrucp, FM_FMRI_MEM_UNUM "-fmri",
unumfmri) != 0) {
fmd_hdl_debug(hdl, "page retire failed to add "
"unumfmri to modified asru");
nvlist_free(unumfmri);
nvlist_free(asrucp);
return (CMA_RA_FAILURE);
}
nvlist_free(unumfmri);
}
if (cma_page_cmd(hdl, MEM_PAGE_FMRI_RETIRE,
asrucp ? asrucp : asru) == 0) {
fmd_hdl_debug(hdl, "retired page 0x%llx\n",
(u_longlong_t)pageaddr);
cma_stats.page_flts.fmds_value.ui64++;
if (asrucp)
nvlist_free(asrucp);
return (CMA_RA_SUCCESS);
} else if (errno != EAGAIN) {
fmd_hdl_debug(hdl, "retire of page 0x%llx failed, will not "
"retry: %s\n", (u_longlong_t)pageaddr, strerror(errno));
if (asrucp)
nvlist_free(asrucp);
if (uuid != NULL && cma.cma_page_maxretries != 0)
return (CMA_RA_SUCCESS);
return (CMA_RA_FAILURE);
}
/*
* The page didn't immediately retire. We'll need to periodically
* check to see if it has been retired.
*/
fmd_hdl_debug(hdl, "page didn't retire - sleeping\n");
page = fmd_hdl_zalloc(hdl, sizeof (cma_page_t), FMD_SLEEP);
page->pg_addr = pageaddr;
if (asrucp) {
page->pg_fmri = asrucp;
} else {
(void) nvlist_dup(asru, &page->pg_fmri, 0);
}
if (uuid != NULL)
page->pg_uuid = fmd_hdl_strdup(hdl, uuid, FMD_SLEEP);
page->pg_next = cma.cma_pages;
cma.cma_pages = page;
if (cma.cma_page_timerid != 0)
fmd_timer_remove(hdl, cma.cma_page_timerid);
cma.cma_page_curdelay = cma.cma_page_mindelay;
cma.cma_page_timerid =
fmd_timer_install(hdl, NULL, NULL, cma.cma_page_curdelay);
return (CMA_RA_FAILURE);
}
static int
page_retry(fmd_hdl_t *hdl, cma_page_t *page)
{
if (page->pg_fmri != NULL && !fmd_nvl_fmri_present(hdl,
page->pg_fmri)) {
fmd_hdl_debug(hdl, "page retire overtaken by events");
cma_stats.page_nonent.fmds_value.ui64++;
if (page->pg_uuid != NULL)
fmd_case_uuclose(hdl, page->pg_uuid);
return (1); /* no longer a page to retire */
}
if (cma_page_cmd(hdl, MEM_PAGE_FMRI_ISRETIRED, page->pg_fmri) == 0) {
fmd_hdl_debug(hdl, "retired page 0x%llx on retry %u\n",
page->pg_addr, page->pg_nretries);
cma_stats.page_flts.fmds_value.ui64++;
if (page->pg_uuid != NULL)
fmd_case_uuclose(hdl, page->pg_uuid);
return (1); /* page retired */
}
if (errno == EAGAIN) {
fmd_hdl_debug(hdl, "scheduling another retry for 0x%llx\n",
page->pg_addr);
return (0); /* schedule another retry */
} else {
if (errno == EIO) {
fmd_hdl_debug(hdl, "failed to retry page 0x%llx "
"retirement: page isn't scheduled for retirement"
"(request made beyond page_retire limit?)\n",
page->pg_addr);
} else {
fmd_hdl_debug(hdl, "failed to retry page 0x%llx "
"retirement: %s\n", page->pg_addr,
strerror(errno));
}
if (page->pg_uuid != NULL && cma.cma_page_maxretries != 0)
fmd_case_uuclose(hdl, page->pg_uuid);
cma_stats.page_fails.fmds_value.ui64++;
return (1); /* give up */
}
}
void
cma_page_retry(fmd_hdl_t *hdl)
{
cma_page_t **pagep;
cma.cma_page_timerid = 0;
fmd_hdl_debug(hdl, "page_retry: timer fired\n");
pagep = &cma.cma_pages;
while (*pagep != NULL) {
cma_page_t *page = *pagep;
if (page_retry(hdl, page)) {
/*
* Successful retry or we're giving up - remove from
* the list
*/
*pagep = page->pg_next;
if (page->pg_uuid != NULL)
fmd_hdl_strfree(hdl, page->pg_uuid);
cma_page_free(hdl, page);
} else if (cma.cma_page_maxretries == 0 ||
page->pg_nretries < cma.cma_page_maxretries) {
page->pg_nretries++;
pagep = &page->pg_next;
} else {
/*
* Tunable maxretries was set and we reached
* the max, so just close the case.
*/
fmd_hdl_debug(hdl,
"giving up page retire 0x%llx on retry %u\n",
page->pg_addr, page->pg_nretries);
cma_stats.page_retmax.fmds_value.ui64++;
if (page->pg_uuid != NULL) {
fmd_case_uuclose(hdl, page->pg_uuid);
fmd_hdl_strfree(hdl, page->pg_uuid);
}
*pagep = page->pg_next;
cma_page_free(hdl, page);
}
}
if (cma.cma_pages == NULL)
return; /* no more retirements */
/*
* We still have retirements that haven't completed. Back the delay
* off, and schedule a retry.
*/
cma.cma_page_curdelay = MIN(cma.cma_page_curdelay * 2,
cma.cma_page_maxdelay);
fmd_hdl_debug(hdl, "scheduled page retirement retry for %llu secs\n",
(u_longlong_t)(cma.cma_page_curdelay / NANOSEC));
cma.cma_page_timerid =
fmd_timer_install(hdl, NULL, NULL, cma.cma_page_curdelay);
}
void
cma_page_fini(fmd_hdl_t *hdl)
{
cma_page_t *page;
while ((page = cma.cma_pages) != NULL) {
cma.cma_pages = page->pg_next;
cma_page_free(hdl, page);
}
}