module_t *module_add_node(moduleid_t id, cnodeid_t n) { module_t *m; int i; DPRINTF("module_add_node: id=%x node=%d\n", id, n); if ((m = module_lookup(id)) == 0) { #ifndef CONFIG_IA64_SGI_IO m = kmem_zalloc_node(sizeof (module_t), KM_NOSLEEP, n); #else m = kmalloc(sizeof (module_t), GFP_KERNEL); memset(m, 0 , sizeof(module_t)); printk("Module nodecnt = %d\n", m->nodecnt); #endif ASSERT_ALWAYS(m); DPRINTF("module_add_node: m=0x%p\n", m); m->id = id; spin_lock_init(&m->lock); init_MUTEX_LOCKED(&m->thdcnt); printk("Set elsc to 0x%p on node %d\n", &m->elsc, get_nasid()); set_elsc(&m->elsc); elsc_init(&m->elsc, COMPACT_TO_NASID_NODEID(n)); spin_lock_init(&m->elsclock); /* Insert in sorted order by module number */ for (i = nummodules; i > 0 && modules[i - 1]->id > id; i--) modules[i] = modules[i - 1]; modules[i] = m; nummodules++; } m->nodes[m->nodecnt++] = n; printk("module_add_node: module %x now has %d nodes\n", id, m->nodecnt); DPRINTF("module_add_node: module %x now has %d nodes\n", id, m->nodecnt); return m; }
module_t *module_add_node(moduleid_t id, cnodeid_t n) { module_t *m; int i; char buffer[16]; #ifdef __ia64 memset(buffer, 0, 16); format_module_id(buffer, id, MODULE_FORMAT_BRIEF); DPRINTF("module_add_node: id=%s node=%d\n", buffer, n); #endif if ((m = module_lookup(id)) == 0) { #ifdef LATER m = kmem_zalloc_node(sizeof (module_t), KM_NOSLEEP, n); #else m = kmalloc(sizeof (module_t), GFP_KERNEL); memset(m, 0 , sizeof(module_t)); #endif ASSERT_ALWAYS(m); m->id = id; spin_lock_init(&m->lock); mutex_init_locked(&m->thdcnt); // set_elsc(&m->elsc); elsc_init(&m->elsc, COMPACT_TO_NASID_NODEID(n)); spin_lock_init(&m->elsclock); /* Insert in sorted order by module number */ for (i = nummodules; i > 0 && modules[i - 1]->id > id; i--) modules[i] = modules[i - 1]; modules[i] = m; nummodules++; } m->nodes[m->nodecnt++] = n; DPRINTF("module_add_node: module %s now has %d nodes\n", buffer, m->nodecnt); return m; }
module_t *module_add_node(geoid_t geoid, cnodeid_t cnodeid) { module_t *m; int i; char buffer[16]; moduleid_t moduleid; memset(buffer, 0, 16); moduleid = geo_module(geoid); format_module_id(buffer, moduleid, MODULE_FORMAT_BRIEF); DPRINTF("module_add_node: moduleid=%s node=%d\n", buffer, cnodeid); if ((m = module_lookup(moduleid)) == 0) { m = kmalloc(sizeof (module_t), GFP_KERNEL); memset(m, 0 , sizeof(module_t)); ASSERT_ALWAYS(m); m->id = moduleid; spin_lock_init(&m->lock); mutex_init_locked(&m->thdcnt); /* Insert in sorted order by module number */ for (i = nummodules; i > 0 && modules[i - 1]->id > moduleid; i--) modules[i] = modules[i - 1]; modules[i] = m; nummodules++; } m->nodes[m->nodecnt] = cnodeid; m->geoid[m->nodecnt] = geoid; m->nodecnt++; DPRINTF("module_add_node: module %s now has %d nodes\n", buffer, m->nodecnt); return m; }
/* ARGSUSED */ static void __init klhwg_add_node(vertex_hdl_t hwgraph_root, cnodeid_t cnode) { nasid_t nasid; lboard_t *brd; klhub_t *hub; vertex_hdl_t node_vertex = NULL; char path_buffer[100]; int rv; char *s; int board_disabled = 0; klcpu_t *cpu; vertex_hdl_t cpu_dir; nasid = cnodeid_to_nasid(cnode); brd = find_lboard_any((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA); ASSERT(brd); /* Generate a hardware graph path for this board. */ board_to_path(brd, path_buffer); rv = hwgraph_path_add(hwgraph_root, path_buffer, &node_vertex); if (rv != GRAPH_SUCCESS) { printk("Node vertex creation failed. Path == %s", path_buffer); return; } HWGRAPH_DEBUG(__FILE__, __FUNCTION__, __LINE__, node_vertex, NULL, "Created path for SHUB node.\n"); hub = (klhub_t *)find_first_component(brd, KLSTRUCT_HUB); ASSERT(hub); if(hub->hub_info.flags & KLINFO_ENABLE) board_disabled = 0; else board_disabled = 1; if(!board_disabled) { mark_nodevertex_as_node(node_vertex, cnode); s = dev_to_name(node_vertex, path_buffer, sizeof(path_buffer)); NODEPDA(cnode)->hwg_node_name = kmalloc(strlen(s) + 1, GFP_KERNEL); if (NODEPDA(cnode)->hwg_node_name <= 0) { printk("%s: no memory\n", __FUNCTION__); return; } strcpy(NODEPDA(cnode)->hwg_node_name, s); hubinfo_set(node_vertex, NODEPDA(cnode)->pdinfo); NODEPDA(cnode)->slotdesc = brd->brd_slot; NODEPDA(cnode)->geoid = brd->brd_geoid; NODEPDA(cnode)->module = module_lookup(geo_module(brd->brd_geoid)); klhwg_add_hub(node_vertex, hub, cnode); } /* * If there's at least 1 CPU, add a "cpu" directory to represent * the collection of all CPUs attached to this node. */ cpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU); if (cpu) { graph_error_t rv; rv = hwgraph_path_add(node_vertex, EDGE_LBL_CPU, &cpu_dir); if (rv != GRAPH_SUCCESS) { printk("klhwg_add_node: Cannot create CPU directory\n"); return; } HWGRAPH_DEBUG(__FILE__, __FUNCTION__, __LINE__, cpu_dir, NULL, "Created cpu directiry on SHUB node.\n"); } while (cpu) { cpuid_t cpu_id; cpu_id = nasid_slice_to_cpuid(nasid,cpu->cpu_info.physid); if (cpu_online(cpu_id)) klhwg_add_cpu(node_vertex, cnode, cpu); else klhwg_add_disabled_cpu(node_vertex, cnode, cpu, brd->brd_slot); cpu = (klcpu_t *) find_component(brd, (klinfo_t *)cpu, KLSTRUCT_CPU); } }
char *uno_step(Tcl_Interp *interp) { char msg[MAX_LONG_MESSAGE]; MsgData msgData; int from=0, to=0, dt=0; static int prev_time; static int first_run=1; char source[128]; char dest[128]; int from_resourcep=0; Task task; int valid_message=1; /* (1) Read in a line from the log file and parse it (This is all done by the CV_OneStepFromFile procedure. (2) Check what type of message the line is. */ if (CV_OneStepFromFile(global_log_file, msg, &msgData, interp)) { if (COMVIEW_DEBUG) { fprintf(stderr, "%s\n",msg); } /* For Success or Failure messages the source (from) the module which is sending the message is not logged by central. This information is maintained by the task-tree however, so a call to FindTask will wean this information. */ if ((msgData->type==FAILURE) || (msgData->type==SUCCESS)) { task = FindTask(msgData->name, msgData->id, task_ACTIVE); if (!task) { fprintf(stderr, "Comview error line %d %s : could not FindTask %s\n", __LINE__, __FILE__, msgData->name); } from=(int)task->additional; from_resourcep = 0; to = 0; strcpy(source, "0"); strcpy(dest, "0"); if (COMVIEW_DEBUG) { fprintf(stderr, "TASK: %s ", task->creator->name); fprintf(stderr, "%d ", task->creation_time); fprintf(stderr, "%d\n", (int)task->additional); } } else if (msgData->type == MODULE_CONNECT) { /* The Tcl code expects the module name in the source element */ strcpy(source, msgData->name); /* Read and Parse and additional line: the HOSTNAME */ CV_OneStepFromFile(global_log_file, msg, &msgData, interp); strcpy(dest, msgData->name); from=module_lookup(source, dest, interp); } else if (msgData->type == MODULE_DISCONNECT) { /* the destination string will hold the hostname (eventually) */ strcpy(dest, "0"); /* The Tcl code expects the module name in the source element */ strcpy(source, msgData->name); from=module_lookup(source, dest, interp); } else if (logged_message_type(msgData->type)) { /* check if the message is coming from a resource... */ from_resourcep = resource_msg(msgData->source); if (from_resourcep) resource_loc(source, msgData->source); else strcpy(source, msgData->source); /* check if the message is going to a resource... */ if (resource_msg (msgData->dest)) resource_loc(dest, msgData->dest); else strcpy(dest, msgData->dest); from = module_lookup(source, "", interp); to = module_lookup(dest, "", interp); } else { fprintf(stderr, "COMVIEW WARNING: message type not handled %d\n", msgData->type); valid_message = 0; } if ((logged_message_type(msgData->type)) && (msgData->type != MODULE_CONNECT) && (msgData->type != MODULE_DISCONNECT) && (msgData->type != HOSTNAME)) { dt=msgData->time - prev_time; if (first_run) { /* the first time through the prev_time is not going to be set */ first_run=0; dt=10; /* we also need to tell Tcl what time the first message */ /* occurred at (as a point of reference) */ set_time_vars(interp, msgData->hours, msgData->minutes, msgData->seconds, msgData->m_seconds); } prev_time = msgData->time; } if (valid_message) { g_mod = to; if (COMVIEW_DEBUG) log_debug(msgData, from, to, dt, prev_time, from_resourcep); sprintf(result, "list %d \"%s\" %d \"%s\" %d %d \"%s\" %d %d", from, source, to, dest, msgData->type, msgData->status, msgData->name, dt, from_resourcep); /* if the message was valid, then add it to the task tree */ if (msgData->type != TYPE_NULL) TaskTreeProcessNewMessage(msgData); } else { sprintf(result, "perror"); } } else { /* This point is reached if there was a parse error, or if the file pointer is currently at the EOF (this is more often the case). */ sprintf(result, "perror"); if (COMVIEW_DEBUG) fprintf(stderr, "C Could not parse message: %s\n", msg); } /* free(&msgData); */ return result; }