opensm: perfmgr mark inactive nodes in perfmgr db
PATCH 5/10 opensm: perfmgr mark inactive nodes in perfmgr db
When "missing" nodes are not removed by default mark them as inactive. In addition, add a console option to remove them.
Signed-off-by Ira Weiny <[email protected]>
--- include/opensm/osm_perfmgr.h | 7 ++++ include/opensm/osm_perfmgr_db.h | 5 +++ opensm/osm_console.c | 8 ++++- opensm/osm_perfmgr.c | 4 ++ opensm/osm_perfmgr_db.c | 69 ++++++++++++++++++++++++++++++++++++-- 5 files changed, 88 insertions(+), 5 deletions(-)
include/opensm/osm_perfmgr.h +7 -0
@@ -235,6 +235,13 @@ inline static uint16_t osm_perfmgr_get_sweep_time_s(osm_perfmgr_t * p_perfmgr)return p_perfmgr->sweep_time_s; } +inline static unsigned osm_perfmgr_delete_inactive (osm_perfmgr_t * pm) +{ +unsigned rc; +perfmgr_db_delete_inactive (pm->db, &rc); +return (rc); +} +void osm_perfmgr_clear_counters (osm_perfmgr_t * p_perfmgr);void osm_perfmgr_dump_counters (osm_perfmgr_t * p_perfmgr,perfmgr_db_dump_t dump_type);
include/opensm/osm_perfmgr_db.h +5 -0
@@ -136,6 +136,7 @@ typedef struct db_port { typedef struct db_node { cl_map_item_t map_item; /* must be first */ uint64_t node_guid; + boolean_t active; /* activly being monitored */ boolean_t esp0; db_port_t *ports; uint8_t num_ports;
@@ -161,6 +162,7 @@ perfmgr_db_err_t perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid, boolean_t esp0, uint8_t num_ports, char *node_name);perfmgr_db_err_t perfmgr_db_delete_entry (perfmgr_db_t * db,uint64_t guid); +perfmgr_db_err_t perfmgr_db_delete_inactive (perfmgr_db_t * db,unsigned *cnt); perfmgr_db_err_t perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,
@@ -182,6 +184,9 @@ perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid,perfmgr_db_err_t perfmgr_db_clear_prev_dc (perfmgr_db_t * db,uint64_t guid,uint8_t port); +perfmgr_db_err_t perfmgr_db_mark_active (perfmgr_db_t *db,uint64_t guid, +boolean_t active); +void perfmgr_db_clear_counters (perfmgr_db_t * db);perfmgr_db_err_t perfmgr_db_dump (perfmgr_db_t * db,char *file,perfmgr_db_dump_t dump_type);
opensm/osm_console.c +7 -1
@@ -239,7 +239,7 @@ static void help_update_desc(FILE *out, int detail)static void help_perfmgr (FILE * out,int detail) {fprintf (out, -"perfmgr [enable|disable|clear_counters|dump_counters|print_counters|dump_redir|clear_redir|set_rm_nodes|clear_rm_nodes|sweep_time[seconds]]\n" ); +"perfmgr [enable|disable|clear_counters|dump_counters|print_counters|dump_redir|clear_redir|set_rm_nodes|clear_rm_nodes|clear_inactive|sweep_time[seconds]]\n" );if (detail) {fprintf (out,"perfmgr -- print the performance manager state\n" );
@@ -260,6 +260,8 @@ static void help_perfmgr(FILE * out, int detail)fprintf (out," [[set|clear]_rm_nodes] -- enable/disable the removal of \"inactive\" nodes from the DB\n" " Inactive nodes are those which no longer appear on the fabric\n" ); +fprintf (out, + " [clear_inactive] -- Delete inactive nodes from the DB\n"); } }#endif /* ENABLE_OSM_PERF_MGR */
@@ -1459,7 +1461,11 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)osm_perfmgr_dump_counters (&p_osm->perfmgr,PERFMGR_EVENT_DB_DUMP_HR ); } + }else if (strcmp (p_cmd,"clear_inactive" ) ==0 ) { +unsigned cnt =osm_perfmgr_delete_inactive (&p_osm->perfmgr); +fprintf (out,"Removed %u nodes from Database\n" , cnt); }else if (strcmp (p_cmd,"print_counters" ) ==0 ) { +char *port =NULL ; p_cmd =name_token (p_last);if (p_cmd) { osm_perfmgr_print_counters(&p_osm->perfmgr,
opensm/osm_perfmgr.c +4 -0
@@ -148,6 +148,8 @@ static void remove_marked_nodes(osm_perfmgr_t * pm)if (pm->rm_nodes)perfmgr_db_delete_entry (pm->db, pm->remove_list->guid); +else +perfmgr_db_mark_active (pm->db, pm->remove_list->guid, FALSE);if (pm->remove_list->name)free (pm->remove_list->name);
@@ -524,6 +526,8 @@ static void perfmgr_query_counters(cl_map_item_t * p_map_item, void *context) goto Exit; } +perfmgr_db_mark_active (pm->db, node_guid, TRUE); +/* issue the query for each port */ for (port = mon_node->esp0 ?0 :1 ; port < num_ports; port++) {ib_net16_t lid;
opensm/osm_perfmgr_db.c +65 -4
116 lines not on this page · raw message
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html