Changeset 4069faad for libcfa/src/concurrency/io.cfa
- Timestamp:
- May 1, 2020, 12:37:30 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d45ed83
- Parents:
- 9987d79
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r9987d79 r4069faad 14 14 // 15 15 16 // #define __CFA_DEBUG_PRINT_IO__ 17 16 18 #include "kernel.hfa" 17 19 … … 210 212 void __kernel_io_finish_start( cluster & this ) { 211 213 #if defined(__CFA_IO_POLLING_USER__) 212 (this.io.poller.fast){ this }; 214 __cfadbg_print_safe(io, "Kernel I/O : Creating fast poller for cluter %p\n", &this); 215 (this.io.poller.fast){ "Fast IO Poller", this }; 213 216 __thrd_start( this.io.poller.fast, main ); 214 217 #endif 215 218 216 219 // Create the poller thread 220 __cfadbg_print_safe(io, "Kernel I/O : Creating slow poller for cluter %p\n", &this); 217 221 this.io.poller.slow.stack = __create_pthread( &this.io.poller.slow.kthrd, __io_poller_slow, &this ); 218 222 } 219 223 220 224 void __kernel_io_prepare_stop( cluster & this ) { 225 __cfadbg_print_safe(io, "Kernel I/O : Stopping pollers for cluster\n", &this); 221 226 // Notify the poller thread of the shutdown 222 227 __atomic_store_n(&this.io.done, true, __ATOMIC_SEQ_CST); … … 233 238 free( this.io.poller.slow.stack ); 234 239 240 __cfadbg_print_safe(io, "Kernel I/O : Slow poller stopped for cluster\n", &this); 241 235 242 #if defined(__CFA_IO_POLLING_USER__) 236 243 // unpark the fast io_poller … … 238 245 239 246 ^(this.io.poller.fast){}; 247 248 __cfadbg_print_safe(io, "Kernel I/O : Fast poller stopped for cluster\n", &this); 240 249 #endif 241 250 } … … 324 333 325 334 struct io_user_data * data = (struct io_user_data *)cqe.user_data; 326 // __cfaabi_bits_print_safe( STDERR_FILENO, "Performed reading io cqe %p, result %d for %p\n", data, cqe.res, data->thrd );335 __cfadbg_print_safe( io, "Kernel I/O : Performed reading io cqe %p, result %d for %p\n", data, cqe.res, data->thrd ); 327 336 328 337 data->result = cqe.res; … … 369 378 int count = __drain_io( ring, &mask, 1, true ); 370 379 if(count > 0) { 380 __cfadbg_print_safe(io, "Kernel I/O : Moving to ring %p to fast poller\n", &ring); 371 381 __unpark( &ring.poller.fast.thrd __cfaabi_dbg_ctx2 ); 372 382 wait( ring.poller.sem ); … … 398 408 else { 399 409 // We didn't get anything baton pass to the slow poller 410 __cfadbg_print_safe(io, "Kernel I/O : Moving to ring %p to slow poller\n", &this.ring); 400 411 post( this.ring->poller.sem ); 401 412 park( __cfaabi_dbg_ctx ); … … 464 475 // Submit however, many entries need to be submitted 465 476 int ret = syscall( __NR_io_uring_enter, ring.fd, 1, 0, 0, 0p, 0); 466 // __cfaabi_bits_print_safe( STDERR_FILENO, "Performed io_submit, returned %d\n", ret );467 477 if( ret < 0 ) { 468 478 switch((int)errno) { … … 481 491 // Make sure that idx was submitted 482 492 // Be careful to not get false positive if we cycled the entire list or that someone else submitted for us 493 __cfadbg_print_safe( io, "Kernel I/O : Performed io_submit for %p, returned %d\n", active_thread(), ret ); 483 494 } 484 495
Note: See TracChangeset
for help on using the changeset viewer.