Changeset 35285fd


Ignore:
Timestamp:
Jan 12, 2021, 1:10:41 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
481ee28
Parents:
d48b174
Message:

Refactor sqe reclamation to systematically thrash the sqe in debug

Location:
libcfa/src/concurrency
Files:
3 edited

Legend:

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

    rd48b174 r35285fd  
    195195        static unsigned __collect_submitions( struct __io_data & ring );
    196196        static __u32 __release_consumed_submission( struct __io_data & ring );
     197        static inline void __clean( volatile struct io_uring_sqe * sqe );
    197198
    198199        // Process a single completion message from the io_uring
     
    746747
    747748                        /* paranoid */ verify( 0 != ring.submit_q.sqes[ idx ].user_data );
    748                         ring.submit_q.sqes[ idx ].user_data = 3ul64;
     749                        __clean( &ring.submit_q.sqes[ idx ] );
    749750                }
    750751                return count;
    751752        }
     753
     754        void __sqe_clean( volatile struct io_uring_sqe * sqe ) {
     755                __clean( sqe );
     756        }
     757
     758        static inline void __clean( volatile struct io_uring_sqe * sqe ) {
     759                // If we are in debug mode, thrash the fields to make sure we catch reclamation errors
     760                __cfaabi_dbg_debug_do(
     761                        memset(sqe, 0xde, sizeof(*sqe));
     762                        sqe->opcode = IORING_OP_LAST;
     763                );
     764
     765                // Mark the entry as unused
     766                __atomic_store_n(&sqe->user_data, 3ul64, __ATOMIC_SEQ_CST);
     767        }
    752768#endif
  • libcfa/src/concurrency/io/setup.cfa

    rd48b174 r35285fd  
    382382                        abort("KERNEL ERROR: IO_URING MMAP3 - %s\n", strerror(errno));
    383383                }
    384                 memset(sq.sqes, 0xde, size);
    385 
    386                 verify( 0 != (params.features & IORING_FEAT_NODROP) );
    387384
    388385                // Step 3 : Initialize the data structure
  • libcfa/src/concurrency/io/types.hfa

    rd48b174 r35285fd  
    134134        void __ioctx_register($io_ctx_thread & ctx);
    135135        void __ioctx_prepare_block($io_ctx_thread & ctx);
     136        void __sqe_clean( volatile struct io_uring_sqe * sqe );
    136137#endif
    137138
Note: See TracChangeset for help on using the changeset viewer.