void cos_init(void *arg) { lock_static_init(&evt_lock); cos_map_init_static(&evt_map); if (mapping_create(NULL) != 0) BUG(); INIT_LIST(&grps, next, prev); }
static int net_conn_init(void) { cos_map_init_static(&connections); cos_map_add(&connections, (void*)1); return 0; }
// block_cli_if_map_init pred 1 end // block_cli_if_map_init 1 start static inline void call_map_init() { if (unlikely(!first_map_init)) { first_map_init = 1; cos_map_init_static(&IDL_service_desc_maps); } return; }
CSTUB_FN(unsigned long, lock_component_alloc) (struct usr_inv_cap *uc, spdid_t spdid) { long fault; unsigned long ret; struct rec_data_lk *rd = NULL; unsigned long ser_lkid, cli_lkid; if (first == 0) { cos_map_init_static(&uniq_lkids); first = 1; } #ifdef BENCHMARK_MEAS_CREATION_TIME rdtscll(meas_start); #endif redo: #ifdef BENCHMARK_MEAS_ALLOC rdtscll(meas_end); if (test_flag) { test_flag = 0; printc("recovery a lock cost: %llu\n", meas_end - meas_start); } #endif CSTUB_INVOKE(ret, fault, uc, 1, spdid); if (unlikely (fault)){ #ifdef BENCHMARK_MEAS_ALLOC test_flag = 1; rdtscll(meas_start); #endif CSTUB_FAULT_UPDATE(); goto redo; } assert(ret > 0); cli_lkid = rdlk_alloc(); assert(cli_lkid >= 1); rd = rdlk_lookup(cli_lkid); assert(rd); rd_cons(rd, cos_spd_id(), cli_lkid, ret, LOCK_ALLOC); ret = cli_lkid; #ifdef BENCHMARK_MEAS_CREATION_TIME rdtscll(meas_end); printc("creating a lock costs %llu\n", meas_end - meas_start); #endif return ret; }
void torlib_init(void) { cos_map_init_static(&torrents); /* save descriptors for the null and root spots */ null_torrent.td = td_null; if (td_null != cos_map_add(&torrents, &null_torrent)) BUG(); root_torrent.td = td_root; if (td_root != cos_map_add(&torrents, &root_torrent)) BUG(); }
void cos_init(void *arg) { cos_map_init_static(&conn_map); while (1) { timed_event_block(cos_spd_id(), HTTP_REPORT_FREQ); printc("HTTP conns %ld, reqs %ld\n", http_conn_cnt, http_req_cnt); http_conn_cnt = http_req_cnt = 0; } return; }
CSTUB_FN(td_t, tsplit)(struct usr_inv_cap *uc, spdid_t spdid, td_t parent_tid, char * param, int len, tor_flags_t tflags, long evtid) { long fault = 0; td_t ret; struct __sg_tsplit_data *d = NULL; cbuf_t cb = 0; struct rec_data_tor *rd = NULL; int sz = len + sizeof(struct __sg_tsplit_data); td_t curr_ptid = 0; td_t cli_tid = 0; td_t ser_tid = 0; /* printc("cli: tsplit passed in param %s\n", param); */ assert(parent_tid >= 1); assert(param && len >= 0); assert(param[len] == '\0'); if (first == 0) { cos_map_init_static(&uniq_tids); first = 1; } redo: /* printc("<<< cli rtorrent: call tsplit (thread %d, spd %ld and parent tid %d) >>>\n", */ /* cos_get_thd_id(), cos_spd_id(), parent_tid); */ rd = rd_update(parent_tid, STATE_TSPLIT_PARENT); if (rd) { curr_ptid = rd->s_tid; } else { curr_ptid = parent_tid; } /* printc("<<< In: call tsplit (thread %d, , spd %ld and curr_parent tid %d) >>>\n", */ /* cos_get_thd_id(), cos_spd_id(), curr_ptid); */ d = cbuf_alloc(sz, &cb); assert(d); if (!d) return -1; d->parent_tid = curr_ptid; d->tflags = tflags; d->evtid = evtid; d->len[0] = 0; d->len[1] = len; memcpy(&d->data[0], param, len + 1); CSTUB_INVOKE(ret, fault, uc, 3, spdid, cb, sz); if (unlikely(fault)) { CSTUB_FAULT_UPDATE(); memset(&d->data[0], 0, len); cbuf_free(cb); printc("tsplit found a fault and ready to go to redo\n"); goto redo; } cbuf_free(cb); ser_tid = ret; /* printc("passed in param %s (ser_tid %d)\n", param, ser_tid); */ assert(ser_tid >= 1); char *l_param = ""; if (len > 0) { l_param = param_save(param, len); assert(l_param); } cli_tid = map_rd_create(); assert(cli_tid >= 2); rd = map_rd_lookup(cli_tid); assert(rd); rd_cons(rd, curr_ptid, cli_tid, ser_tid, l_param, len, tflags, evtid); /* printc("tsplit done!!! return new client tid %d\n\n", cli_tid); */ return cli_tid; }
void cos_init(void *d) { DOUT("CBUFMgr: %d in spd %ld cbuf mgr running.....\n", cos_get_thd_id(), cos_spd_id()); LOCK_INIT(); cos_map_init_static(&cb_ids); BUG_ON(cos_map_add(&cb_ids, NULL)); /* reserve id 0 */ int i; memset(spd_tmem_info_list, 0, sizeof(struct spd_tmem_info) * MAX_NUM_SPDS); for(i = 0; i < MAX_NUM_SPDS; i++){ spd_tmem_info_list[i].spdid = i; INIT_LIST(&spd_tmem_info_list[i].ci, next, prev); INIT_LIST(&spd_tmem_info_list[i].tmem_list, next, prev); INIT_LIST(&spd_tmem_info_list[i].bthd_list, next, prev); } free_tmem_list = NULL; INIT_LIST(&global_blk_list, next, prev); tmems_allocated = 0; // Map all of the spds we can into this component for (i = 0 ; i < MAX_NUM_SPDS ; i++) { spdid_t spdid = i; void *hp; hp = valloc_alloc(cos_spd_id(), cos_spd_id(), 1); spdid = cinfo_get_spdid(i); if (!spdid) break; if(cinfo_map(cos_spd_id(), (vaddr_t)hp, spdid)){ DOUT("Could not map cinfo page for %d\n", spdid); BUG(); } /* spd_tmem_info_list[spdid].ci = hp; */ spd_tmem_info_list[spdid].ci.spd_cinfo_page = hp; /* spd_tmem_info_list[spdid].spd_cinfo_page = hp; */ spd_tmem_info_list[spdid].ci.meta = NULL; spd_tmem_info_list[spdid].managed = 1; spd_tmem_info_list[spdid].relinquish_mark = 0; tmems_target += DEFAULT_TARGET_ALLOC; spd_tmem_info_list[spdid].num_allocated = 0; spd_tmem_info_list[spdid].num_desired = DEFAULT_TARGET_ALLOC; spd_tmem_info_list[spdid].num_blocked_thds = 0; spd_tmem_info_list[spdid].num_waiting_thds = 0; spd_tmem_info_list[spdid].num_glb_blocked = 0; spd_tmem_info_list[spdid].ss_counter = 0; spd_tmem_info_list[spdid].ss_max = MAX_NUM_MEM; empty_comps++; } over_quota_total = 0; over_quota_limit = MAX_NUM_MEM; event_waiting(); return; }