Changeset 601 for trunk/kernel/kern/chdev.c
- Timestamp:
- Dec 3, 2018, 12:15:01 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/chdev.c
r593 r601 175 175 if( (is_rx) && (DEBUG_CHDEV_CMD_RX < rx_cycle) ) 176 176 printk("\n[%s] client[%x,%x] enter for RX / server[%x,%x] / cycle %d\n", 177 __FUNCTION__, this->process->pid, this->trdid, server_ptr->process->pid, server_ptr->trdid, rx_cycle ); 177 __FUNCTION__, this->process->pid, this->trdid, 178 server_ptr->process->pid, server_ptr->trdid, rx_cycle ); 178 179 #endif 179 180 … … 182 183 if( (is_rx == 0) && (DEBUG_CHDEV_CMD_TX < tx_cycle) ) 183 184 printk("\n[%s] client[%x,%x] enter for TX / server[%x,%x] / cycle %d\n", 184 __FUNCTION__, this->process->pid, this->trdid, server_ptr->process->pid, server_ptr->trdid, tx_cycle ); 185 __FUNCTION__, this->process->pid, this->trdid, 186 server_ptr->process->pid, server_ptr->trdid, tx_cycle ); 185 187 #endif 186 188 … … 223 225 if( (is_rx == 0) && (DEBUG_CHDEV_CMD_TX < tx_cycle) ) 224 226 printk("\n[%s] client thread[%x,%x] blocked\n", 225 __FUNCTION__, this->process _pid, this->trdid );227 __FUNCTION__, this->process->pid, this->trdid ); 226 228 #endif 227 229 … … 341 343 uint32_t rx_cycle = (uint32_t)hal_get_cycles(); 342 344 if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) ) 343 printk("\n[%s] dev_thread[%x,%x] start RX / cycle %d\n",345 printk("\n[%s] thread[%x,%x] start RX / cycle %d\n", 344 346 __FUNCTION__ , server->process->pid, server->trdid, rx_cycle ); 345 347 #endif … … 348 350 uint32_t tx_cycle = (uint32_t)hal_get_cycles(); 349 351 if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) ) 350 printk("\n[%s] dev_thread[%x,%x] start TX / cycle %d\n",352 printk("\n[%s] thread[%x,%x] start TX / cycle %d\n", 351 353 __FUNCTION__ , server->process->pid, server->trdid, tx_cycle ); 352 354 #endif 355 356 // check server thread can yield 357 thread_assert_can_yield( server , __FUNCTION__ ); 353 358 354 359 // get the lock protecting the waiting queue … … 358 363 if( xlist_is_empty( root_xp ) ) // waiting queue empty 359 364 { 365 // release lock protecting the waiting queue 366 remote_busylock_release( lock_xp ); 360 367 361 368 #if DEBUG_CHDEV_SERVER_RX 362 369 rx_cycle = (uint32_t)hal_get_cycles(); 363 370 if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) ) 364 printk("\n[%s] dev_thread[%x,%x] found RX queue empty => blocks / cycle %d\n",371 printk("\n[%s] thread[%x,%x] found RX queue empty => blocks / cycle %d\n", 365 372 __FUNCTION__ , server->process->pid, server->trdid, rx_cycle ); 366 373 #endif … … 369 376 tx_cycle = (uint32_t)hal_get_cycles(); 370 377 if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) ) 371 printk("\n[%s] dev_thread[%x,%x] found TX queue empty => blocks / cycle %d\n",378 printk("\n[%s] thread[%x,%x] found TX queue empty => blocks / cycle %d\n", 372 379 __FUNCTION__ , server->process->pid, server->trdid, tx_cycle ); 373 380 #endif 374 375 // release lock376 remote_busylock_release( lock_xp );377 378 381 // block 379 382 thread_block( XPTR( local_cxy , server ) , THREAD_BLOCKED_IDLE ); 380 381 // check server thread can yield382 assert( (server->busylocks == 0),383 "cannot yield : busylocks = %d\n", server->busylocks );384 383 385 384 // deschedule … … 388 387 else // waiting queue not empty 389 388 { 389 // release lock protecting the waiting queue 390 remote_busylock_release( lock_xp ); 391 390 392 // get extended pointer on first client thread 391 393 client_xp = XLIST_FIRST( root_xp , thread_t , wait_list ); … … 395 397 client_ptr = GET_PTR( client_xp ); 396 398 397 // remove this first client thread from waiting queue 398 xlist_unlink( XPTR( client_cxy , &client_ptr->wait_list) );399 400 // release lock 401 remote_busylock_release( lock_xp ); 399 #if( DDEBUG_CHDEV_SERVER_TX || DEBUG_CHDEV_SERVER_RX ) 400 process_t * process = hal_remote_lpt( XPTR( client_cxy , &client_ptr->process ) ); 401 pid_t client_pid = hal_remote_l32( XPTR( client_cxy , &process->pid ) ); 402 process_t client_trdid = hal_remote_l32( XPTR( client_cxy , &client_ptr->trdid ) ); 403 #endif 402 404 403 405 #if DEBUG_CHDEV_SERVER_RX 404 406 rx_cycle = (uint32_t)hal_get_cycles(); 405 407 if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) ) 406 printk("\n[%s] dev_thread[%x,%x] for RX get client thread[%x,%x] / cycle %d\n", 407 __FUNCTION__, server->process->pid, server->trdid, 408 client_ptr->process->pid, client_ptr->trdid, rx_cycle ); 408 printk("\n[%s] thread[%x,%x] for RX get client thread[%x,%x] / cycle %d\n", 409 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle ); 409 410 #endif 410 411 … … 412 413 tx_cycle = (uint32_t)hal_get_cycles(); 413 414 if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) ) 414 printk("\n[%s] dev_thread[%x,%x] for TX get client thread[%x,%x] / cycle %d\n", 415 __FUNCTION__, server->process->pid, server->trdid, 416 client_ptr->process->pid, client_ptr->trdid, tx_cycle ); 415 printk("\n[%s] thread[%x,%x] for TX get client thread[%x,%x] / cycle %d\n", 416 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle ); 417 417 #endif 418 418 … … 425 425 #endif 426 426 427 // call driver command function to execute I/O operation 427 // call the (blocking) driver command function 428 // to launch I/O operation AND wait completion 428 429 chdev->cmd( client_xp ); 429 430 430 // unblock client thread 431 // unblock client thread when driver returns 431 432 thread_unblock( client_xp , THREAD_BLOCKED_IO ); 433 434 // get the lock protecting the waiting queue 435 remote_busylock_acquire( lock_xp ); 436 437 // remove this client thread from chdev waiting queue 438 xlist_unlink( XPTR( client_cxy , &client_ptr->wait_list ) ); 439 440 // release lock protecting the waiting queue 441 remote_busylock_release( lock_xp ); 432 442 433 443 #if DEBUG_CHDEV_SERVER_RX 434 444 rx_cycle = (uint32_t)hal_get_cycles(); 435 445 if( (chdev->is_rx) && (DEBUG_CHDEV_SERVER_RX < rx_cycle) ) 436 printk("\n[%s] dev_thread[%x,%x] completes RX for client thread[%x,%x] / cycle %d\n", 437 __FUNCTION__, server->process->pid, server->trdid, 438 client_ptr->process->pid, client_ptr->trdid, rx_cycle ); 446 printk("\n[%s] thread[%x,%x] completes RX for client thread[%x,%x] / cycle %d\n", 447 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle ); 439 448 #endif 440 449 … … 442 451 tx_cycle = (uint32_t)hal_get_cycles(); 443 452 if( (chdev->is_rx == 0) && (DEBUG_CHDEV_SERVER_TX < tx_cycle) ) 444 printk("\n[%s] dev_thread[%x,%x] completes TX for client thread[%x,%x] / cycle %d\n", 445 __FUNCTION__, server->process->pid, server->trdid, 446 client_ptr->process->pid, client_ptr->trdid, tx_cycle ); 453 printk("\n[%s] thread[%x,%x] completes TX for client thread[%x,%x] / cycle %d\n", 454 __FUNCTION__, server->process->pid, server->trdid, client_pid, client_trdid, cycle ); 447 455 #endif 448 456 … … 633 641 pid = hal_remote_l32 ( XPTR( thread_cxy , &process->pid ) ); 634 642 635 nolock_printk("- thread %X / cluster %X / trdid %X / pid %X\n", 636 thread_ptr, thread_cxy, trdid, pid ); 643 nolock_printk("- thread[%x,%x]\n", pid, trdid ); 637 644 } 638 645 }
Note: See TracChangeset
for help on using the changeset viewer.