Пример #1
0
int main(int argc, char** argv)
{
	uint32_t vcoreid = vcore_id();
	int retval = 0;

	mcs_barrier_init(&b, max_vcores());

/* begin: stuff userspace needs to do before switching to multi-mode */
	vcore_lib_init();
	#if 0
	/* tell the kernel where and how we want to receive notifications */
	struct notif_method *nm;
	for (int i = 0; i < MAX_NR_NOTIF; i++) {
		nm = &__procdata.notif_methods[i];
		nm->flags |= NOTIF_WANTED | NOTIF_MSG | NOTIF_IPI;
		nm->vcoreid = i % 2; // vcore0 or 1, keepin' it fresh.
	}
	#endif
	/* Need to save this somewhere that you can find it again when restarting
	 * core0 */
	core0_tls = get_tls_desc(0);
	/* Need to save our floating point state somewhere (like in the
	 * user_thread_tcb so it can be restarted too */
/* end: stuff userspace needs to do before switching to multi-mode */

	/* get into multi mode */
	retval = vcore_request(1);
	if (retval)
		printf("F****d!\n");

	printf("Proc %d requesting another vcore\n", getpid());
	begin = read_tsc();
	retval = vcore_request(1);
	if (retval)
		printf("F****d!\n");
	while (!core1_up)
		cpu_relax;
	end = read_tsc();
	printf("Took %llu usec (%llu nsec) to receive 1 core (cold).\n",
	       udiff(begin, end), ndiff(begin, end));
	printf("[T]:002:%llu:%llu:1:C.\n",
	       udiff(begin, end), ndiff(begin, end));
	core1_up = FALSE;
	udelay(2000000);
	printf("Proc %d requesting the vcore again\n", getpid());
	begin = read_tsc();
	retval = vcore_request(1);
	if (retval)
		printf("F****d!\n");
	while (!core1_up)
		cpu_relax();
	end = read_tsc();
	printf("Took %llu usec (%llu nsec) to receive 1 core (warm).\n",
	       udiff(begin, end), ndiff(begin, end));
	printf("[T]:002:%llu:%llu:1:W.\n",
	       udiff(begin, end), ndiff(begin, end));
	return 0;
}
Пример #2
0
void
clean(uint16_t seq, int64_t now, void *v)
{
	int ttl;
	Req **l, *r;

	ttl = 0;
	if (v) {
		if (proto->version == 4)
			ttl = ((struct ip4hdr *)v)->ttl;
		else
			ttl = ((struct ip6hdr *)v)->ttl;
	}
	spin_pdr_lock(&listlock);
	last = NULL;
	for(l = &first; *l; ){
		r = *l;
		if(v && r->seq == seq){
			r->rtt = ndiff(r->tsctime, now);
			r->ttl = ttl;
			reply(r, v);
		}
		if (now - r->tsctime > MINUTETSC) {
			*l = r->next;
			r->rtt = ndiff(r->tsctime, now);
			if(v)
				r->ttl = ttl;
			if(r->replied == 0)
				lost(r, v);
			free(r);
		}else{
			last = r;
			l = &r->next;
		}
	}
	spin_pdr_unlock(&listlock);
}
Пример #3
0
 differential(long n, long order = 0) {  // 0 := quadratic, 1:= qubic
     ndiff(n, order);
 };
Пример #4
0
 differential2(long n, long order = 0) {
     ndiff(n, order);
 };