source: libcfa/src/concurrency/io.cfa@ 8631c84

ADT ast-experimental enum pthread-emulation qualifiedEnum
Last change on this file since 8631c84 was 3caf5e3, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Re-read cq information after acquire. Hoping this is the cause for the build failure

  • Property mode set to 100644
File size: 19.7 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2020 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// io.cfa --
8//
9// Author : Thierry Delisle
10// Created On : Thu Apr 23 17:31:00 2020
11// Last Modified By :
12// Last Modified On :
13// Update Count :
14//
15
16#define __cforall_thread__
17#define _GNU_SOURCE
18
19#if defined(__CFA_DEBUG__)
20 // #define __CFA_DEBUG_PRINT_IO__
21 // #define __CFA_DEBUG_PRINT_IO_CORE__
22#endif
23
24
25#if defined(CFA_HAVE_LINUX_IO_URING_H)
26 #include <errno.h>
27 #include <signal.h>
28 #include <stdint.h>
29 #include <string.h>
30 #include <unistd.h>
31
32 extern "C" {
33 #include <sys/syscall.h>
34 #include <sys/eventfd.h>
35 #include <sys/uio.h>
36
37 #include <linux/io_uring.h>
38 }
39
40 #include "stats.hfa"
41 #include "kernel.hfa"
42 #include "kernel/fwd.hfa"
43 #include "kernel/private.hfa"
44 #include "kernel/cluster.hfa"
45 #include "io/types.hfa"
46
47 __attribute__((unused)) static const char * opcodes[] = {
48 "OP_NOP",
49 "OP_READV",
50 "OP_WRITEV",
51 "OP_FSYNC",
52 "OP_READ_FIXED",
53 "OP_WRITE_FIXED",
54 "OP_POLL_ADD",
55 "OP_POLL_REMOVE",
56 "OP_SYNC_FILE_RANGE",
57 "OP_SENDMSG",
58 "OP_RECVMSG",
59 "OP_TIMEOUT",
60 "OP_TIMEOUT_REMOVE",
61 "OP_ACCEPT",
62 "OP_ASYNC_CANCEL",
63 "OP_LINK_TIMEOUT",
64 "OP_CONNECT",
65 "OP_FALLOCATE",
66 "OP_OPENAT",
67 "OP_CLOSE",
68 "OP_FILES_UPDATE",
69 "OP_STATX",
70 "OP_READ",
71 "OP_WRITE",
72 "OP_FADVISE",
73 "OP_MADVISE",
74 "OP_SEND",
75 "OP_RECV",
76 "OP_OPENAT2",
77 "OP_EPOLL_CTL",
78 "OP_SPLICE",
79 "OP_PROVIDE_BUFFERS",
80 "OP_REMOVE_BUFFERS",
81 "OP_TEE",
82 "INVALID_OP"
83 };
84
85 static $io_context * __ioarbiter_allocate( $io_arbiter & this, __u32 idxs[], __u32 want );
86 static void __ioarbiter_submit( $io_context * , __u32 idxs[], __u32 have, bool lazy );
87 static void __ioarbiter_flush ( $io_context & );
88 static inline void __ioarbiter_notify( $io_context & ctx );
89//=============================================================================================
90// I/O Polling
91//=============================================================================================
92 static inline unsigned __flush( struct $io_context & );
93 static inline __u32 __release_sqes( struct $io_context & );
94 extern void __kernel_unpark( thread$ * thrd, unpark_hint );
95
96 static bool __cfa_do_drain( $io_context * ctx, cluster * cltr ) {
97 /* paranoid */ verify( ! __preemption_enabled() );
98 /* paranoid */ verify( ready_schedule_islocked() );
99 /* paranoid */ verify( ctx );
100
101 const __u32 mask = *ctx->cq.mask;
102
103
104 {
105 const __u32 head = *ctx->cq.head;
106 const __u32 tail = *ctx->cq.tail;
107
108 if(head == tail) return false;
109 }
110
111 // Drain the queue
112 if(!__atomic_try_acquire(&ctx->cq.lock)) {
113 return false;
114 }
115
116 unsigned long long ts_prev = ctx->cq.ts;
117
118 // re-read the head and tail in case it already changed.
119 const __u32 head = *ctx->cq.head;
120 const __u32 tail = *ctx->cq.tail;
121 const __u32 count = tail - head;
122 __STATS__( false, io.calls.drain++; io.calls.completed += count; )
123
124 for(i; count) {
125 unsigned idx = (head + i) & mask;
126 volatile struct io_uring_cqe & cqe = ctx->cq.cqes[idx];
127
128 /* paranoid */ verify(&cqe);
129
130 struct io_future_t * future = (struct io_future_t *)(uintptr_t)cqe.user_data;
131 __cfadbg_print_safe( io, "Kernel I/O : Syscall completed : cqe %p, result %d for %p\n", &cqe, cqe.res, future );
132
133 __kernel_unpark( fulfil( *future, cqe.res, false ), UNPARK_LOCAL );
134 }
135
136 __cfadbg_print_safe(io, "Kernel I/O : %u completed\n", count);
137 unsigned long long ts_next = ctx->cq.ts = rdtscl();
138
139 // Mark to the kernel that the cqe has been seen
140 // Ensure that the kernel only sees the new value of the head index after the CQEs have been read.
141 __atomic_store_n( ctx->cq.head, head + count, __ATOMIC_SEQ_CST );
142
143 /* paranoid */ verify( ready_schedule_islocked() );
144 /* paranoid */ verify( ! __preemption_enabled() );
145
146 __atomic_unlock(&ctx->cq.lock);
147
148 touch_tsc( cltr->sched.io.tscs, ctx->cq.id, ts_prev, ts_next );
149
150 return true;
151 }
152
153 bool __cfa_io_drain( processor * proc ) {
154 bool local = false;
155 bool remote = false;
156
157 cluster * const cltr = proc->cltr;
158 $io_context * const ctx = proc->io.ctx;
159 /* paranoid */ verify( cltr );
160 /* paranoid */ verify( ctx );
161
162 with(cltr->sched) {
163 const size_t ctxs_count = io.count;
164
165 /* paranoid */ verify( ready_schedule_islocked() );
166 /* paranoid */ verify( ! __preemption_enabled() );
167 /* paranoid */ verify( active_processor() == proc );
168 /* paranoid */ verify( __shard_factor.io > 0 );
169 /* paranoid */ verify( ctxs_count > 0 );
170 /* paranoid */ verify( ctx->cq.id < ctxs_count );
171
172 const unsigned this_cache = cache_id(cltr, ctx->cq.id / __shard_factor.io);
173 const unsigned long long ctsc = rdtscl();
174
175 if(proc->io.target == MAX) {
176 uint64_t chaos = __tls_rand();
177 unsigned ext = chaos & 0xff;
178 unsigned other = (chaos >> 8) % (ctxs_count);
179
180 if(ext < 3 || __atomic_load_n(&caches[other / __shard_factor.io].id, __ATOMIC_RELAXED) == this_cache) {
181 proc->io.target = other;
182 }
183 }
184 else {
185 const unsigned target = proc->io.target;
186 /* paranoid */ verify( io.tscs[target].tv != MAX );
187 if(target < ctxs_count) {
188 const unsigned long long cutoff = calc_cutoff(ctsc, ctx->cq.id, ctxs_count, io.data, io.tscs, __shard_factor.io);
189 const unsigned long long age = moving_average(ctsc, io.tscs[target].tv, io.tscs[target].ma);
190 // __cfadbg_print_safe(ready_queue, "Kernel : Help attempt on %u from %u, age %'llu vs cutoff %'llu, %s\n", target, this, age, cutoff, age > cutoff ? "yes" : "no");
191 if(age > cutoff) {
192 remote = __cfa_do_drain( io.data[target], cltr );
193 }
194 }
195 proc->io.target = MAX;
196 }
197 }
198
199
200 // Drain the local queue
201 local = __cfa_do_drain( proc->io.ctx, cltr );
202
203 /* paranoid */ verify( ready_schedule_islocked() );
204 /* paranoid */ verify( ! __preemption_enabled() );
205 /* paranoid */ verify( active_processor() == proc );
206 return local || remote;
207 }
208
209 bool __cfa_io_flush( processor * proc, int min_comp ) {
210 /* paranoid */ verify( ! __preemption_enabled() );
211 /* paranoid */ verify( proc );
212 /* paranoid */ verify( proc->io.ctx );
213
214 cluster * cltr = proc->cltr;
215 $io_context & ctx = *proc->io.ctx;
216
217 __ioarbiter_flush( ctx );
218
219 if(ctx.sq.to_submit != 0 || min_comp > 0) {
220
221 __STATS__( true, io.calls.flush++; )
222 int ret = syscall( __NR_io_uring_enter, ctx.fd, ctx.sq.to_submit, min_comp, min_comp > 0 ? IORING_ENTER_GETEVENTS : 0, (sigset_t *)0p, _NSIG / 8);
223 if( ret < 0 ) {
224 switch((int)errno) {
225 case EAGAIN:
226 case EINTR:
227 case EBUSY:
228 // Update statistics
229 __STATS__( false, io.calls.errors.busy ++; )
230 return false;
231 default:
232 abort( "KERNEL ERROR: IO_URING SYSCALL - (%d) %s\n", (int)errno, strerror(errno) );
233 }
234 }
235
236 __cfadbg_print_safe(io, "Kernel I/O : %u submitted to io_uring %d\n", ret, ctx.fd);
237 __STATS__( true, io.calls.submitted += ret; )
238 /* paranoid */ verify( ctx.sq.to_submit <= *ctx.sq.num );
239 /* paranoid */ verify( ctx.sq.to_submit >= ret );
240
241 ctx.sq.to_submit -= ret;
242
243 /* paranoid */ verify( ctx.sq.to_submit <= *ctx.sq.num );
244
245 // Release the consumed SQEs
246 __release_sqes( ctx );
247
248 /* paranoid */ verify( ! __preemption_enabled() );
249
250 __atomic_store_n(&ctx.proc->io.pending, false, __ATOMIC_RELAXED);
251 }
252
253 ready_schedule_lock();
254 bool ret = __cfa_io_drain( proc );
255 ready_schedule_unlock();
256 return ret;
257 }
258
259//=============================================================================================
260// I/O Submissions
261//=============================================================================================
262
263// Submition steps :
264// 1 - Allocate a queue entry. The ring already has memory for all entries but only the ones
265// listed in sq.array are visible by the kernel. For those not listed, the kernel does not
266// offer any assurance that an entry is not being filled by multiple flags. Therefore, we
267// need to write an allocator that allows allocating concurrently.
268//
269// 2 - Actually fill the submit entry, this is the only simple and straightforward step.
270//
271// 3 - Append the entry index to the array and adjust the tail accordingly. This operation
272// needs to arrive to two concensus at the same time:
273// A - The order in which entries are listed in the array: no two threads must pick the
274// same index for their entries
275// B - When can the tail be update for the kernel. EVERY entries in the array between
276// head and tail must be fully filled and shouldn't ever be touched again.
277//
278 //=============================================================================================
279 // Allocation
280 // for user's convenience fill the sqes from the indexes
281 static inline void __fill(struct io_uring_sqe * out_sqes[], __u32 want, __u32 idxs[], struct $io_context * ctx) {
282 struct io_uring_sqe * sqes = ctx->sq.sqes;
283 for(i; want) {
284 __cfadbg_print_safe(io, "Kernel I/O : filling loop\n");
285 out_sqes[i] = &sqes[idxs[i]];
286 }
287 }
288
289 // Try to directly allocate from the a given context
290 // Not thread-safe
291 static inline bool __alloc(struct $io_context * ctx, __u32 idxs[], __u32 want) {
292 __sub_ring_t & sq = ctx->sq;
293 const __u32 mask = *sq.mask;
294 __u32 fhead = sq.free_ring.head; // get the current head of the queue
295 __u32 ftail = sq.free_ring.tail; // get the current tail of the queue
296
297 // If we don't have enough sqes, fail
298 if((ftail - fhead) < want) { return false; }
299
300 // copy all the indexes we want from the available list
301 for(i; want) {
302 __cfadbg_print_safe(io, "Kernel I/O : allocating loop\n");
303 idxs[i] = sq.free_ring.array[(fhead + i) & mask];
304 }
305
306 // Advance the head to mark the indexes as consumed
307 __atomic_store_n(&sq.free_ring.head, fhead + want, __ATOMIC_RELEASE);
308
309 // return success
310 return true;
311 }
312
313 // Allocate an submit queue entry.
314 // The kernel cannot see these entries until they are submitted, but other threads must be
315 // able to see which entries can be used and which are already un used by an other thread
316 // for convenience, return both the index and the pointer to the sqe
317 // sqe == &sqes[idx]
318 struct $io_context * cfa_io_allocate(struct io_uring_sqe * sqes[], __u32 idxs[], __u32 want) {
319 __cfadbg_print_safe(io, "Kernel I/O : attempting to allocate %u\n", want);
320
321 disable_interrupts();
322 processor * proc = __cfaabi_tls.this_processor;
323 $io_context * ctx = proc->io.ctx;
324 /* paranoid */ verify( __cfaabi_tls.this_processor );
325 /* paranoid */ verify( ctx );
326
327 __cfadbg_print_safe(io, "Kernel I/O : attempting to fast allocation\n");
328
329 // We can proceed to the fast path
330 if( __alloc(ctx, idxs, want) ) {
331 // Allocation was successful
332 __STATS__( true, io.alloc.fast += 1; )
333 enable_interrupts();
334
335 __cfadbg_print_safe(io, "Kernel I/O : fast allocation successful from ring %d\n", ctx->fd);
336
337 __fill( sqes, want, idxs, ctx );
338 return ctx;
339 }
340 // The fast path failed, fallback
341 __STATS__( true, io.alloc.fail += 1; )
342
343 // Fast path failed, fallback on arbitration
344 __STATS__( true, io.alloc.slow += 1; )
345 enable_interrupts();
346
347 $io_arbiter * ioarb = proc->cltr->io.arbiter;
348 /* paranoid */ verify( ioarb );
349
350 __cfadbg_print_safe(io, "Kernel I/O : falling back on arbiter for allocation\n");
351
352 struct $io_context * ret = __ioarbiter_allocate(*ioarb, idxs, want);
353
354 __cfadbg_print_safe(io, "Kernel I/O : slow allocation completed from ring %d\n", ret->fd);
355
356 __fill( sqes, want, idxs,ret );
357 return ret;
358 }
359
360 //=============================================================================================
361 // submission
362 static inline void __submit_only( struct $io_context * ctx, __u32 idxs[], __u32 have) {
363 // We can proceed to the fast path
364 // Get the right objects
365 __sub_ring_t & sq = ctx->sq;
366 const __u32 mask = *sq.mask;
367 __u32 tail = *sq.kring.tail;
368
369 // Add the sqes to the array
370 for( i; have ) {
371 __cfadbg_print_safe(io, "Kernel I/O : __submit loop\n");
372 sq.kring.array[ (tail + i) & mask ] = idxs[i];
373 }
374
375 // Make the sqes visible to the submitter
376 __atomic_store_n(sq.kring.tail, tail + have, __ATOMIC_RELEASE);
377 sq.to_submit += have;
378
379 __atomic_store_n(&ctx->proc->io.pending, true, __ATOMIC_RELAXED);
380 __atomic_store_n(&ctx->proc->io.dirty , true, __ATOMIC_RELAXED);
381 }
382
383 static inline void __submit( struct $io_context * ctx, __u32 idxs[], __u32 have, bool lazy) {
384 __sub_ring_t & sq = ctx->sq;
385 __submit_only(ctx, idxs, have);
386
387 if(sq.to_submit > 30) {
388 __tls_stats()->io.flush.full++;
389 __cfa_io_flush( ctx->proc, 0 );
390 }
391 if(!lazy) {
392 __tls_stats()->io.flush.eager++;
393 __cfa_io_flush( ctx->proc, 0 );
394 }
395 }
396
397 void cfa_io_submit( struct $io_context * inctx, __u32 idxs[], __u32 have, bool lazy ) __attribute__((nonnull (1))) {
398 __cfadbg_print_safe(io, "Kernel I/O : attempting to submit %u (%s)\n", have, lazy ? "lazy" : "eager");
399
400 disable_interrupts();
401 processor * proc = __cfaabi_tls.this_processor;
402 $io_context * ctx = proc->io.ctx;
403 /* paranoid */ verify( __cfaabi_tls.this_processor );
404 /* paranoid */ verify( ctx );
405
406 // Can we proceed to the fast path
407 if( ctx == inctx ) // We have the right instance?
408 {
409 __submit(ctx, idxs, have, lazy);
410
411 // Mark the instance as no longer in-use, re-enable interrupts and return
412 __STATS__( true, io.submit.fast += 1; )
413 enable_interrupts();
414
415 __cfadbg_print_safe(io, "Kernel I/O : submitted on fast path\n");
416 return;
417 }
418
419 // Fast path failed, fallback on arbitration
420 __STATS__( true, io.submit.slow += 1; )
421 enable_interrupts();
422
423 __cfadbg_print_safe(io, "Kernel I/O : falling back on arbiter for submission\n");
424
425 __ioarbiter_submit(inctx, idxs, have, lazy);
426 }
427
428 //=============================================================================================
429 // Flushing
430 // Go through the ring's submit queue and release everything that has already been consumed
431 // by io_uring
432 // This cannot be done by multiple threads
433 static __u32 __release_sqes( struct $io_context & ctx ) {
434 const __u32 mask = *ctx.sq.mask;
435
436 __attribute__((unused))
437 __u32 ctail = *ctx.sq.kring.tail; // get the current tail of the queue
438 __u32 chead = *ctx.sq.kring.head; // get the current head of the queue
439 __u32 phead = ctx.sq.kring.released; // get the head the last time we were here
440
441 __u32 ftail = ctx.sq.free_ring.tail; // get the current tail of the queue
442
443 // the 3 fields are organized like this diagram
444 // except it's are ring
445 // ---+--------+--------+----
446 // ---+--------+--------+----
447 // ^ ^ ^
448 // phead chead ctail
449
450 // make sure ctail doesn't wrap around and reach phead
451 /* paranoid */ verify(
452 (ctail >= chead && chead >= phead)
453 || (chead >= phead && phead >= ctail)
454 || (phead >= ctail && ctail >= chead)
455 );
456
457 // find the range we need to clear
458 __u32 count = chead - phead;
459
460 if(count == 0) {
461 return 0;
462 }
463
464 // We acquired an previous-head/current-head range
465 // go through the range and release the sqes
466 for( i; count ) {
467 __cfadbg_print_safe(io, "Kernel I/O : release loop\n");
468 __u32 idx = ctx.sq.kring.array[ (phead + i) & mask ];
469 ctx.sq.free_ring.array[ (ftail + i) & mask ] = idx;
470 }
471
472 ctx.sq.kring.released = chead; // note up to were we processed
473 __atomic_store_n(&ctx.sq.free_ring.tail, ftail + count, __ATOMIC_SEQ_CST);
474
475 __ioarbiter_notify(ctx);
476
477 return count;
478 }
479
480//=============================================================================================
481// I/O Arbiter
482//=============================================================================================
483 static inline bool enqueue(__outstanding_io_queue & queue, __outstanding_io & item) {
484 bool was_empty;
485
486 // Lock the list, it's not thread safe
487 lock( queue.lock __cfaabi_dbg_ctx2 );
488 {
489 was_empty = empty(queue.queue);
490
491 // Add our request to the list
492 add( queue.queue, item );
493
494 // Mark as pending
495 __atomic_store_n( &queue.empty, false, __ATOMIC_SEQ_CST );
496 }
497 unlock( queue.lock );
498
499 return was_empty;
500 }
501
502 static inline bool empty(__outstanding_io_queue & queue ) {
503 return __atomic_load_n( &queue.empty, __ATOMIC_SEQ_CST);
504 }
505
506 static $io_context * __ioarbiter_allocate( $io_arbiter & this, __u32 idxs[], __u32 want ) {
507 __cfadbg_print_safe(io, "Kernel I/O : arbiter allocating\n");
508
509 __STATS__( false, io.alloc.block += 1; )
510
511 // No one has any resources left, wait for something to finish
512 // We need to add ourself to a list of pending allocs and wait for an answer
513 __pending_alloc pa;
514 pa.idxs = idxs;
515 pa.want = want;
516
517 enqueue(this.pending, (__outstanding_io&)pa);
518
519 wait( pa.sem );
520
521 return pa.ctx;
522
523 }
524
525 static void __ioarbiter_notify( $io_arbiter & this, $io_context * ctx ) {
526 /* paranoid */ verify( !empty(this.pending.queue) );
527
528 lock( this.pending.lock __cfaabi_dbg_ctx2 );
529 {
530 while( !empty(this.pending.queue) ) {
531 __cfadbg_print_safe(io, "Kernel I/O : notifying\n");
532 __u32 have = ctx->sq.free_ring.tail - ctx->sq.free_ring.head;
533 __pending_alloc & pa = (__pending_alloc&)head( this.pending.queue );
534
535 if( have > pa.want ) goto DONE;
536 drop( this.pending.queue );
537
538 /* paranoid */__attribute__((unused)) bool ret =
539
540 __alloc(ctx, pa.idxs, pa.want);
541
542 /* paranoid */ verify( ret );
543
544 pa.ctx = ctx;
545
546 post( pa.sem );
547 }
548
549 this.pending.empty = true;
550 DONE:;
551 }
552 unlock( this.pending.lock );
553 }
554
555 static void __ioarbiter_notify( $io_context & ctx ) {
556 if(!empty( ctx.arbiter->pending )) {
557 __ioarbiter_notify( *ctx.arbiter, &ctx );
558 }
559 }
560
561 // Simply append to the pending
562 static void __ioarbiter_submit( $io_context * ctx, __u32 idxs[], __u32 have, bool lazy ) {
563 __cfadbg_print_safe(io, "Kernel I/O : submitting %u from the arbiter to context %u\n", have, ctx->fd);
564
565 __cfadbg_print_safe(io, "Kernel I/O : waiting to submit %u\n", have);
566
567 __external_io ei;
568 ei.idxs = idxs;
569 ei.have = have;
570 ei.lazy = lazy;
571
572 bool we = enqueue(ctx->ext_sq, (__outstanding_io&)ei);
573
574 __atomic_store_n(&ctx->proc->io.pending, true, __ATOMIC_SEQ_CST);
575
576 if( we ) {
577 sigval_t value = { PREEMPT_IO };
578 pthread_sigqueue(ctx->proc->kernel_thread, SIGUSR1, value);
579 }
580
581 wait( ei.sem );
582
583 __cfadbg_print_safe(io, "Kernel I/O : %u submitted from arbiter\n", have);
584 }
585
586 static void __ioarbiter_flush( $io_context & ctx ) {
587 if(!empty( ctx.ext_sq )) {
588 __STATS__( false, io.flush.external += 1; )
589
590 __cfadbg_print_safe(io, "Kernel I/O : arbiter flushing\n");
591
592 lock( ctx.ext_sq.lock __cfaabi_dbg_ctx2 );
593 {
594 while( !empty(ctx.ext_sq.queue) ) {
595 __external_io & ei = (__external_io&)drop( ctx.ext_sq.queue );
596
597 __submit_only(&ctx, ei.idxs, ei.have);
598
599 post( ei.sem );
600 }
601
602 ctx.ext_sq.empty = true;
603 }
604 unlock(ctx.ext_sq.lock );
605 }
606 }
607
608 #if defined(CFA_WITH_IO_URING_IDLE)
609 bool __kernel_read(processor * proc, io_future_t & future, iovec & iov, int fd) {
610 $io_context * ctx = proc->io.ctx;
611 /* paranoid */ verify( ! __preemption_enabled() );
612 /* paranoid */ verify( proc == __cfaabi_tls.this_processor );
613 /* paranoid */ verify( ctx );
614
615 __u32 idx;
616 struct io_uring_sqe * sqe;
617
618 // We can proceed to the fast path
619 if( !__alloc(ctx, &idx, 1) ) return false;
620
621 // Allocation was successful
622 __fill( &sqe, 1, &idx, ctx );
623
624 sqe->user_data = (uintptr_t)&future;
625 sqe->flags = 0;
626 sqe->fd = fd;
627 sqe->off = 0;
628 sqe->ioprio = 0;
629 sqe->fsync_flags = 0;
630 sqe->__pad2[0] = 0;
631 sqe->__pad2[1] = 0;
632 sqe->__pad2[2] = 0;
633
634 #if defined(CFA_HAVE_IORING_OP_READ)
635 sqe->opcode = IORING_OP_READ;
636 sqe->addr = (uint64_t)iov.iov_base;
637 sqe->len = iov.iov_len;
638 #elif defined(CFA_HAVE_READV) && defined(CFA_HAVE_IORING_OP_READV)
639 sqe->opcode = IORING_OP_READV;
640 sqe->addr = (uintptr_t)&iov;
641 sqe->len = 1;
642 #else
643 #error CFA_WITH_IO_URING_IDLE but none of CFA_HAVE_READV, CFA_HAVE_IORING_OP_READV or CFA_HAVE_IORING_OP_READ defined
644 #endif
645
646 asm volatile("": : :"memory");
647
648 /* paranoid */ verify( sqe->user_data == (uintptr_t)&future );
649 __submit( ctx, &idx, 1, true );
650
651 /* paranoid */ verify( proc == __cfaabi_tls.this_processor );
652 /* paranoid */ verify( ! __preemption_enabled() );
653
654 return true;
655 }
656 #endif
657#endif
Note: See TracBrowser for help on using the repository browser.