Ignore:
Timestamp:
Aug 30, 2022, 6:30:32 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
4858a88
Parents:
a8dd247 (diff), 01ba701 (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

Location:
libcfa/src/concurrency
Files:
6 edited

Legend:

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

    ra8dd247 ra0dbf20  
    202202                struct io_context$ * ctx = cfa_io_allocate( &sqe, &idx, 1 );
    203203
     204                memset(sqe, 0, sizeof(*sqe));
    204205                sqe->opcode = IORING_OP_{op};
     206                sqe->flags = sflags;
    205207                sqe->user_data = (uintptr_t)&future;
    206                 sqe->flags = sflags;
    207                 sqe->ioprio = 0;
    208                 sqe->fd = 0;
    209                 sqe->off = 0;
    210                 sqe->addr = 0;
    211                 sqe->len = 0;
    212                 sqe->fsync_flags = 0;
    213                 sqe->__pad2[0] = 0;
    214                 sqe->__pad2[1] = 0;
    215                 sqe->__pad2[2] = 0;{body}
     208                {body}
    216209
    217210                asm volatile("": : :"memory");
  • libcfa/src/concurrency/io/setup.cfa

    ra8dd247 ra0dbf20  
    228228
    229229                #if !defined(CFA_WITH_IO_URING_IDLE)
     230                {
    230231                        // Step 4 : eventfd
    231232                        __cfadbg_print_safe(io_core, "Kernel I/O : registering %d for completion with ring %d\n", procfd, fd);
     
    237238
    238239                        __cfadbg_print_safe(io_core, "Kernel I/O : registered %d for completion with ring %d\n", procfd, fd);
    239                 #endif
    240 
     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
    241246                // #if defined(CFA_HAVE_IORING_REGISTER_IOWQ_MAX_WORKERS)
     247                // {
    242248                //      // Step 5 : max worker count
    243249                //      __cfadbg_print_safe(io_core, "Kernel I/O : lmiting max workers for ring %d\n", fd);
     
    252258
    253259                //      __cfadbg_print_safe(io_core, "Kernel I/O : lmited max workers for ring %d\n", fd);
     260                // }
    254261                // #endif
    255262
  • libcfa/src/concurrency/kernel/fwd.hfa

    ra8dd247 ra0dbf20  
    3535extern "C" {
    3636        extern "Cforall" {
    37                 extern __attribute__((aligned(64))) thread_local struct KernelThreadData {
     37                extern __attribute__((aligned(64))) _Thread_local struct KernelThreadData {
    3838                        struct thread$          * volatile this_thread;
    3939                        struct processor        * volatile this_processor;
  • libcfa/src/concurrency/kernel/private.hfa

    ra8dd247 ra0dbf20  
    8888#elif defined(CFA_HAVE_LINUX_RSEQ_H)
    8989        extern "Cforall" {
    90                 extern __attribute__((aligned(64))) thread_local volatile struct rseq __cfaabi_rseq;
     90                extern __attribute__((aligned(64))) _Thread_local volatile struct rseq __cfaabi_rseq;
    9191        }
    9292#else
  • libcfa/src/concurrency/kernel/startup.cfa

    ra8dd247 ra0dbf20  
    133133//-----------------------------------------------------------------------------
    134134// Global state
    135 thread_local struct KernelThreadData __cfaabi_tls __attribute__ ((tls_model ( "initial-exec" ))) @= {
     135_Thread_local struct KernelThreadData __cfaabi_tls __attribute__ ((tls_model ( "initial-exec" ))) @= {
    136136        NULL,                                                                                           // cannot use 0p
    137137        NULL,
     
    153153#elif defined(CFA_HAVE_LINUX_RSEQ_H)
    154154        extern "Cforall" {
    155                 __attribute__((aligned(64))) thread_local volatile struct rseq __cfaabi_rseq @= {
     155                __attribute__((aligned(64))) _Thread_local volatile struct rseq __cfaabi_rseq @= {
    156156                        .cpu_id : RSEQ_CPU_ID_UNINITIALIZED,
    157157                };
  • libcfa/src/concurrency/preemption.cfa

    ra8dd247 ra0dbf20  
    357357                        }
    358358                }
     359        }
     360
     361        // Check whether or not there is pending preemption
     362        // force_yield( __POLL_PREEMPTION ) if appropriate
     363        // return true if the thread was in an interruptable state
     364        // i.e. on a real processor and not in the kernel
     365        // (can return true even if no preemption was pending)
     366        bool poll_interrupts() libcfa_public {
     367                // Cache the processor now since interrupts can start happening after the atomic store
     368                processor   * proc = publicTLS_get( this_processor );
     369                if ( ! proc ) return false;
     370                if ( ! __preemption_enabled() ) return false;
     371
     372                with( __cfaabi_tls.preemption_state ){
     373                        // Signal the compiler that a fence is needed but only for signal handlers
     374                        __atomic_signal_fence(__ATOMIC_RELEASE);
     375                        if( proc->pending_preemption ) {
     376                                proc->pending_preemption = false;
     377                                force_yield( __POLL_PREEMPTION );
     378                        }
     379                }
     380
     381                return true;
    359382        }
    360383}
     
    643666// Kernel Signal Handlers
    644667//=============================================================================================
    645 __cfaabi_dbg_debug_do( static thread_local void * last_interrupt = 0; )
     668__cfaabi_dbg_debug_do( static _Thread_local void * last_interrupt = 0; )
    646669
    647670// Context switch signal handler
Note: See TracChangeset for help on using the changeset viewer.