Ignore:
Timestamp:
Nov 29, 2021, 12:50:31 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
a1f3d93
Parents:
ddd2ec9
Message:

Fix implementation of io_uring_enter instead of eventfds.

File:
1 edited

Legend:

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

    rddd2ec9 rc7b2215  
    125125static void __wake_one(cluster * cltr);
    126126
    127 static void idle_sleep(processor * proc, io_future_t & future, char buf[]);
     127static void idle_sleep(processor * proc, io_future_t & future, eventfd_t & val);
    128128static bool mark_idle (__cluster_proc_list & idles, processor & proc);
    129129static void mark_awake(__cluster_proc_list & idles, processor & proc);
     
    131131extern void __cfa_io_start( processor * );
    132132extern bool __cfa_io_drain( processor * );
    133 extern bool __cfa_io_flush( processor *, bool wait );
     133extern bool __cfa_io_flush( processor *, int min_comp );
    134134extern void __cfa_io_stop ( processor * );
    135135static inline bool __maybe_io_drain( processor * );
     
    169169        io_future_t future; // used for idle sleep when io_uring is present
    170170        future.self.ptr = 1p;  // mark it as already fulfilled so we know if there is a pending request or not
    171         char buf[sizeof(uint64_t)];
     171        eventfd_t idle_val;
    172172
    173173        __cfa_io_start( this );
     
    204204
    205205                        if( !readyThread ) {
    206                                 __cfa_io_flush( this, false );
     206                                __cfa_io_flush( this, 0 );
    207207
    208208                                readyThread = __next_thread_slow( this->cltr );
     
    235235                                }
    236236
    237                                 idle_sleep( this, future, buf );
     237                                idle_sleep( this, future, idle_val );
    238238
    239239                                // We were woken up, remove self from idle
     
    256256
    257257                        if(this->io.pending && !this->io.dirty) {
    258                                 __cfa_io_flush( this, false );
     258                                __cfa_io_flush( this, 0 );
    259259                        }
    260260
     
    272272
    273273                                // If we can't find a thread, might as well flush any outstanding I/O
    274                                 if(this->io.pending) { __cfa_io_flush( this, false ); }
     274                                if(this->io.pending) { __cfa_io_flush( this, 0 ); }
    275275
    276276                                // Spin a little on I/O, just in case
     
    367367
    368368                        if(this->io.pending && !this->io.dirty) {
    369                                 __cfa_io_flush( this, false );
     369                                __cfa_io_flush( this, 0 );
    370370                        }
    371371
     
    777777}
    778778
    779 static void idle_sleep(processor * this, io_future_t & future, char buf[]) {
     779static void idle_sleep(processor * this, io_future_t & future, eventfd_t & val) {
    780780        #if !defined(IO_URING_IDLE) || !defined(CFA_HAVE_LINUX_IO_URING_H)
    781781                #if !defined(__CFA_NO_STATISTICS__)
     
    819819                        reset(future);
    820820
    821                         __kernel_read(this, future, buf, this->idle_fd );
    822                 }
    823 
    824                 __cfa_io_flush( this, true );
     821                        __kernel_read(this, future, (char *)&val, this->idle_fd );
     822                }
     823
     824                __cfa_io_flush( this, 1 );
    825825        #endif
    826826}
Note: See TracChangeset for help on using the changeset viewer.