Ignore:
File:
1 edited

Legend:

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

    r20ab637 r5751a56  
    1616#if defined(__CFA_DEBUG__)
    1717        // #define __CFA_DEBUG_PRINT_IO__
    18         #define __CFA_DEBUG_PRINT_IO_CORE__
     18        // #define __CFA_DEBUG_PRINT_IO_CORE__
    1919#endif
    2020
     
    2222#include "bitmanip.hfa"
    2323
    24 #if !defined(HAVE_LINUX_IO_URING_H)
     24#if !defined(CFA_HAVE_LINUX_IO_URING_H)
    2525        void __kernel_io_startup( cluster &, unsigned, bool ) {
    2626                // Nothing to do without io_uring
     
    218218                        // adjust the size according to the parameters
    219219                        if ((params.features & IORING_FEAT_SINGLE_MMAP) != 0) {
    220                                 cq->ring_sz = sq->ring_sz = max(cq->ring_sz, sq->ring_sz);
     220                                cq.ring_sz = sq.ring_sz = max(cq.ring_sz, sq.ring_sz);
    221221                        }
    222222                #endif
     
    232232                        // mmap the Completion Queue into existence (may or may not be needed)
    233233                        if ((params.features & IORING_FEAT_SINGLE_MMAP) != 0) {
    234                                 cq->ring_ptr = sq->ring_ptr;
     234                                cq.ring_ptr = sq.ring_ptr;
    235235                        }
    236236                        else
     
    490490        static uint32_t __release_consumed_submission( struct __io_data & ring );
    491491
     492        static inline void process(struct io_uring_cqe & cqe, struct __processor_id_t * id ) {
     493                struct __io_user_data_t * data = (struct __io_user_data_t *)(uintptr_t)cqe.user_data;
     494                __cfadbg_print_safe( io, "Kernel I/O : Syscall completed : cqe %p, result %d for %p\n", data, cqe.res, data->thrd );
     495
     496                data->result = cqe.res;
     497                if(!id) { unpark(     data->thrd __cfaabi_dbg_ctx2 ); }
     498                else  { __unpark( id, data->thrd __cfaabi_dbg_ctx2 ); }
     499        }
     500
    492501        // Process a single completion message from the io_uring
    493502        // This is NOT thread-safe
    494503        static [int, bool] __drain_io( & struct __io_data ring, * sigset_t mask ) {
    495504                /* paranoid */ verify( !kernelTLS.preemption_state.enabled );
    496                 const uint32_t smask = *ring.submit_q.mask;
    497505
    498506                unsigned to_submit = 0;
     
    539547                        /* paranoid */ verify(&cqe);
    540548
    541                         struct __io_user_data_t * data = (struct __io_user_data_t *)(uintptr_t)cqe.user_data;
    542                         __cfadbg_print_safe( io, "Kernel I/O : Performed reading io cqe %p, result %d for %p\n", data, cqe.res, data->thrd );
    543 
    544                         data->result = cqe.res;
    545                         if(!mask) { unpark( data->thrd __cfaabi_dbg_ctx2 ); }
    546                         else      { __unpark( &ring.poller.slow.id, data->thrd __cfaabi_dbg_ctx2 ); }
     549                        process( cqe, !mask ? (struct __processor_id_t *)0p : &ring.poller.slow.id );
    547550                }
    548551
Note: See TracChangeset for help on using the changeset viewer.