Ignore:
File:
1 edited

Legend:

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

    r19cb0cb rbf0263c  
    2626
    2727#if !defined(CFA_HAVE_LINUX_IO_URING_H)
    28         void ?{}(io_context_params & this) libcfa_public {}
    29 
    30         void  ?{}(io_context$ & this, struct cluster & cl) {}
    31         void ^?{}(io_context$ & this) {}
     28        void ?{}(io_context_params & this) {}
     29
     30        void  ?{}($io_context & this, struct cluster & cl) {}
     31        void ^?{}($io_context & this) {}
    3232
    3333        void __cfa_io_start( processor * proc ) {}
     
    3737        void __cfa_io_stop ( processor * proc ) {}
    3838
    39         io_arbiter$ * create(void) { return 0p; }
    40         void destroy(io_arbiter$ *) {}
     39        $io_arbiter * create(void) { return 0p; }
     40        void destroy($io_arbiter *) {}
    4141
    4242#else
     
    6666#pragma GCC diagnostic pop
    6767
    68         void ?{}(io_context_params & this) libcfa_public {
     68        void ?{}(io_context_params & this) {
    6969                this.num_entries = 256;
    7070        }
     
    105105
    106106
    107         static void __io_uring_setup ( io_context$ & this, const io_context_params & params_in, int procfd );
    108         static void __io_uring_teardown( io_context$ & this );
    109         static void __epoll_register(io_context$ & ctx);
    110         static void __epoll_unregister(io_context$ & ctx);
    111         void __ioarbiter_register( io_arbiter$ & mutex, io_context$ & ctx );
    112         void __ioarbiter_unregister( io_arbiter$ & mutex, io_context$ & ctx );
    113 
    114         void ?{}(io_context$ & this, processor * proc, struct cluster & cl) {
     107        static void __io_uring_setup ( $io_context & this, const io_context_params & params_in, int procfd );
     108        static void __io_uring_teardown( $io_context & this );
     109        static void __epoll_register($io_context & ctx);
     110        static void __epoll_unregister($io_context & ctx);
     111        void __ioarbiter_register( $io_arbiter & mutex, $io_context & ctx );
     112        void __ioarbiter_unregister( $io_arbiter & mutex, $io_context & ctx );
     113
     114        void ?{}($io_context & this, processor * proc, struct cluster & cl) {
    115115                /* paranoid */ verify( cl.io.arbiter );
    116116                this.proc = proc;
     
    122122        }
    123123
    124         void ^?{}(io_context$ & this) {
     124        void ^?{}($io_context & this) {
    125125                __cfadbg_print_safe(io_core, "Kernel I/O : tearing down io_context %u\n", this.fd);
    126126
     
    129129        }
    130130
    131         static void __io_uring_setup( io_context$ & this, const io_context_params & params_in, int procfd ) {
     131        static void __io_uring_setup( $io_context & this, const io_context_params & params_in, int procfd ) {
    132132                // Step 1 : call to setup
    133133                struct io_uring_params params;
     
    228228
    229229                #if !defined(CFA_WITH_IO_URING_IDLE)
    230                 {
    231230                        // Step 4 : eventfd
     231                        // io_uring_register is so f*cking slow on some machine that it
     232                        // will never succeed if preemption isn't hard blocked
    232233                        __cfadbg_print_safe(io_core, "Kernel I/O : registering %d for completion with ring %d\n", procfd, fd);
    233234
     
    238239
    239240                        __cfadbg_print_safe(io_core, "Kernel I/O : registered %d for completion with ring %d\n", procfd, fd);
    240                 }
    241                 #endif
    242 
    243                 // TODO: implement a proper version of this.
    244                 // I have not found a better maximum that works in general but users should be able to configure it
    245                 // the same way they configure other I/O options
    246                 // #if defined(CFA_HAVE_IORING_REGISTER_IOWQ_MAX_WORKERS)
    247                 // {
    248                 //      // Step 5 : max worker count
    249                 //      __cfadbg_print_safe(io_core, "Kernel I/O : lmiting max workers for ring %d\n", fd);
    250 
    251                 //      unsigned int maxes[2];
    252                 //      maxes[0] = 64; // max number of bounded workers (Regular files / block)
    253                 //      maxes[1] = 64;  // max number of unbounded workers (IOSQE_ASYNC)
    254                 //      int ret = syscall( __NR_io_uring_register, fd, IORING_REGISTER_IOWQ_MAX_WORKERS, maxes, 2);
    255                 //      if (ret < 0) {
    256                 //              abort("KERNEL ERROR: IO_URING MAX WORKER REGISTER - %s\n", strerror(errno));
    257                 //      }
    258 
    259                 //      __cfadbg_print_safe(io_core, "Kernel I/O : lmited max workers for ring %d\n", fd);
    260                 // }
    261                 // #endif
     241                #endif
    262242
    263243                // some paranoid checks
     
    277257        }
    278258
    279         static void __io_uring_teardown( io_context$ & this ) {
     259        static void __io_uring_teardown( $io_context & this ) {
    280260                // Shutdown the io rings
    281261                struct __sub_ring_t & sq = this.sq;
     
    320300// I/O Context Sleep
    321301//=============================================================================================
    322         // static inline void __epoll_ctl(io_context$ & ctx, int op, const char * error) {
     302        // static inline void __epoll_ctl($io_context & ctx, int op, const char * error) {
    323303        //      struct epoll_event ev;
    324304        //      ev.events = EPOLLIN | EPOLLONESHOT;
     
    330310        // }
    331311
    332         // static void __epoll_register(io_context$ & ctx) {
     312        // static void __epoll_register($io_context & ctx) {
    333313        //      __epoll_ctl(ctx, EPOLL_CTL_ADD, "ADD");
    334314        // }
    335315
    336         // static void __epoll_unregister(io_context$ & ctx) {
     316        // static void __epoll_unregister($io_context & ctx) {
    337317        //      // Read the current epoch so we know when to stop
    338318        //      size_t curr = __atomic_load_n(&iopoll.epoch, __ATOMIC_SEQ_CST);
     
    353333        // }
    354334
    355         // void __ioctx_prepare_block(io_context$ & ctx) {
     335        // void __ioctx_prepare_block($io_context & ctx) {
    356336        //      __cfadbg_print_safe(io_core, "Kernel I/O - epoll : Re-arming io poller %d (%p)\n", ctx.fd, &ctx);
    357337        //      __epoll_ctl(ctx, EPOLL_CTL_MOD, "REARM");
     
    362342// I/O Context Misc Setup
    363343//=============================================================================================
    364         void ?{}( io_arbiter$ & this ) {
     344        void ?{}( $io_arbiter & this ) {
    365345                this.pending.empty = true;
    366346        }
    367347
    368         void ^?{}( io_arbiter$ & mutex this ) {}
    369 
    370         io_arbiter$ * create(void) {
     348        void ^?{}( $io_arbiter & this ) {}
     349
     350        $io_arbiter * create(void) {
    371351                return new();
    372352        }
    373         void destroy(io_arbiter$ * arbiter) {
     353        void destroy($io_arbiter * arbiter) {
    374354                delete(arbiter);
    375355        }
Note: See TracChangeset for help on using the changeset viewer.