Ignore:
Timestamp:
Mar 21, 2022, 1:44:06 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
a76202d
Parents:
ef3c383 (diff), dbe2533 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    ref3c383 rd672350  
    3939
    4040#else
     41#pragma GCC diagnostic push
     42#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
    4143        #include <errno.h>
    4244        #include <stdint.h>
     
    5658
    5759        #include "bitmanip.hfa"
    58         #include "kernel_private.hfa"
     60        #include "fstream.hfa"
     61        #include "kernel/private.hfa"
    5962        #include "thread.hfa"
     63#pragma GCC diagnostic pop
    6064
    6165        void ?{}(io_context_params & this) {
     
    111115                this.ext_sq.empty = true;
    112116                (this.ext_sq.queue){};
    113                 __io_uring_setup( this, cl.io.params, proc->idle_fd );
     117                __io_uring_setup( this, cl.io.params, proc->idle_wctx.evfd );
    114118                __cfadbg_print_safe(io_core, "Kernel I/O : Created ring for io_context %u (%p)\n", this.fd, &this);
    115119        }
     
    121125                __cfadbg_print_safe(io_core, "Kernel I/O : Destroyed ring for io_context %u\n", this.fd);
    122126        }
    123 
    124         extern void __disable_interrupts_hard();
    125         extern void __enable_interrupts_hard();
    126127
    127128        static void __io_uring_setup( $io_context & this, const io_context_params & params_in, int procfd ) {
     
    213214
    214215                // completion queue
     216                cq.lock      = 0;
    215217                cq.head      = (volatile __u32 *)(((intptr_t)cq.ring_ptr) + params.cq_off.head);
    216218                cq.tail      = (volatile __u32 *)(((intptr_t)cq.ring_ptr) + params.cq_off.tail);
     
    226228                        __cfadbg_print_safe(io_core, "Kernel I/O : registering %d for completion with ring %d\n", procfd, fd);
    227229
    228                         __disable_interrupts_hard();
    229 
    230230                        int ret = syscall( __NR_io_uring_register, fd, IORING_REGISTER_EVENTFD, &procfd, 1);
    231231                        if (ret < 0) {
    232232                                abort("KERNEL ERROR: IO_URING EVENTFD REGISTER - %s\n", strerror(errno));
    233233                        }
    234 
    235                         __enable_interrupts_hard();
    236234
    237235                        __cfadbg_print_safe(io_core, "Kernel I/O : registered %d for completion with ring %d\n", procfd, fd);
     
    258256                struct __sub_ring_t & sq = this.sq;
    259257                struct __cmp_ring_t & cq = this.cq;
     258                {
     259                        __u32 fhead = sq.free_ring.head;
     260                        __u32 ftail = sq.free_ring.tail;
     261
     262                        __u32 total = *sq.num;
     263                        __u32 avail = ftail - fhead;
     264
     265                        if(avail != total) abort | "Processor (" | (void*)this.proc | ") tearing down ring with" | (total - avail) | "entries allocated but not submitted, out of" | total;
     266                }
    260267
    261268                // unmap the submit queue entries
Note: See TracChangeset for help on using the changeset viewer.