37,47 → 37,42 |
#include <arch.h> |
#include <config.h> |
#include <arch/types.h> |
#include <ddi/tasklet.h> |
#include <proc/tasklet.h> |
#include <synch/spinlock.h> |
#include <time/delay.h> |
#include <panic.h> |
#include <print.h> |
|
typedef struct rcu_global |
{ |
typedef struct { |
uint32_t current_batch; |
uint32_t completed_batch; |
bool next_batch_waiting; |
} rcu_global_t; |
|
typedef struct rcu_callback_list |
{ |
struct rcu_callback_list* next; |
void (*func)(void*); |
void* data; |
bool* cpu_mask; |
typedef struct rcu_callback_list { |
struct rcu_callback_list* next; |
void (*func)(void*); |
void* data; |
bool* cpu_mask; |
} rcu_callback_list_t; |
|
|
typedef struct rcu_percpu |
{ |
typedef struct { |
uint32_t current_batch_number; |
uint32_t QS_passed; |
bool QS_pending; |
|
rcu_callback_list_t* next_batch, *current_batch, *done_batch; |
rcu_callback_list_t* next_batch, *current_batch, *done_batch; |
} rcu_percpu_t; |
|
rcu_global_t _rcu_global; |
rcu_percpu_t* _rcu_cpu_lists; |
|
void rcu_init(void) |
void rcu_init(void) |
{ |
_rcu_cpu_lists = malloc(sizeof(rcu_percpu_t)*config.cpu_count,0); |
_rcu_global.completed_batch = -1; |
_rcu_global.current_batch = -1; |
_rcu_global.next_batch_waiting = -1; |
|
} |
|
void rcu_synchronize(void) |
97,7 → 92,7 |
{ |
int i; |
rcu_callback_list_t *rd; |
rd = malloc(sizeof(rcu_desc), 0); |
rd = malloc(sizeof(rcu_callback_list_t), 0); |
rd->func = func; |
rd->data = data; |
rd->next = NULL; |
110,11 → 105,9 |
_rcu_global.next_batch_waiting = true; |
|
rd->next = _rcu_cpu_lists[0].next_batch; |
for (i=0;i<config.cpu_count;i++) |
{ |
for (i=0;i<config.cpu_count;i++) { |
_rcu_cpu_lists[i].next_batch = rd; |
_rcu_cpu_lists[i].QS_pending = true; |
|
} |
|
//TODO:tasklet, after_thread_ran, polishing |