Ignore:
Timestamp:
May 1, 2020, 12:37:30 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
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
Message:

Fix error in benchmark where the wrong fd was used.
Changed behcnmark to use seperate cluster for I/O.
Changed some debug prints to use new versions with groups.
Fixed halting race condition leading to deadlock.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io.cfa

    r9987d79 r4069faad  
    1414//
    1515
     16// #define __CFA_DEBUG_PRINT_IO__
     17
    1618#include "kernel.hfa"
    1719
     
    210212        void __kernel_io_finish_start( cluster & this ) {
    211213                #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 };
    213216                        __thrd_start( this.io.poller.fast, main );
    214217                #endif
    215218
    216219                // Create the poller thread
     220                __cfadbg_print_safe(io, "Kernel I/O : Creating slow poller for cluter %p\n", &this);
    217221                this.io.poller.slow.stack = __create_pthread( &this.io.poller.slow.kthrd, __io_poller_slow, &this );
    218222        }
    219223
    220224        void __kernel_io_prepare_stop( cluster & this ) {
     225                __cfadbg_print_safe(io, "Kernel I/O : Stopping pollers for cluster\n", &this);
    221226                // Notify the poller thread of the shutdown
    222227                __atomic_store_n(&this.io.done, true, __ATOMIC_SEQ_CST);
     
    233238                free( this.io.poller.slow.stack );
    234239
     240                __cfadbg_print_safe(io, "Kernel I/O : Slow poller stopped for cluster\n", &this);
     241
    235242                #if defined(__CFA_IO_POLLING_USER__)
    236243                        // unpark the fast io_poller
     
    238245
    239246                        ^(this.io.poller.fast){};
     247
     248                        __cfadbg_print_safe(io, "Kernel I/O : Fast poller stopped for cluster\n", &this);
    240249                #endif
    241250        }
     
    324333
    325334                        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 );
    327336
    328337                        data->result = cqe.res;
     
    369378                                int count = __drain_io( ring, &mask, 1, true );
    370379                                if(count > 0) {
     380                                        __cfadbg_print_safe(io, "Kernel I/O : Moving to ring %p to fast poller\n", &ring);
    371381                                        __unpark( &ring.poller.fast.thrd __cfaabi_dbg_ctx2 );
    372382                                        wait( ring.poller.sem );
     
    398408                                else {
    399409                                        // 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);
    400411                                        post( this.ring->poller.sem );
    401412                                        park( __cfaabi_dbg_ctx );
     
    464475                // Submit however, many entries need to be submitted
    465476                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 );
    467477                if( ret < 0 ) {
    468478                        switch((int)errno) {
     
    481491                // Make sure that idx was submitted
    482492                // 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 );
    483494        }
    484495
Note: See TracChangeset for help on using the changeset viewer.