From 4c61e37fca3bd85a813449f019705e002a4e8a50 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Tue, 8 Nov 2011 01:03:27 -0800 Subject: [PATCH] first steps to realize a Lubachevsky barrier with flag --- arch/x86/mm/svm.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/x86/mm/svm.c b/arch/x86/mm/svm.c index 3b1afe81..ef29d687 100644 --- a/arch/x86/mm/svm.c +++ b/arch/x86/mm/svm.c @@ -37,8 +37,19 @@ #define SHARED_PAGES ((4*RCCE_SHM_SIZE_MAX) >> PAGE_SHIFT) #define OWNER_SIZE ((SHARED_PAGES * sizeof(uint8_t) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) +#define AIREG1 0 +#define AIREG2 (AIREG1 + 1) + t_vcharp RC_SHM_BUFFER_START(); +typedef struct { + int counter; + int initializer; +} atomic_increg_t; + +static volatile atomic_increg_t *incregs = NULL; +static RCCE_FLAG release; + /* * This array describes the owner of a specific page. * Only the owner of a page is able to change the possession. @@ -343,12 +354,26 @@ void svm_flush(void) int svm_barrier(uint32_t type) { + int i; + RCCE_COMM *comm = &RCCE_COMM_WORLD; + static int index = 0; + if (type == SVM_LAZYRELEASE) { svm_flush(); svm_invalidate(); } +#if 0 + index = !index; + if (incregs[AIREG1].counter > (comm->size - 2)) { + incregs[AIREG1].initializer = 0; + while(incregs[AIREG1].initializer); + for (i = 0; i < comm->size; i++) + RCCE_flag_write(&release, index, comm->member[i]); + } else RCCE_wait_until(release, index); +#else RCCE_barrier(&RCCE_COMM_WORLD); +#endif return 0; }