benchmarks now working with 4 cores
This commit is contained in:
parent
6d065f8621
commit
236a207ce1
3 changed files with 36 additions and 55 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<num_ranks; ++j ) {
|
||||
if( (j == CORE_A) || (j == CORE_B) )
|
||||
if( !((j == 4) || (j == 2)/* || (j == CORE_B) */) )
|
||||
continue;
|
||||
|
||||
/* send noise mail */
|
||||
|
@ -456,23 +441,20 @@ int icc_mail_noise() {
|
|||
kprintf( "sending irq ... " );
|
||||
icc_send_gic_irq(j);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _IRQ_NOISE_
|
||||
/* read some mails */
|
||||
if( my_ue == CORE_B )
|
||||
continue;
|
||||
|
||||
|
||||
iRCCE_mail_check(iRCCE_MAILBOX_ALL);
|
||||
while( iRCCE_mail_recv(&recv_mail) == iRCCE_SUCCESS ) {
|
||||
iRCCE_mail_recv(&recv_mail);
|
||||
icc_mail_check_tag(recv_mail);
|
||||
iRCCE_mail_release(&recv_mail);
|
||||
if( recv_mail ) iRCCE_mail_release(&recv_mail);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
kprintf( "XXX XXX XXX" );
|
||||
do {
|
||||
iRCCE_mail_check(iRCCE_MAILBOX_ALL);
|
||||
res = iRCCE_mail_recv(&recv_mail);
|
||||
icc_mail_check_tag(recv_mail);
|
||||
if( recv_mail ) iRCCE_mail_release(&recv_mail);
|
||||
} while( res == iRCCE_SUCCESS );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue