From 47deea941aa461c7e358f434baf792360e9034b7 Mon Sep 17 00:00:00 2001 From: Simon Pickartz Date: Sun, 21 Aug 2011 11:38:09 -0700 Subject: [PATCH] remove debug printfs --- arch/x86/scc/icc.c | 64 ++++++++++++++++++++++------------------------ kernel/init.c | 6 +---- kernel/main.c | 1 - 3 files changed, 32 insertions(+), 39 deletions(-) diff --git a/arch/x86/scc/icc.c b/arch/x86/scc/icc.c index 85910a9a..55372f2a 100644 --- a/arch/x86/scc/icc.c +++ b/arch/x86/scc/icc.c @@ -228,7 +228,7 @@ int icc_halt(void) return 0; } -#define ROUNDS 10000 +#define ROUNDS 1000 #define CORE_A 0 // sender #define CORE_B 1 // receiver @@ -255,7 +255,7 @@ int icc_irq_ping() static inline void icc_mail_check_tag(iRCCE_MAIL_HEADER* mail) { char* recv_buffer; - + static int count = 0; switch( mail->tag ) { case iRCCE_ANYLENGTH: recv_buffer = (char*)kmalloc( mail->size ); @@ -264,6 +264,8 @@ static inline void icc_mail_check_tag(iRCCE_MAIL_HEADER* mail) { break; case PING_REQ: +// kprintf( "%d ", count ); + count++; iRCCE_mail_send(0, PING_RESP, 0, NULL, mail->source); break; @@ -298,16 +300,19 @@ int icc_mail_ping( void ) if( my_ue == CORE_A ) { /* send ping request */ iRCCE_mail_send(0, PING_REQ, 0, NULL, CORE_B); - + /* wait for response */ do { + 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); - if( res == iRCCE_SUCCESS ) { - if( recv_header->source == CORE_B ) - break; - iRCCE_mail_release(&recv_header); - } - } while( 1 ); + } while( (recv_header->source != CORE_B) + && (recv_header->tag == PING_RESP) ); /* release mail */ iRCCE_mail_release(&recv_header); @@ -316,13 +321,11 @@ int icc_mail_ping( void ) else { /* wait for request */ do { - res = iRCCE_mail_recv(&recv_header); - if( res == iRCCE_SUCCESS ) { - if( recv_header->tag == PING_REQ ) - break; - iRCCE_mail_release(&recv_header); - } - } while( 1 ); + 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); @@ -358,28 +361,27 @@ int icc_mail_ping_irq( void ) if( my_ue != CORE_A ) return 0; uint32_t flags; uint64_t timer = 0; - int rem_rank = CORE_B; int i; int res; iRCCE_MAIL_HEADER* recv_header = NULL; kprintf( "Hello from mail_ping_irq ... \n" ); kprintf( "my_rank = %d\n", my_ue ); - kprintf( "rem_rank = %d\n", rem_rank ); + kprintf( "rem_rank = %d\n", CORE_B ); kprintf( "rounds = %d\n", ROUNDS ); // disable interrupts flags = irq_nested_disable(); for( i=0; isource != rem_rank) + } while( (recv_header->source != CORE_B) && (recv_header->tag == PING_RESP) ); @@ -418,7 +420,7 @@ int icc_mail_noise() { iRCCE_MAIL_HEADER* recv_mail = NULL; // leave function if not participating - if( (my_ue == CORE_A) /*|| (my_ue == CORE_B) */) { + if( (my_ue == CORE_A) /*(my_ue == CORE_B)*/ ) { return -1; } @@ -432,22 +434,19 @@ int icc_mail_noise() { /* recv mails */ iRCCE_mail_check(iRCCE_MAILBOX_ALL); - + + /* send noise mail */ iRCCE_mail_send(0, 100, 0, NULL, j); - res = iRCCE_mail_recv(&recv_mail); - if( res == iRCCE_SUCCESS ) { - icc_mail_check_tag(recv_mail); - iRCCE_mail_release(&recv_mail); - } - - } + /* read some mails */ for( res = iRCCE_mail_recv(&recv_mail), j=0; (res == iRCCE_SUCCESS) && (j<48); res = iRCCE_mail_recv(&recv_mail), ++j ) { icc_mail_check_tag(recv_mail); iRCCE_mail_release(&recv_mail); } + + kprintf( "x " ); } @@ -463,7 +462,7 @@ int icc_mail_noise() { void icc_mail_check(int irq) { iRCCE_MAIL_HEADER* header = NULL; - int source, i, res; + int source, res; volatile uint64_t* irq_status_reg = NULL; volatile uint64_t* irq_reset_reg = NULL; uint64_t irq_status = 0; @@ -473,7 +472,6 @@ void icc_mail_check(int irq) flags = irq_nested_disable(); if( irq == 1 ) { - kprintf( "got rem irq" ); /* read status register */ irq_status_reg = (volatile uint64_t*)(FPGA_BASE + IRQ_STATUS + my_ue*8); irq_status = *irq_status_reg; diff --git a/kernel/init.c b/kernel/init.c index 5bf0fbac..2d706944 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -217,14 +217,10 @@ static void list_root(void) { int initd(void* arg) { - kprintf("i1"); network_init(); - kprintf("i2"); list_root(); - kprintf("i3"); test_init(); - kprintf("i4"); - + return 0; } diff --git a/kernel/main.c b/kernel/main.c index 9df81676..57d7cbf8 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -83,7 +83,6 @@ int main(void) kprintf("Kernel starts at %p and ends at %p\n", &kernel_start, &kernel_end); system_calibration(); - kprintf("main3"); kprintf("Processor frequency: %u MHz\n", get_cpu_frequency()); kprintf("Total memory: %u MBytes\n", atomic_int32_read(&total_pages)/((1024*1024)/PAGE_SIZE)); kprintf("Current allocated memory: %u KBytes\n", atomic_int32_read(&total_allocated_pages)*(PAGE_SIZE/1024));