Changeset 732b406 for libcfa


Ignore:
Timestamp:
Jul 9, 2020, 3:37:03 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:
3a32b3a
Parents:
34b61882
Message:

Added missing lock around release_consumed_submission

File:
1 edited

Legend:

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

    r34b61882 r732b406  
    130130
    131131                __spinlock_t lock;
     132                __spinlock_t release_lock;
    132133
    133134                // A buffer of sqes (not the actual ring)
     
    270271
    271272                (sq.lock){};
     273                (sq.release_lock){};
    272274
    273275                if( io_flags & ( CFA_CLUSTER_IO_POLLER_THREAD_SUBMITS | CFA_CLUSTER_IO_EAGER_SUBMITS ) ) {
     
    836838                        __atomic_fetch_add(tail, 1ul32, __ATOMIC_SEQ_CST);
    837839
     840                        /* paranoid */ verify( ring.submit_q.sqes[ idx ].user_data != 0 );
     841
    838842                        // Submit however, many entries need to be submitted
    839843                        int ret = syscall( __NR_io_uring_enter, ring.fd, 1, 0, 0, 0p, 0);
     
    889893        static uint32_t __release_consumed_submission( struct __io_data & ring ) {
    890894                const uint32_t smask = *ring.submit_q.mask;
     895
     896                if( !try_lock(ring.submit_q.release_lock __cfaabi_dbg_ctx2) ) return 0;
    891897                uint32_t chead = *ring.submit_q.head;
    892898                uint32_t phead = ring.submit_q.prev_head;
    893899                ring.submit_q.prev_head = chead;
     900                unlock(ring.submit_q.release_lock);
     901
    894902                uint32_t count = chead - phead;
    895903                for( i; count ) {
Note: See TracChangeset for help on using the changeset viewer.