Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2314 → Rev 2315

/branches/rcu/kernel/generic/src/synch/rcu.c
95,9 → 95,10
waitq_t *wq = malloc(sizeof(waitq_t),0);
waitq_initialize(wq);
rcu_sync_callback(&rcu_synchronize_callback_function, wq);
printf("going to sleep\n");
printf("going to sleep, tlock:%x, wqlock:%x\n", THREAD->lock.val, wq->lock.val);
waitq_sleep(wq);
printf("woken up\n");
free(wq);
#endif
}
 
104,8 → 105,13
#ifdef CONFIG_SMP
void rcu_synchronize_callback_function(void* waitq)
{
printf("waking up\n");
waitq_wakeup(((waitq_t*)waitq), WAKEUP_ALL_INC_MISSED);
printf("waking up, wq:%x, wq->head:%x, next:%x, tlock:%x, wqlock:%x\n",
waitq,
((waitq_t*)waitq)->head,
((link_t)((waitq_t*)waitq)->head).next,
THREAD->lock.val,
((waitq_t*)waitq)->lock.val );
waitq_wakeup(((waitq_t*)waitq), WAKEUP_ALL);
}
#endif
 
120,8 → 126,10
rd->func = func;
rd->data = data;
rd->next = NULL;
 
printf("synccallback locking \n");
spinlock_lock(&rcu_global_lock);
 
rd->next = _rcu_global->next_batch;
_rcu_global->next_batch = rd;
 
171,19 → 179,18
} else
_rcu_global->done_batch = _rcu_global->current_batch;
printf("setting callback %x as done\n",&_rcu_global->current_batch->func);
_rcu_global->current_batch = NULL;
_rcu_global->current_batch = _rcu_global->next_batch;
_rcu_global->next_batch = NULL;
#ifdef CONFIG_SMP
 
for (i=0;i<config.cpu_count;i++)
_rcu_global->cpu_mask[i]=false;
#endif
//we've surely passed the quiescent point just by running this method
rcu_passQS();
}
 
_rcu_global->current_batch = _rcu_global->next_batch;
_rcu_global->next_batch = NULL;
 
if (_rcu_global->current_batch == NULL) {
//there are no rcu callbacks registered, there is no need to monitor QS
printf("tasklet idle disabling \n");
// tasklet_disable(rcu_tasklet_desc);
spinlock_unlock(&rcu_global_lock);
} else
spinlock_unlock(&rcu_global_lock);
spinlock_unlock(&rcu_global_lock);
printf("tasklet unlocking \n");
}
 
199,15 → 206,16
rcu_callback_list_t* rd;
rcu_passQS();
if (_rcu_global->done_batch) {
printf(".");
printf("run callbacks locking\n");
spinlock_lock(&rcu_global_lock);
for (rd = _rcu_global->done_batch; rd; rd=rd->next) {
rd = _rcu_global->done_batch;
_rcu_global->done_batch = NULL;
spinlock_unlock(&rcu_global_lock);
printf("run callbacks unlocking\n");
for (; rd; rd=rd->next) {
printf("calling %x \n",&rd->func);
rd->func(&rd->data);
}
_rcu_global->done_batch = NULL;
spinlock_unlock(&rcu_global_lock);
printf(":");
}
}