From 236a207ce1dfe4d4710570d9bd02c14c841c7817 Mon Sep 17 00:00:00 2001 From: Simon Pickartz Date: Sun, 28 Aug 2011 07:09:04 -0700 Subject: [PATCH] benchmarks now working with 4 cores --- arch/x86/include/asm/iRCCE.h | 13 +++++--- arch/x86/scc/iRCCE_mailbox.c | 16 ++++------ arch/x86/scc/icc.c | 62 +++++++++++++----------------------- 3 files changed, 36 insertions(+), 55 deletions(-) diff --git a/arch/x86/include/asm/iRCCE.h b/arch/x86/include/asm/iRCCE.h index 7300065c..9a3d7417 100644 --- a/arch/x86/include/asm/iRCCE.h +++ b/arch/x86/include/asm/iRCCE.h @@ -44,11 +44,14 @@ // status codes #define iRCCE_ERROR_ID RCCE_ERROR_ID -#define iRCCE_MAILBOX_OPEN -1 -#define iRCCE_MAILBOX_CLOSED -2 -#define iRCCE_MAILBOX_INVALID -3 -#define iRCCE_MAILBOX_EMPTY -4 -#define iRCCE_LAST_MAILS_NOT_RECV -5 +#define iRCCE_ERROR_TARGET RCCE_ERROR_TARGET +#define iRCCE_ERROR_SOURCE RCCE_ERROR_SOURCE +#define iRCCE_ERROR_GENERAL -1 +#define iRCCE_MAILBOX_OPEN -2 +#define iRCCE_MAILBOX_CLOSED -3 +#define iRCCE_MAILBOX_INVALID -4 +#define iRCCE_MAILBOX_EMPTY -5 +#define iRCCE_LAST_MAILS_NOT_RECV -6 // iRCCE-mailbox-system tags #define iRCCE_LAST_MAIL -1 diff --git a/arch/x86/scc/iRCCE_mailbox.c b/arch/x86/scc/iRCCE_mailbox.c index 3c13b801..b311970d 100644 --- a/arch/x86/scc/iRCCE_mailbox.c +++ b/arch/x86/scc/iRCCE_mailbox.c @@ -182,7 +182,6 @@ static int iRCCE_mailbox_check() { // only check open mailboxes if( iRCCE_mailbox_status[i] == iRCCE_MAILBOX_OPEN ) { - RC_cache_invalidate(); if( iRCCE_mailbox_recv[i]->sent ) { iRCCE_mail_fetch(i); @@ -193,10 +192,9 @@ static int iRCCE_mailbox_check() { } } } - + /* enable interrupts */ irq_nested_enable(flags); - return iRCCE_SUCCESS; } @@ -225,7 +223,7 @@ int iRCCE_mail_check(int sender) { // verify sender's ID if( (sender < 0) || (sender > RCCE_NP) || (sender == RCCE_IAM) ) { - return iRCCE_ERROR_ID; + return iRCCE_ERROR_SOURCE; } // check if mailbox is open @@ -393,20 +391,18 @@ int iRCCE_mail_send( int dest // UE that will receive the header ) { uint32_t flags; - int i; - // check for an attempt to send to own mailbox - if( dest == RCCE_IAM ) { - return iRCCE_MAILBOX_INVALID; + // verify sender's ID + if( (dest < 0) || (dest > RCCE_NP) || (dest == RCCE_IAM) ) { + return iRCCE_ERROR_TARGET; } // if dest mailbox is full, check for incoming mail RC_cache_invalidate(); while( iRCCE_mailbox_send[dest]->sent ) { - //iRCCE_mailbox_check(); + iRCCE_mailbox_check(); RC_cache_invalidate(); } - // check if mailbox is closed RCCE_acquire_lock( dest ); RC_cache_invalidate(); diff --git a/arch/x86/scc/icc.c b/arch/x86/scc/icc.c index f3c314ec..ac1cd589 100644 --- a/arch/x86/scc/icc.c +++ b/arch/x86/scc/icc.c @@ -238,9 +238,9 @@ int icc_halt(void) return 0; } -#define ROUNDS 10000 +#define ROUNDS 100000 #define CORE_A 0 // sender -#define CORE_B 4 // receiver +#define CORE_B 1 // receiver int icc_send_gic_irq(int core_num) { @@ -265,12 +265,8 @@ int icc_irq_ping() static inline void icc_mail_check_tag(iRCCE_MAIL_HEADER* mail) { char* recv_buffer; - static int i = 0; - if( !mail ) { - kprintf( "NO MAIL + "); - return; - } + if( !mail ) return; switch( mail->tag ) { case iRCCE_ANYLENGTH: @@ -280,8 +276,6 @@ static inline void icc_mail_check_tag(iRCCE_MAIL_HEADER* mail) { break; case PING_REQ: - ++i; - if( !(i%1000) ) kprintf( "PingReq%d ", i ); iRCCE_mail_send(0, PING_RESP, 0, NULL, mail->source); break; @@ -324,15 +318,8 @@ int icc_mail_ping( void ) res = iRCCE_mail_check(CORE_B); } while( res != iRCCE_SUCCESS ); - recv_header = NULL; - /* release mail */ - do { - if( recv_header ) iRCCE_mail_release(&recv_header); - res = iRCCE_mail_recv(&recv_header); - } while( (recv_header->source != CORE_B) - && (recv_header->tag == PING_RESP) ); - /* release mail */ + iRCCE_mail_recv(&recv_header); iRCCE_mail_release(&recv_header); } /* receivers part */ @@ -341,12 +328,10 @@ int icc_mail_ping( void ) do { res = iRCCE_mail_check(CORE_A); } while( res != iRCCE_SUCCESS ); - - res = iRCCE_mail_recv(&recv_header); - if( (res == iRCCE_SUCCESS) && (recv_header->tag = PING_REQ) ); - /* send response */ - iRCCE_mail_send(0, PING_RESP, 0, NULL, recv_header->source); + /* check mail */ + res = iRCCE_mail_recv(&recv_header); + icc_mail_check_tag(recv_header); /* release mail */ iRCCE_mail_release(&recv_header); @@ -363,8 +348,8 @@ int icc_mail_ping( void ) if( my_ue == CORE_A ) { kprintf( "timer = %ld\n", timer ); - kprintf( "mail_pingpong needs in average %d msec (%d ticks)!\n", - timer/(2*ROUNDS*533), timer/(2*ROUNDS) ); + kprintf( "mail_pingpong needs in average %d ns (%d ticks)!\n", + timer*1000/(2*ROUNDS*533), timer/(2*ROUNDS) ); } irq_nested_enable(flags); @@ -434,7 +419,7 @@ int icc_mail_noise() { int flags; // leave function if not participating - if( (my_ue == CORE_A) /*|| (my_ue == CORE_B)*/ ) { + if( !((my_ue == 4) || (my_ue == 2) || (my_ue == CORE_B)) ) { kprintf( "mail_noise: leaving" ); return -1; } @@ -447,7 +432,7 @@ int icc_mail_noise() { if( !(i%1000) ) kprintf( "%d ", i ); /* send a mail to each UE */ for( j=0; j