Mercurial > illumos > illumos-gate
changeset 13143:87d7bfd32811
6969657 Taking DINFOFORCE devinfo snapshot in libtopo may cause a long delay for fmtopo and fmd.
author | Hyon Kim <Hyon.Kim@Sun.COM> |
---|---|
date | Mon, 16 Aug 2010 16:49:45 -0700 |
parents | 96bc3a30c4fe |
children | 9615cdbf7b70 |
files | usr/src/cmd/fm/fmd/common/fmd_dr.c usr/src/cmd/fm/fmd/common/fmd_topo.c usr/src/cmd/fm/fmd/common/fmd_topo.h usr/src/lib/fm/topo/libtopo/common/libtopo.h usr/src/lib/fm/topo/libtopo/common/mapfile-vers usr/src/lib/fm/topo/libtopo/common/topo_snap.c usr/src/lib/fm/topo/libtopo/common/topo_subr.c usr/src/lib/fm/topo/libtopo/common/topo_subr.h |
diffstat | 8 files changed, 27 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/fm/fmd/common/fmd_dr.c Mon Aug 16 16:30:37 2010 -0700 +++ b/usr/src/cmd/fm/fmd/common/fmd_dr.c Mon Aug 16 16:49:45 2010 -0700 @@ -134,7 +134,7 @@ (void) pthread_mutex_unlock(&fmd.d_stats_lock); TRACE((FMD_DBG_XPRT, "dr event %p, gen=%llu", (void *)sep, gen)); - fmd_topo_update(B_FALSE); + fmd_topo_update(); ftp = fmd_topo_hold(); e = fmd_event_create(FMD_EVT_TOPO, ftp->ft_time_end, NULL, ftp);
--- a/usr/src/cmd/fm/fmd/common/fmd_topo.c Mon Aug 16 16:30:37 2010 -0700 +++ b/usr/src/cmd/fm/fmd/common/fmd_topo.c Mon Aug 16 16:49:45 2010 -0700 @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ /* @@ -61,7 +60,7 @@ } void -fmd_topo_update(boolean_t need_force) +fmd_topo_update(void) { int err; topo_hdl_t *tp; @@ -87,15 +86,9 @@ ftp->ft_hdl = tp; ftp->ft_time_begin = fmd_time_gethrtime(); - if (need_force) { - if ((id = topo_snap_hold(tp, NULL, &err)) == NULL) - fmd_panic("failed to get topology snapshot: %s", - topo_strerror(err)); - } else { - if ((id = topo_snap_hold_no_forceload(tp, NULL, &err)) == NULL) - fmd_panic("failed to get topology snapshot: %s", - topo_strerror(err)); - } + if ((id = topo_snap_hold(tp, NULL, &err)) == NULL) + fmd_panic("failed to get topology snapshot: %s", + topo_strerror(err)); topo_hdl_strfree(tp, id); @@ -166,7 +159,7 @@ void fmd_topo_init(void) { - fmd_topo_update(B_TRUE); + fmd_topo_update(); } void
--- a/usr/src/cmd/fm/fmd/common/fmd_topo.h Mon Aug 16 16:30:37 2010 -0700 +++ b/usr/src/cmd/fm/fmd/common/fmd_topo.h Mon Aug 16 16:49:45 2010 -0700 @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _FMD_TOPO_H @@ -45,7 +44,7 @@ hrtime_t ft_time_end; } fmd_topo_t; -extern void fmd_topo_update(boolean_t); +extern void fmd_topo_update(void); extern fmd_topo_t *fmd_topo_hold(void); extern void fmd_topo_addref(fmd_topo_t *); extern void fmd_topo_rele(fmd_topo_t *);
--- a/usr/src/lib/fm/topo/libtopo/common/libtopo.h Mon Aug 16 16:30:37 2010 -0700 +++ b/usr/src/lib/fm/topo/libtopo/common/libtopo.h Mon Aug 16 16:49:45 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _LIBTOPO_H @@ -60,7 +59,6 @@ extern topo_hdl_t *topo_open(int, const char *, int *); extern void topo_close(topo_hdl_t *); extern char *topo_snap_hold(topo_hdl_t *, const char *, int *); -extern char *topo_snap_hold_no_forceload(topo_hdl_t *, const char *, int *); extern void topo_snap_release(topo_hdl_t *); /*
--- a/usr/src/lib/fm/topo/libtopo/common/mapfile-vers Mon Aug 16 16:30:37 2010 -0700 +++ b/usr/src/lib/fm/topo/libtopo/common/mapfile-vers Mon Aug 16 16:49:45 2010 -0700 @@ -188,7 +188,6 @@ topo_sensor_units_name; topo_stability2name; topo_snap_hold; - topo_snap_hold_no_forceload; topo_snap_release; topo_strerror; topo_walk_fini;
--- a/usr/src/lib/fm/topo/libtopo/common/topo_snap.c Mon Aug 16 16:30:37 2010 -0700 +++ b/usr/src/lib/fm/topo/libtopo/common/topo_snap.c Mon Aug 16 16:49:45 2010 -0700 @@ -292,8 +292,14 @@ return (NULL); } - thp->th_di = di_init("/", (need_force ? DINFOFORCE : 0) | - DINFOSUBTREE | DINFOMINOR | DINFOPROP | DINFOPATH); + if (need_force) { + topo_dprintf(thp, TOPO_DBG_FORCE, + "taking a DINFOFORCE snapshot\n"); + thp->th_di = di_init("/", DINFOFORCE | + DINFOSUBTREE | DINFOMINOR | DINFOPROP | DINFOPATH); + } else { + thp->th_di = di_init("/", DINFOCACHE); + } thp->th_pi = di_prom_init(); if (topo_tree_enum_all(thp) < 0) { @@ -374,7 +380,11 @@ if (uuid == NULL) { char *ret; - ret = topo_snap_create(thp, errp, B_TRUE); + if (thp->th_debug & TOPO_DBG_FORCE) { + ret = topo_snap_create(thp, errp, B_TRUE); + } else { + ret = topo_snap_create(thp, errp, B_FALSE); + } /* * Now walk the tree and invoke any facility enumeration methods @@ -392,40 +402,6 @@ return (topo_snap_log_create(thp, uuid, errp)); } -/* - * Return snapshot id. This variant calls di_init() without DINFOFORCE, - * and is intended for use on DR events where there is no need to force - * attach of all devices. - */ -char * -topo_snap_hold_no_forceload(topo_hdl_t *thp, const char *uuid, int *errp) -{ - topo_walk_t *twp; - - if (thp == NULL) - return (NULL); - - if (uuid == NULL) { - char *ret; - - ret = topo_snap_create(thp, errp, B_FALSE); - - /* - * Now walk the tree and invoke any facility enumeration methods - */ - if (ret != NULL) { - if ((twp = topo_walk_init(thp, FM_FMRI_SCHEME_HC, - fac_walker, (void *)0, errp)) == NULL) { - return (ret); - } - (void) topo_walk_step(twp, TOPO_WALK_CHILD); - topo_walk_fini(twp); - } - return (ret); - } - return (topo_snap_log_create(thp, uuid, errp)); -} - /*ARGSUSED*/ static int topo_walk_destroy(topo_hdl_t *thp, tnode_t *node, void *notused)
--- a/usr/src/lib/fm/topo/libtopo/common/topo_subr.c Mon Aug 16 16:30:37 2010 -0700 +++ b/usr/src/lib/fm/topo/libtopo/common/topo_subr.c Mon Aug 16 16:49:45 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ #include <alloca.h> @@ -98,6 +97,7 @@ TOPO_DBG_MODSVC }, { "walk", "walker subsystem debug messages enabled", TOPO_DBG_WALK }, { "xml", "xml file parsing messages enabled", TOPO_DBG_XML }, + { "devinfoforce", "devinfo DINFOFORCE snapshot used", TOPO_DBG_FORCE }, { "all", "all debug modes enabled", TOPO_DBG_ALL}, { NULL, NULL, 0 } };
--- a/usr/src/lib/fm/topo/libtopo/common/topo_subr.h Mon Aug 16 16:30:37 2010 -0700 +++ b/usr/src/lib/fm/topo/libtopo/common/topo_subr.h Mon Aug 16 16:49:45 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _TOPO_SUBR_H @@ -51,6 +50,7 @@ #define TOPO_DBG_MODSVC 0x0004 /* enable module services debug messages */ #define TOPO_DBG_WALK 0x0008 /* enable walker debug messages */ #define TOPO_DBG_XML 0x0010 /* enable xml parsing debug messages */ +#define TOPO_DBG_FORCE 0x0020 /* use DINFOFORCE snapshot for topology */ #define TOPO_DBG_ALL 0xffff /* enable all debug modes */ #define TOPO_STABSTR_INTERNAL "Internal" /* private to libtopo */