Changeset a0dbf20 for libcfa/src/concurrency
- Timestamp:
- Aug 30, 2022, 6:30:32 PM (3 years ago)
- 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. - Location:
- libcfa/src/concurrency
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io/call.cfa.in
ra8dd247 ra0dbf20 202 202 struct io_context$ * ctx = cfa_io_allocate( &sqe, &idx, 1 ); 203 203 204 memset(sqe, 0, sizeof(*sqe)); 204 205 sqe->opcode = IORING_OP_{op}; 206 sqe->flags = sflags; 205 207 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} 216 209 217 210 asm volatile("": : :"memory"); -
libcfa/src/concurrency/io/setup.cfa
ra8dd247 ra0dbf20 228 228 229 229 #if !defined(CFA_WITH_IO_URING_IDLE) 230 { 230 231 // Step 4 : eventfd 231 232 __cfadbg_print_safe(io_core, "Kernel I/O : registering %d for completion with ring %d\n", procfd, fd); … … 237 238 238 239 __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 241 246 // #if defined(CFA_HAVE_IORING_REGISTER_IOWQ_MAX_WORKERS) 247 // { 242 248 // // Step 5 : max worker count 243 249 // __cfadbg_print_safe(io_core, "Kernel I/O : lmiting max workers for ring %d\n", fd); … … 252 258 253 259 // __cfadbg_print_safe(io_core, "Kernel I/O : lmited max workers for ring %d\n", fd); 260 // } 254 261 // #endif 255 262 -
libcfa/src/concurrency/kernel/fwd.hfa
ra8dd247 ra0dbf20 35 35 extern "C" { 36 36 extern "Cforall" { 37 extern __attribute__((aligned(64))) thread_local struct KernelThreadData {37 extern __attribute__((aligned(64))) _Thread_local struct KernelThreadData { 38 38 struct thread$ * volatile this_thread; 39 39 struct processor * volatile this_processor; -
libcfa/src/concurrency/kernel/private.hfa
ra8dd247 ra0dbf20 88 88 #elif defined(CFA_HAVE_LINUX_RSEQ_H) 89 89 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; 91 91 } 92 92 #else -
libcfa/src/concurrency/kernel/startup.cfa
ra8dd247 ra0dbf20 133 133 //----------------------------------------------------------------------------- 134 134 // 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" ))) @= { 136 136 NULL, // cannot use 0p 137 137 NULL, … … 153 153 #elif defined(CFA_HAVE_LINUX_RSEQ_H) 154 154 extern "Cforall" { 155 __attribute__((aligned(64))) thread_local volatile struct rseq __cfaabi_rseq @= {155 __attribute__((aligned(64))) _Thread_local volatile struct rseq __cfaabi_rseq @= { 156 156 .cpu_id : RSEQ_CPU_ID_UNINITIALIZED, 157 157 }; -
libcfa/src/concurrency/preemption.cfa
ra8dd247 ra0dbf20 357 357 } 358 358 } 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; 359 382 } 360 383 } … … 643 666 // Kernel Signal Handlers 644 667 //============================================================================================= 645 __cfaabi_dbg_debug_do( static thread_local void * last_interrupt = 0; )668 __cfaabi_dbg_debug_do( static _Thread_local void * last_interrupt = 0; ) 646 669 647 670 // Context switch signal handler
Note:
See TracChangeset
for help on using the changeset viewer.