fine tuning to increase the performance of the mailbox example
This commit is contained in:
parent
4b3efa14a3
commit
5cd3d7557a
3 changed files with 38 additions and 36 deletions
|
@ -39,12 +39,10 @@ typedef struct {
|
|||
|
||||
extern bootinfo_t* bootinfo;
|
||||
|
||||
/*
|
||||
#define ICC_TYPE_IP (1 << 0)
|
||||
#define ICC_TYPE_SVM (1 << 1)
|
||||
#define ICC_TYPE_PINGREQUEST (1 << 2)
|
||||
#define ICC_TYPE_PINGRESPONSE (1 << 3)
|
||||
*/
|
||||
#define ICC_TAG_IP 0
|
||||
#define ICC_TAG_SVM 1
|
||||
#define ICC_TAG_PINGREQUEST 2
|
||||
#define ICC_TAG_PINGRESPONSE 3
|
||||
|
||||
int icc_init(void);
|
||||
int icc_halt(void);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <metalsvm/stdio.h>
|
||||
#include <metalsvm/time.h>
|
||||
#include <metalsvm/processor.h>
|
||||
#include <metalsvm/tasks.h>
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
#include <asm/RCCE_lib.h>
|
||||
#endif
|
||||
|
@ -104,6 +105,8 @@ void udelay(uint32_t usecs)
|
|||
mb();
|
||||
end = rdtsc();
|
||||
diff = end > start ? end - start : start - end;
|
||||
if ((diff < deadline) && (deadline - diff > 50000))
|
||||
check_workqueues();
|
||||
} while(diff < deadline);
|
||||
}
|
||||
|
||||
|
|
|
@ -203,27 +203,25 @@ int icc_halt(void)
|
|||
icc_mail_check();
|
||||
|
||||
irq_nested_enable(flags);
|
||||
|
||||
NOP1;
|
||||
} while(do_send);
|
||||
|
||||
HALT;
|
||||
//HALT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define MAIL_MSG_SIZE 20
|
||||
uint64_t timer;
|
||||
|
||||
int icc_mail_ping( void )
|
||||
{
|
||||
uint32_t flags;
|
||||
uint64_t timer;
|
||||
int remote_rank = (my_ue+1)%2;
|
||||
|
||||
char send_buffer[MAIL_MSG_SIZE];
|
||||
int length = MAIL_MSG_SIZE;
|
||||
|
||||
if( my_ue ) {
|
||||
return 0;
|
||||
}
|
||||
if (my_ue)
|
||||
return -1;
|
||||
|
||||
kprintf( "Hello from mail_ping ... \n" );
|
||||
|
||||
|
@ -233,25 +231,16 @@ int icc_mail_ping( void )
|
|||
// start timer
|
||||
timer = rdtsc();
|
||||
|
||||
// start anylength send
|
||||
iRCCE_isend( send_buffer, -length, remote_rank, NULL );
|
||||
/* send ping request */
|
||||
iRCCE_mail_send(0, ICC_TAG_PINGREQUEST, 0, NULL, remote_rank);
|
||||
|
||||
// wait for response
|
||||
iRCCE_MAIL_HEADER* mail;
|
||||
do {
|
||||
iRCCE_mail_recv( &mail );
|
||||
} while( !mail );
|
||||
|
||||
// stop timer
|
||||
timer = rdtsc() - timer;
|
||||
NOP8;
|
||||
icc_send_irq(remote_rank);
|
||||
|
||||
if( mail->tag == 2 ) {
|
||||
kprintf( "Response received in %d ticks!\n", timer );
|
||||
}
|
||||
else {
|
||||
kprintf( "Response didn't arrive!\n" );
|
||||
}
|
||||
/* check for incoming messages */
|
||||
icc_mail_check();
|
||||
|
||||
// enable interrupts
|
||||
irq_nested_enable(flags);
|
||||
|
||||
return 0;
|
||||
|
@ -261,21 +250,33 @@ void icc_mail_check(void)
|
|||
{
|
||||
iRCCE_MAIL_HEADER* header = NULL;
|
||||
int res;
|
||||
char* recv_buffer;
|
||||
//char* recv_buffer;
|
||||
|
||||
// empty mailbox and interpret headers
|
||||
while( (res = iRCCE_mail_recv( &header )) == iRCCE_SUCCESS ) {
|
||||
if( header->tag == 1 ) {
|
||||
iRCCE_mail_send( 0, 2, 0, NULL, header->source );
|
||||
}
|
||||
else if( header->tag == iRCCE_ANYLENGTH ) {
|
||||
switch(header->tag)
|
||||
{
|
||||
case ICC_TAG_PINGREQUEST:
|
||||
iRCCE_mail_send( 0, ICC_TAG_PINGRESPONSE, 0, NULL, header->source );
|
||||
NOP8;
|
||||
icc_send_irq( header->source );
|
||||
break;
|
||||
case ICC_TAG_PINGRESPONSE:
|
||||
timer = rdtsc() - timer;
|
||||
kprintf( "Response received in %d ticks!\n", timer );
|
||||
break;
|
||||
default:
|
||||
kprintf("Invalid mail: tag = %d\n", header->tag);
|
||||
break;
|
||||
}
|
||||
/*else if( header->tag == iRCCE_ANYLENGTH ) {
|
||||
recv_buffer = (char*)kmalloc( header->size );
|
||||
iRCCE_irecv( recv_buffer, header->size, header->source, NULL );
|
||||
iRCCE_mail_send( 0, 2, 0, NULL, header->source );
|
||||
}
|
||||
else if( header->tag == iRCCE_ANYLENGTH_PIGGYBACK ) {
|
||||
iRCCE_mail_send( 0, 2, 0, NULL, header->source );
|
||||
}
|
||||
}*/
|
||||
|
||||
iRCCE_mail_release( &header );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue