Changes in / [54eb5ebd:f19fbbc]


Ignore:
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/filecache.cfa

    r54eb5ebd rf19fbbc  
    192192}
    193193
    194 [int *, int] filefds(int extra) {
    195         if(!file_cache.entries) {
    196                 abort("File cache not filled!\n");
    197         }
    198 
    199         return [aalloc(extra), 0];
    200 }
    201 
    202 
    203194void close_cache() {
    204195        for(idx; file_cache.size) {
  • benchmark/io/http/filecache.hfa

    r54eb5ebd rf19fbbc  
    1111[int fd, size_t size] get_file( * const char file, size_t len );
    1212void fill_cache( const char * path );
    13 [int *, int] filefds( int extra );
    1413void close_cache();
  • benchmark/io/http/main.cfa

    r54eb5ebd rf19fbbc  
    9393                &wait_connect = &chan;
    9494
    95                 int pipe_cnt = options.clopts.nworkers * 2;
    96                 int pipe_off;
    97                 int * fds;
    98                 [fds, pipe_off] = filefds( pipe_cnt );
    99                 for(i; 0 ~ pipe_cnt ~ 2) {
    100                         int ret = pipe(&fds[pipe_off + i]);
    101                         if( ret < 0 ) { abort( "pipe error: (%d) %s\n", (int)errno, strerror(errno) ); }
    102                 }
    103 
    10495                {
    10596                        ServerProc procs[options.clopts.nprocs];
    10697                        {
    10798                                Worker workers[options.clopts.nworkers];
    108                                 for(i; options.clopts.nworkers) {
    109                                         if( options.file_cache.fixed_fds ) {
    110                                                 workers[i].pipe[0] = pipe_off + (i * 2) + 0;
    111                                                 workers[i].pipe[1] = pipe_off + (i * 2) + 1;
    112                                         }
    113                                         else {
    114                                                 workers[i].pipe[0] = fds[pipe_off + (i * 2) + 0];
    115                                                 workers[i].pipe[1] = fds[pipe_off + (i * 2) + 1];
    116                                         }
    117                                         unpark( workers[i] __cfaabi_dbg_ctx2 );
    118                                 }
    11999                                printf("%d workers started on %d processors\n", options.clopts.nworkers, options.clopts.nprocs);
    120100                                {
     
    137117                        printf("Workers Closed\n");
    138118                }
    139 
    140                 for(i; pipe_cnt) {
    141                         ret = close( fds[pipe_off + i] );
    142                         if(ret < 0) {
    143                                 abort( "close pipe error: (%d) %s\n", (int)errno, strerror(errno) );
    144                         }
    145                 }
    146                 free(fds);
    147119        }
    148120
  • benchmark/io/http/worker.cfa

    r54eb5ebd rf19fbbc  
    1212#include "filecache.hfa"
    1313
     14extern "C" {
     15// extern ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
     16extern ssize_t splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags);
     17}
     18
     19ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) {
     20        return splice(in_fd, offset, out_fd, 0p, count, 0);
     21}
     22
     23
    1424//=============================================================================================
    1525// Worker Thread
     
    1727void ?{}( Worker & this ) {
    1828        ((thread&)this){ "Server Worker Thread", *options.clopts.instance };
    19         this.pipe[0] = -1;
    20         this.pipe[1] = -1;
     29        int ret = pipe(this.pipe);
     30        if( ret < 0 ) { abort( "pipe error: (%d) %s\n", (int)errno, strerror(errno) ); }
    2131}
    2232
    2333void main( Worker & this ) {
    24         park( __cfaabi_dbg_ctx );
    25         /* paranoid */ assert( this.pipe[0] != -1 );
    26         /* paranoid */ assert( this.pipe[1] != -1 );
    27 
    2834        CONNECTION:
    2935        for() {
  • libcfa/configure

    r54eb5ebd rf19fbbc  
    677677AMDEP_FALSE
    678678AMDEP_TRUE
     679am__quote
    679680am__include
    680681DEPDIR
     
    783784PACKAGE_NAME
    784785PATH_SEPARATOR
    785 SHELL
    786 am__quote'
     786SHELL'
    787787ac_subst_files=''
    788788ac_user_opts='
     
    20542054
    20552055} # ac_fn_c_check_header_mongrel
    2056 
    2057 # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
    2058 # ---------------------------------------------
    2059 # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
    2060 # accordingly.
    2061 ac_fn_c_check_decl ()
    2062 {
    2063   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    2064   as_decl_name=`echo $2|sed 's/ *(.*//'`
    2065   as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
    2066   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
    2067 $as_echo_n "checking whether $as_decl_name is declared... " >&6; }
    2068 if eval \${$3+:} false; then :
    2069   $as_echo_n "(cached) " >&6
    2070 else
    2071   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    2072 /* end confdefs.h.  */
    2073 $4
    2074 int
    2075 main ()
    2076 {
    2077 #ifndef $as_decl_name
    2078 #ifdef __cplusplus
    2079   (void) $as_decl_use;
    2080 #else
    2081   (void) $as_decl_name;
    2082 #endif
    2083 #endif
    2084 
    2085   ;
    2086   return 0;
    2087 }
    2088 _ACEOF
    2089 if ac_fn_c_try_compile "$LINENO"; then :
    2090   eval "$3=yes"
    2091 else
    2092   eval "$3=no"
    2093 fi
    2094 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    2095 fi
    2096 eval ac_res=\$$3
    2097                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
    2098 $as_echo "$ac_res" >&6; }
    2099   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    2100 
    2101 } # ac_fn_c_check_decl
    21022056cat >config.log <<_ACEOF
    21032057This file contains any messages produced by compilers while
     
    25322486
    25332487
    2534 am__api_version='1.16'
     2488am__api_version='1.15'
    25352489
    25362490# Find a good install program.  We prefer a C program (faster),
     
    30092963# For better backward compatibility.  To be removed once Automake 1.9.x
    30102964# dies out for good.  For more background, see:
    3011 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
    3012 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
     2965# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
     2966# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
    30132967mkdir_p='$(MKDIR_P)'
    30142968
     
    30613015
    30623016You can download and install GNU coreutils to get an 'rm' implementation
    3063 that behaves properly: <https://www.gnu.org/software/coreutils/>.
     3017that behaves properly: <http://www.gnu.org/software/coreutils/>.
    30643018
    30653019If you want to complete the configuration process using your problematic
     
    34453399ac_config_commands="$ac_config_commands depfiles"
    34463400
    3447 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
    3448 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
    3449 cat > confinc.mk << 'END'
     3401
     3402am_make=${MAKE-make}
     3403cat > confinc << 'END'
    34503404am__doit:
    3451         @echo this is the am__doit target >confinc.out
     3405        @echo this is the am__doit target
    34523406.PHONY: am__doit
    34533407END
     3408# If we don't find an include directive, just comment out the code.
     3409{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
     3410$as_echo_n "checking for style of include used by $am_make... " >&6; }
    34543411am__include="#"
    34553412am__quote=
    3456 # BSD make does it like this.
    3457 echo '.include "confinc.mk" # ignored' > confmf.BSD
    3458 # Other make implementations (GNU, Solaris 10, AIX) do it like this.
    3459 echo 'include confinc.mk # ignored' > confmf.GNU
    3460 _am_result=no
    3461 for s in GNU BSD; do
    3462   { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
    3463    (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
    3464    ac_status=$?
    3465    echo "$as_me:$LINENO: \$? = $ac_status" >&5
    3466    (exit $ac_status); }
    3467   case $?:`cat confinc.out 2>/dev/null` in #(
    3468   '0:this is the am__doit target') :
    3469     case $s in #(
    3470   BSD) :
    3471     am__include='.include' am__quote='"' ;; #(
    3472   *) :
    3473     am__include='include' am__quote='' ;;
    3474 esac ;; #(
    3475   *) :
     3413_am_result=none
     3414# First try GNU make style include.
     3415echo "include confinc" > confmf
     3416# Ignore all kinds of additional output from 'make'.
     3417case `$am_make -s -f confmf 2> /dev/null` in #(
     3418*the\ am__doit\ target*)
     3419  am__include=include
     3420  am__quote=
     3421  _am_result=GNU
     3422  ;;
     3423esac
     3424# Now try BSD make style include.
     3425if test "$am__include" = "#"; then
     3426   echo '.include "confinc"' > confmf
     3427   case `$am_make -s -f confmf 2> /dev/null` in #(
     3428   *the\ am__doit\ target*)
     3429     am__include=.include
     3430     am__quote="\""
     3431     _am_result=BSD
    34763432     ;;
    3477 esac
    3478   if test "$am__include" != "#"; then
    3479     _am_result="yes ($s style)"
    3480     break
    3481   fi
    3482 done
    3483 rm -f confinc.* confmf.*
    3484 { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
    3485 $as_echo "${_am_result}" >&6; }
     3433   esac
     3434fi
     3435
     3436
     3437{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
     3438$as_echo "$_am_result" >&6; }
     3439rm -f confinc confmf
    34863440
    34873441# Check whether --enable-dependency-tracking was given.
     
    59875941
    59885942: ${AR=ar}
    5989 : ${AR_FLAGS=cr}
     5943: ${AR_FLAGS=cru}
    59905944
    59915945
     
    64886442    # Now try to grab the symbols.
    64896443    nlist=conftest.nm
    6490     $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5
    6491     if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then
     6444    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
     6445  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
     6446  ac_status=$?
     6447  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     6448  test $ac_status = 0; } && test -s "$nlist"; then
    64926449      # Try sorting and uniquifying the output.
    64936450      if sort "$nlist" | uniq > "$nlist"T; then
     
    77087665      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
    77097666      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
    7710       echo "$AR cr libconftest.a conftest.o" >&5
    7711       $AR cr libconftest.a conftest.o 2>&5
     7667      echo "$AR cru libconftest.a conftest.o" >&5
     7668      $AR cru libconftest.a conftest.o 2>&5
    77127669      echo "$RANLIB libconftest.a" >&5
    77137670      $RANLIB libconftest.a 2>&5
     
    88358792        lt_prog_compiler_wl='-Wl,'
    88368793        lt_prog_compiler_pic='-KPIC'
    8837         lt_prog_compiler_static='-static'
    8838         ;;
    8839       # flang / f18. f95 an alias for gfortran or flang on Debian
    8840       flang* | f18* | f95*)
    8841         lt_prog_compiler_wl='-Wl,'
    8842         lt_prog_compiler_pic='-fPIC'
    88438794        lt_prog_compiler_static='-static'
    88448795        ;;
     
    1320313154      # what "hidden" libraries, object files and flags are used when
    1320413155      # linking a shared library.
    13205       output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
     13156      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
    1320613157
    1320713158    else
     
    1369513646            # from the output so that they don't get included in the library
    1369613647            # dependencies.
    13697             output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
     13648            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
    1369813649            ;;
    1369913650          *)
     
    1376013711            # from the output so that they don't get included in the library
    1376113712            # dependencies.
    13762             output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
     13713            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
    1376313714            ;;
    1376413715          *)
     
    1409914050              # what "hidden" libraries, object files and flags are used when
    1410014051              # linking a shared library.
    14101               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
     14052              output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
    1410214053
    1410314054            else
     
    1418314134                # what "hidden" libraries, object files and flags are used when
    1418414135                # linking a shared library.
    14185                 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
     14136                output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
    1418614137              else
    1418714138                # g++ 2.7 appears to require '-G' NOT '-shared' on this
     
    1419414145                # what "hidden" libraries, object files and flags are used when
    1419514146                # linking a shared library.
    14196                 output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
     14147                output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
    1419714148              fi
    1419814149
     
    1701116962
    1701216963
    17013 
    17014 
    17015 #io_uring 5.4 and earlier uses defines
    17016 #io_uring 5.5 uses enum values
    17017 #io_uring 5.6 and later uses probes
    17018 
    1701916964for ac_header in linux/io_uring.h
    1702016965do :
     
    1702416969#define HAVE_LINUX_IO_URING_H 1
    1702516970_ACEOF
    17026 
    17027         $as_echo "#define CFA_HAVE_LINUX_IO_URING_H 1" >>confdefs.h
    17028 
    17029         # AC_CHECK_HEADER([liburing.h], [
    17030         #       AC_CHECK_LIB([uring], [io_uring_get_probe])
    17031         # ])
    17032 
    17033                 ac_fn_c_check_decl "$LINENO" "IORING_OP_NOP" "ac_cv_have_decl_IORING_OP_NOP" "#include <linux/io_uring.h>
    17034 "
    17035 if test "x$ac_cv_have_decl_IORING_OP_NOP" = xyes; then :
    17036   $as_echo "#define CFA_HAVE_IORING_OP_NOP 1" >>confdefs.h
    17037 
    17038 fi
    17039 
    17040 
    17041                 ac_fn_c_check_decl "$LINENO" "IORING_OP_READV" "ac_cv_have_decl_IORING_OP_READV" "#include <linux/io_uring.h>
    17042 "
    17043 if test "x$ac_cv_have_decl_IORING_OP_READV" = xyes; then :
    17044   $as_echo "#define CFA_HAVE_IORING_OP_READV 1" >>confdefs.h
    17045 
    17046 fi
    17047 
    17048 
    17049                 ac_fn_c_check_decl "$LINENO" "IORING_OP_WRITEV" "ac_cv_have_decl_IORING_OP_WRITEV" "#include <linux/io_uring.h>
    17050 "
    17051 if test "x$ac_cv_have_decl_IORING_OP_WRITEV" = xyes; then :
    17052   $as_echo "#define CFA_HAVE_IORING_OP_WRITEV 1" >>confdefs.h
    17053 
    17054 fi
    17055 
    17056 
    17057                 ac_fn_c_check_decl "$LINENO" "IORING_OP_FSYNC" "ac_cv_have_decl_IORING_OP_FSYNC" "#include <linux/io_uring.h>
    17058 "
    17059 if test "x$ac_cv_have_decl_IORING_OP_FSYNC" = xyes; then :
    17060   $as_echo "#define CFA_HAVE_IORING_OP_FSYNC 1" >>confdefs.h
    17061 
    17062 fi
    17063 
    17064 
    17065                 ac_fn_c_check_decl "$LINENO" "IORING_OP_READ_FIXED" "ac_cv_have_decl_IORING_OP_READ_FIXED" "#include <linux/io_uring.h>
    17066 "
    17067 if test "x$ac_cv_have_decl_IORING_OP_READ_FIXED" = xyes; then :
    17068   $as_echo "#define CFA_HAVE_IORING_OP_READ_FIXED 1" >>confdefs.h
    17069 
    17070 fi
    17071 
    17072 
    17073                 ac_fn_c_check_decl "$LINENO" "IORING_OP_WRITE_FIXED" "ac_cv_have_decl_IORING_OP_WRITE_FIXED" "#include <linux/io_uring.h>
    17074 "
    17075 if test "x$ac_cv_have_decl_IORING_OP_WRITE_FIXED" = xyes; then :
    17076   $as_echo "#define CFA_HAVE_IORING_OP_WRITE_FIXED 1" >>confdefs.h
    17077 
    17078 fi
    17079 
    17080 
    17081                 ac_fn_c_check_decl "$LINENO" "IORING_OP_POLL_ADD" "ac_cv_have_decl_IORING_OP_POLL_ADD" "#include <linux/io_uring.h>
    17082 "
    17083 if test "x$ac_cv_have_decl_IORING_OP_POLL_ADD" = xyes; then :
    17084   $as_echo "#define CFA_HAVE_IORING_OP_POLL_ADD 1" >>confdefs.h
    17085 
    17086 fi
    17087 
    17088 
    17089                 ac_fn_c_check_decl "$LINENO" "IORING_OP_POLL_REMOVE" "ac_cv_have_decl_IORING_OP_POLL_REMOVE" "#include <linux/io_uring.h>
    17090 "
    17091 if test "x$ac_cv_have_decl_IORING_OP_POLL_REMOVE" = xyes; then :
    17092   $as_echo "#define CFA_HAVE_IORING_OP_POLL_REMOVE 1" >>confdefs.h
    17093 
    17094 fi
    17095 
    17096 
    17097                 ac_fn_c_check_decl "$LINENO" "IORING_OP_SYNC_FILE_RANGE" "ac_cv_have_decl_IORING_OP_SYNC_FILE_RANGE" "#include <linux/io_uring.h>
    17098 "
    17099 if test "x$ac_cv_have_decl_IORING_OP_SYNC_FILE_RANGE" = xyes; then :
    17100   $as_echo "#define CFA_HAVE_IORING_OP_SYNC_FILE_RANGE 1" >>confdefs.h
    17101 
    17102 fi
    17103 
    17104 
    17105                 ac_fn_c_check_decl "$LINENO" "IORING_OP_SENDMSG" "ac_cv_have_decl_IORING_OP_SENDMSG" "#include <linux/io_uring.h>
    17106 "
    17107 if test "x$ac_cv_have_decl_IORING_OP_SENDMSG" = xyes; then :
    17108   $as_echo "#define CFA_HAVE_IORING_OP_SENDMSG 1" >>confdefs.h
    17109 
    17110 fi
    17111 
    17112 
    17113                 ac_fn_c_check_decl "$LINENO" "IORING_OP_RECVMSG" "ac_cv_have_decl_IORING_OP_RECVMSG" "#include <linux/io_uring.h>
    17114 "
    17115 if test "x$ac_cv_have_decl_IORING_OP_RECVMSG" = xyes; then :
    17116   $as_echo "#define CFA_HAVE_IORING_OP_RECVMSG 1" >>confdefs.h
    17117 
    17118 fi
    17119 
    17120 
    17121                 ac_fn_c_check_decl "$LINENO" "IORING_OP_TIMEOUT" "ac_cv_have_decl_IORING_OP_TIMEOUT" "#include <linux/io_uring.h>
    17122 "
    17123 if test "x$ac_cv_have_decl_IORING_OP_TIMEOUT" = xyes; then :
    17124   $as_echo "#define CFA_HAVE_IORING_OP_TIMEOUT 1" >>confdefs.h
    17125 
    17126 fi
    17127 
    17128 
    17129                 ac_fn_c_check_decl "$LINENO" "IORING_OP_TIMEOUT_REMOVE" "ac_cv_have_decl_IORING_OP_TIMEOUT_REMOVE" "#include <linux/io_uring.h>
    17130 "
    17131 if test "x$ac_cv_have_decl_IORING_OP_TIMEOUT_REMOVE" = xyes; then :
    17132   $as_echo "#define CFA_HAVE_IORING_OP_TIMEOUT_REMOVE 1" >>confdefs.h
    17133 
    17134 fi
    17135 
    17136 
    17137                 ac_fn_c_check_decl "$LINENO" "IORING_OP_ACCEPT" "ac_cv_have_decl_IORING_OP_ACCEPT" "#include <linux/io_uring.h>
    17138 "
    17139 if test "x$ac_cv_have_decl_IORING_OP_ACCEPT" = xyes; then :
    17140   $as_echo "#define CFA_HAVE_IORING_OP_ACCEPT 1" >>confdefs.h
    17141 
    17142 fi
    17143 
    17144 
    17145                 ac_fn_c_check_decl "$LINENO" "IORING_OP_ASYNC_CANCEL" "ac_cv_have_decl_IORING_OP_ASYNC_CANCEL" "#include <linux/io_uring.h>
    17146 "
    17147 if test "x$ac_cv_have_decl_IORING_OP_ASYNC_CANCEL" = xyes; then :
    17148   $as_echo "#define CFA_HAVE_IORING_OP_ASYNC_CANCEL 1" >>confdefs.h
    17149 
    17150 fi
    17151 
    17152 
    17153                 ac_fn_c_check_decl "$LINENO" "IORING_OP_LINK_TIMEOUT" "ac_cv_have_decl_IORING_OP_LINK_TIMEOUT" "#include <linux/io_uring.h>
    17154 "
    17155 if test "x$ac_cv_have_decl_IORING_OP_LINK_TIMEOUT" = xyes; then :
    17156   $as_echo "#define CFA_HAVE_IORING_OP_LINK_TIMEOUT 1" >>confdefs.h
    17157 
    17158 fi
    17159 
    17160 
    17161                 ac_fn_c_check_decl "$LINENO" "IORING_OP_CONNECT" "ac_cv_have_decl_IORING_OP_CONNECT" "#include <linux/io_uring.h>
    17162 "
    17163 if test "x$ac_cv_have_decl_IORING_OP_CONNECT" = xyes; then :
    17164   $as_echo "#define CFA_HAVE_IORING_OP_CONNECT 1" >>confdefs.h
    17165 
    17166 fi
    17167 
    17168 
    17169                 ac_fn_c_check_decl "$LINENO" "IORING_OP_FALLOCATE" "ac_cv_have_decl_IORING_OP_FALLOCATE" "#include <linux/io_uring.h>
    17170 "
    17171 if test "x$ac_cv_have_decl_IORING_OP_FALLOCATE" = xyes; then :
    17172   $as_echo "#define CFA_HAVE_IORING_OP_FALLOCATE 1" >>confdefs.h
    17173 
    17174 fi
    17175 
    17176 
    17177                 ac_fn_c_check_decl "$LINENO" "IORING_OP_OPENAT" "ac_cv_have_decl_IORING_OP_OPENAT" "#include <linux/io_uring.h>
    17178 "
    17179 if test "x$ac_cv_have_decl_IORING_OP_OPENAT" = xyes; then :
    17180   $as_echo "#define CFA_HAVE_IORING_OP_OPENAT 1" >>confdefs.h
    17181 
    17182 fi
    17183 
    17184 
    17185                 ac_fn_c_check_decl "$LINENO" "IORING_OP_CLOSE" "ac_cv_have_decl_IORING_OP_CLOSE" "#include <linux/io_uring.h>
    17186 "
    17187 if test "x$ac_cv_have_decl_IORING_OP_CLOSE" = xyes; then :
    17188   $as_echo "#define CFA_HAVE_IORING_OP_CLOSE 1" >>confdefs.h
    17189 
    17190 fi
    17191 
    17192 
    17193                 ac_fn_c_check_decl "$LINENO" "IORING_OP_FILES_UPDATE" "ac_cv_have_decl_IORING_OP_FILES_UPDATE" "#include <linux/io_uring.h>
    17194 "
    17195 if test "x$ac_cv_have_decl_IORING_OP_FILES_UPDATE" = xyes; then :
    17196   $as_echo "#define CFA_HAVE_IORING_OP_FILES_UPDATE 1" >>confdefs.h
    17197 
    17198 fi
    17199 
    17200 
    17201                 ac_fn_c_check_decl "$LINENO" "IORING_OP_STATX" "ac_cv_have_decl_IORING_OP_STATX" "#include <linux/io_uring.h>
    17202 "
    17203 if test "x$ac_cv_have_decl_IORING_OP_STATX" = xyes; then :
    17204   $as_echo "#define CFA_HAVE_IORING_OP_STATX 1" >>confdefs.h
    17205 
    17206 fi
    17207 
    17208 
    17209                 ac_fn_c_check_decl "$LINENO" "IORING_OP_READ" "ac_cv_have_decl_IORING_OP_READ" "#include <linux/io_uring.h>
    17210 "
    17211 if test "x$ac_cv_have_decl_IORING_OP_READ" = xyes; then :
    17212   $as_echo "#define CFA_HAVE_IORING_OP_READ 1" >>confdefs.h
    17213 
    17214 fi
    17215 
    17216 
    17217                 ac_fn_c_check_decl "$LINENO" "IORING_OP_WRITE" "ac_cv_have_decl_IORING_OP_WRITE" "#include <linux/io_uring.h>
    17218 "
    17219 if test "x$ac_cv_have_decl_IORING_OP_WRITE" = xyes; then :
    17220   $as_echo "#define CFA_HAVE_IORING_OP_WRITE 1" >>confdefs.h
    17221 
    17222 fi
    17223 
    17224 
    17225                 ac_fn_c_check_decl "$LINENO" "IORING_OP_FADVISE" "ac_cv_have_decl_IORING_OP_FADVISE" "#include <linux/io_uring.h>
    17226 "
    17227 if test "x$ac_cv_have_decl_IORING_OP_FADVISE" = xyes; then :
    17228   $as_echo "#define CFA_HAVE_IORING_OP_FADVISE 1" >>confdefs.h
    17229 
    17230 fi
    17231 
    17232 
    17233                 ac_fn_c_check_decl "$LINENO" "IORING_OP_MADVISE" "ac_cv_have_decl_IORING_OP_MADVISE" "#include <linux/io_uring.h>
    17234 "
    17235 if test "x$ac_cv_have_decl_IORING_OP_MADVISE" = xyes; then :
    17236   $as_echo "#define CFA_HAVE_IORING_OP_MADVISE 1" >>confdefs.h
    17237 
    17238 fi
    17239 
    17240 
    17241                 ac_fn_c_check_decl "$LINENO" "IORING_OP_SEND" "ac_cv_have_decl_IORING_OP_SEND" "#include <linux/io_uring.h>
    17242 "
    17243 if test "x$ac_cv_have_decl_IORING_OP_SEND" = xyes; then :
    17244   $as_echo "#define CFA_HAVE_IORING_OP_SEND 1" >>confdefs.h
    17245 
    17246 fi
    17247 
    17248 
    17249                 ac_fn_c_check_decl "$LINENO" "IORING_OP_RECV" "ac_cv_have_decl_IORING_OP_RECV" "#include <linux/io_uring.h>
    17250 "
    17251 if test "x$ac_cv_have_decl_IORING_OP_RECV" = xyes; then :
    17252   $as_echo "#define CFA_HAVE_IORING_OP_RECV 1" >>confdefs.h
    17253 
    17254 fi
    17255 
    17256 
    17257                 ac_fn_c_check_decl "$LINENO" "IORING_OP_OPENAT2" "ac_cv_have_decl_IORING_OP_OPENAT2" "#include <linux/io_uring.h>
    17258 "
    17259 if test "x$ac_cv_have_decl_IORING_OP_OPENAT2" = xyes; then :
    17260   $as_echo "#define CFA_HAVE_IORING_OP_OPENAT2 1" >>confdefs.h
    17261 
    17262 fi
    17263 
    17264 
    17265                 ac_fn_c_check_decl "$LINENO" "IORING_OP_EPOLL_CTL" "ac_cv_have_decl_IORING_OP_EPOLL_CTL" "#include <linux/io_uring.h>
    17266 "
    17267 if test "x$ac_cv_have_decl_IORING_OP_EPOLL_CTL" = xyes; then :
    17268   $as_echo "#define CFA_HAVE_IORING_OP_EPOLL_CTL 1" >>confdefs.h
    17269 
    17270 fi
    17271 
    17272 
    17273                 ac_fn_c_check_decl "$LINENO" "IORING_OP_SPLICE" "ac_cv_have_decl_IORING_OP_SPLICE" "#include <linux/io_uring.h>
    17274 "
    17275 if test "x$ac_cv_have_decl_IORING_OP_SPLICE" = xyes; then :
    17276   $as_echo "#define CFA_HAVE_IORING_OP_SPLICE 1" >>confdefs.h
    17277 
    17278 fi
    17279 
    17280 
    17281                 ac_fn_c_check_decl "$LINENO" "IORING_OP_PROVIDE_BUFFERS" "ac_cv_have_decl_IORING_OP_PROVIDE_BUFFERS" "#include <linux/io_uring.h>
    17282 "
    17283 if test "x$ac_cv_have_decl_IORING_OP_PROVIDE_BUFFERS" = xyes; then :
    17284   $as_echo "#define CFA_HAVE_IORING_OP_PROVIDE_BUFFERS 1" >>confdefs.h
    17285 
    17286 fi
    17287 
    17288 
    17289                 ac_fn_c_check_decl "$LINENO" "IORING_OP_REMOVE_BUFFER" "ac_cv_have_decl_IORING_OP_REMOVE_BUFFER" "#include <linux/io_uring.h>
    17290 "
    17291 if test "x$ac_cv_have_decl_IORING_OP_REMOVE_BUFFER" = xyes; then :
    17292   $as_echo "#define CFA_HAVE_IORING_OP_REMOVE_BUFFER 1" >>confdefs.h
    17293 
    17294 fi
    17295 
    17296 
    1729716971
    1729816972fi
     
    1805417728# INIT-COMMANDS
    1805517729#
    18056 AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
     17730AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
    1805717731
    1805817732
     
    1905018724  # are listed without --file.  Let's play safe and only enable the eval
    1905118725  # if we detect the quoting.
    19052   # TODO: see whether this extra hack can be removed once we start
    19053   # requiring Autoconf 2.70 or later.
    19054   case $CONFIG_FILES in #(
    19055   *\'*) :
    19056     eval set x "$CONFIG_FILES" ;; #(
    19057   *) :
    19058     set x $CONFIG_FILES ;; #(
    19059   *) :
    19060      ;;
    19061 esac
     18726  case $CONFIG_FILES in
     18727  *\'*) eval set x "$CONFIG_FILES" ;;
     18728  *)   set x $CONFIG_FILES ;;
     18729  esac
    1906218730  shift
    19063   # Used to flag and report bootstrapping failures.
    19064   am_rc=0
    19065   for am_mf
     18731  for mf
    1906618732  do
    1906718733    # Strip MF so we end up with the name of the file.
    19068     am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
    19069     # Check whether this is an Automake generated Makefile which includes
    19070     # dependency-tracking related rules and includes.
    19071     # Grep'ing the whole file directly is not great: AIX grep has a line
     18734    mf=`echo "$mf" | sed -e 's/:.*$//'`
     18735    # Check whether this is an Automake generated Makefile or not.
     18736    # We used to match only the files named 'Makefile.in', but
     18737    # some people rename them; so instead we look at the file content.
     18738    # Grep'ing the first line is not enough: some people post-process
     18739    # each Makefile.in and add a new line on top of each file to say so.
     18740    # Grep'ing the whole file is not good either: AIX grep has a line
    1907218741    # limit of 2048, but all sed's we know have understand at least 4000.
    19073     sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
    19074       || continue
    19075     am_dirpart=`$as_dirname -- "$am_mf" ||
    19076 $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
    19077          X"$am_mf" : 'X\(//\)[^/]' \| \
    19078          X"$am_mf" : 'X\(//\)$' \| \
    19079          X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
    19080 $as_echo X"$am_mf" |
     18742    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
     18743      dirpart=`$as_dirname -- "$mf" ||
     18744$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
     18745         X"$mf" : 'X\(//\)[^/]' \| \
     18746         X"$mf" : 'X\(//\)$' \| \
     18747         X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
     18748$as_echo X"$mf" |
    1908118749    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
    1908218750            s//\1/
     
    1909618764          }
    1909718765          s/.*/./; q'`
    19098     am_filepart=`$as_basename -- "$am_mf" ||
    19099 $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
    19100          X"$am_mf" : 'X\(//\)$' \| \
    19101          X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
    19102 $as_echo X/"$am_mf" |
    19103     sed '/^.*\/\([^/][^/]*\)\/*$/{
     18766    else
     18767      continue
     18768    fi
     18769    # Extract the definition of DEPDIR, am__include, and am__quote
     18770    # from the Makefile without running 'make'.
     18771    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     18772    test -z "$DEPDIR" && continue
     18773    am__include=`sed -n 's/^am__include = //p' < "$mf"`
     18774    test -z "$am__include" && continue
     18775    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
     18776    # Find all dependency output files, they are included files with
     18777    # $(DEPDIR) in their names.  We invoke sed twice because it is the
     18778    # simplest approach to changing $(DEPDIR) to its actual value in the
     18779    # expansion.
     18780    for file in `sed -n "
     18781      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
     18782         sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
     18783      # Make sure the directory exists.
     18784      test -f "$dirpart/$file" && continue
     18785      fdir=`$as_dirname -- "$file" ||
     18786$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
     18787         X"$file" : 'X\(//\)[^/]' \| \
     18788         X"$file" : 'X\(//\)$' \| \
     18789         X"$file" : 'X\(/\)' \| . 2>/dev/null ||
     18790$as_echo X"$file" |
     18791    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
    1910418792            s//\1/
    1910518793            q
    1910618794          }
    19107           /^X\/\(\/\/\)$/{
     18795          /^X\(\/\/\)[^/].*/{
    1910818796            s//\1/
    1910918797            q
    1911018798          }
    19111           /^X\/\(\/\).*/{
     18799          /^X\(\/\/\)$/{
     18800            s//\1/
     18801            q
     18802          }
     18803          /^X\(\/\).*/{
    1911218804            s//\1/
    1911318805            q
    1911418806          }
    1911518807          s/.*/./; q'`
    19116     { echo "$as_me:$LINENO: cd "$am_dirpart" \
    19117       && sed -e '/# am--include-marker/d' "$am_filepart" \
    19118         | $MAKE -f - am--depfiles" >&5
    19119    (cd "$am_dirpart" \
    19120       && sed -e '/# am--include-marker/d' "$am_filepart" \
    19121         | $MAKE -f - am--depfiles) >&5 2>&5
    19122    ac_status=$?
    19123    echo "$as_me:$LINENO: \$? = $ac_status" >&5
    19124    (exit $ac_status); } || am_rc=$?
     18808      as_dir=$dirpart/$fdir; as_fn_mkdir_p
     18809      # echo "creating $dirpart/$file"
     18810      echo '# dummy' > "$dirpart/$file"
     18811    done
    1912518812  done
    19126   if test $am_rc -ne 0; then
    19127     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    19128 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    19129 as_fn_error $? "Something went wrong bootstrapping makefile fragments
    19130     for automatic dependency tracking.  Try re-running configure with the
    19131     '--disable-dependency-tracking' option to at least be able to build
    19132     the package (albeit without support for automatic dependency tracking).
    19133 See \`config.log' for more details" "$LINENO" 5; }
    19134   fi
    19135   { am_dirpart=; unset am_dirpart;}
    19136   { am_filepart=; unset am_filepart;}
    19137   { am_mf=; unset am_mf;}
    19138   { am_rc=; unset am_rc;}
    19139   rm -f conftest-deps.mk
    1914018813}
    1914118814 ;;
     
    1915518828#! $SHELL
    1915618829# Generated automatically by $as_me ($PACKAGE) $VERSION
     18830# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
    1915718831# NOTE: Changes made to this file will be lost: look at ltmain.sh.
    1915818832
  • libcfa/configure.ac

    r54eb5ebd rf19fbbc  
    123123AC_PROG_MAKE_SET
    124124
    125 
    126 
    127 #io_uring 5.4 and earlier uses defines
    128 #io_uring 5.5 uses enum values
    129 #io_uring 5.6 and later uses probes
    130 
    131 AC_CHECK_HEADERS([linux/io_uring.h], [
    132         AC_DEFINE(CFA_HAVE_LINUX_IO_URING_H)
    133         # AC_CHECK_HEADER([liburing.h], [
    134         #       AC_CHECK_LIB([uring], [io_uring_get_probe])
    135         # ])
    136         m4_foreach([op], [IORING_OP_NOP,IORING_OP_READV,IORING_OP_WRITEV,IORING_OP_FSYNC,IORING_OP_READ_FIXED,IORING_OP_WRITE_FIXED,IORING_OP_POLL_ADD,IORING_OP_POLL_REMOVE,IORING_OP_SYNC_FILE_RANGE,IORING_OP_SENDMSG,IORING_OP_RECVMSG,IORING_OP_TIMEOUT,IORING_OP_TIMEOUT_REMOVE,IORING_OP_ACCEPT,IORING_OP_ASYNC_CANCEL,IORING_OP_LINK_TIMEOUT,IORING_OP_CONNECT,IORING_OP_FALLOCATE,IORING_OP_OPENAT,IORING_OP_CLOSE,IORING_OP_FILES_UPDATE,IORING_OP_STATX,IORING_OP_READ,IORING_OP_WRITE,IORING_OP_FADVISE,IORING_OP_MADVISE,IORING_OP_SEND,IORING_OP_RECV,IORING_OP_OPENAT2,IORING_OP_EPOLL_CTL,IORING_OP_SPLICE,IORING_OP_PROVIDE_BUFFERS,IORING_OP_REMOVE_BUFFER], [
    137                 AC_CHECK_DECL(op, [AC_DEFINE([CFA_HAVE_]op)], [], [[#include <linux/io_uring.h>]])
    138         ])
    139 ])
     125AC_CHECK_HEADERS([linux/io_uring.h])
    140126AC_CHECK_FUNCS([preadv2 pwritev2])
    141127
  • libcfa/prelude/defines.hfa.in

    r54eb5ebd rf19fbbc  
    1414//
    1515
    16 #undef CFA_HAVE_LINUX_IO_URING_H
    17 
    18 #undef CFA_HAVE_IORING_OP_NOP
    19 #undef CFA_HAVE_IORING_OP_READV
    20 #undef CFA_HAVE_IORING_OP_WRITEV
    21 #undef CFA_HAVE_IORING_OP_FSYNC
    22 #undef CFA_HAVE_IORING_OP_READ_FIXED
    23 #undef CFA_HAVE_IORING_OP_WRITE_FIXED
    24 #undef CFA_HAVE_IORING_OP_POLL_ADD
    25 #undef CFA_HAVE_IORING_OP_POLL_REMOVE
    26 #undef CFA_HAVE_IORING_OP_SYNC_FILE_RANGE
    27 #undef CFA_HAVE_IORING_OP_SENDMSG
    28 #undef CFA_HAVE_IORING_OP_RECVMSG
    29 #undef CFA_HAVE_IORING_OP_TIMEOUT
    30 #undef CFA_HAVE_IORING_OP_TIMEOUT_REMOVE
    31 #undef CFA_HAVE_IORING_OP_ACCEPT
    32 #undef CFA_HAVE_IORING_OP_ASYNC_CANCEL
    33 #undef CFA_HAVE_IORING_OP_LINK_TIMEOUT
    34 #undef CFA_HAVE_IORING_OP_CONNECT
    35 #undef CFA_HAVE_IORING_OP_FALLOCATE
    36 #undef CFA_HAVE_IORING_OP_OPENAT
    37 #undef CFA_HAVE_IORING_OP_CLOSE
    38 #undef CFA_HAVE_IORING_OP_FILES_UPDATE
    39 #undef CFA_HAVE_IORING_OP_STATX
    40 #undef CFA_HAVE_IORING_OP_READ
    41 #undef CFA_HAVE_IORING_OP_WRITE
    42 #undef CFA_HAVE_IORING_OP_FADVISE
    43 #undef CFA_HAVE_IORING_OP_MADVISE
    44 #undef CFA_HAVE_IORING_OP_SEND
    45 #undef CFA_HAVE_IORING_OP_RECV
    46 #undef CFA_HAVE_IORING_OP_OPENAT2
    47 #undef CFA_HAVE_IORING_OP_EPOLL_CTL
    48 #undef CFA_HAVE_IORING_OP_SPLICE
    49 #undef CFA_HAVE_IORING_OP_PROVIDE_BUFFERS
    50 #undef CFA_HAVE_IORING_OP_REMOVE_BUFFER
     16#undef HAVE_LINUX_IO_URING_H
    5117
    5218#undef HAVE_PREADV2
  • libcfa/src/concurrency/io.cfa

    r54eb5ebd rf19fbbc  
    1616#if defined(__CFA_DEBUG__)
    1717        // #define __CFA_DEBUG_PRINT_IO__
    18         // #define __CFA_DEBUG_PRINT_IO_CORE__
     18        #define __CFA_DEBUG_PRINT_IO_CORE__
    1919#endif
    2020
     
    2222#include "bitmanip.hfa"
    2323
    24 #if !defined(CFA_HAVE_LINUX_IO_URING_H)
     24#if !defined(HAVE_LINUX_IO_URING_H)
    2525        void __kernel_io_startup( cluster &, unsigned, bool ) {
    2626                // Nothing to do without io_uring
     
    490490        static uint32_t __release_consumed_submission( struct __io_data & ring );
    491491
    492         static inline void process(struct io_uring_cqe & cqe, struct __processor_id_t * id ) {
    493                 struct __io_user_data_t * data = (struct __io_user_data_t *)(uintptr_t)cqe.user_data;
    494                 __cfadbg_print_safe( io, "Kernel I/O : Syscall completed : cqe %p, result %d for %p\n", data, cqe.res, data->thrd );
    495 
    496                 data->result = cqe.res;
    497                 if(!id) { unpark(     data->thrd __cfaabi_dbg_ctx2 ); }
    498                 else  { __unpark( id, data->thrd __cfaabi_dbg_ctx2 ); }
    499         }
    500 
    501492        // Process a single completion message from the io_uring
    502493        // This is NOT thread-safe
     
    547538                        /* paranoid */ verify(&cqe);
    548539
    549                         process( cqe, !mask ? (struct __processor_id_t *)0p : &ring.poller.slow.id );
     540                        struct __io_user_data_t * data = (struct __io_user_data_t *)(uintptr_t)cqe.user_data;
     541                        __cfadbg_print_safe( io, "Kernel I/O : Performed reading io cqe %p, result %d for %p\n", data, cqe.res, data->thrd );
     542
     543                        data->result = cqe.res;
     544                        if(!mask) { unpark( data->thrd __cfaabi_dbg_ctx2 ); }
     545                        else      { __unpark( &ring.poller.slow.id, data->thrd __cfaabi_dbg_ctx2 ); }
    550546                }
    551547
  • libcfa/src/concurrency/iocall.cfa

    r54eb5ebd rf19fbbc  
    2020//=============================================================================================
    2121
    22 #if defined(CFA_HAVE_LINUX_IO_URING_H)
     22#if defined(HAVE_LINUX_IO_URING_H)
    2323        #include <stdint.h>
    2424        #include <linux/io_uring.h>
     
    122122#if defined(HAVE_PREADV2)
    123123        ssize_t cfa_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags) {
    124                 #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_READV)
     124                #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_READV)
    125125                        return preadv2(fd, iov, iovcnt, offset, flags);
    126126                #else
     
    134134
    135135        ssize_t cfa_preadv2_fixed(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags) {
    136                 #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_READV)
     136                #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_READV)
    137137                        return preadv2(fd, iov, iovcnt, offset, flags);
    138138                #else
     
    149149#if defined(HAVE_PWRITEV2)
    150150        ssize_t cfa_pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags) {
    151                 #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_WRITEV)
     151                #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_WRITEV)
    152152                        return pwritev2(fd, iov, iovcnt, offset, flags);
    153153                #else
     
    162162
    163163int cfa_fsync(int fd) {
    164         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_FSYNC)
     164        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_FSYNC)
    165165                return fsync(fd);
    166166        #else
     
    174174
    175175int cfa_sync_file_range(int fd, int64_t offset, int64_t nbytes, unsigned int flags) {
    176         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_SYNC_FILE_RANGE)
     176        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_SYNC_FILE_RANGE)
    177177                return sync_file_range(fd, offset, nbytes, flags);
    178178        #else
     
    190190
    191191ssize_t cfa_sendmsg(int sockfd, const struct msghdr *msg, int flags) {
    192         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_SENDMSG)
     192        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_SENDMSG)
    193193                return sendmsg(sockfd, msg, flags);
    194194        #else
     
    203203
    204204ssize_t cfa_recvmsg(int sockfd, struct msghdr *msg, int flags) {
    205         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_RECVMSG)
     205        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_RECVMSG)
    206206                return recvmsg(sockfd, msg, flags);
    207207        #else
     
    216216
    217217ssize_t cfa_send(int sockfd, const void *buf, size_t len, int flags) {
    218         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_SEND)
     218        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_SEND)
    219219                return send( sockfd, buf, len, flags );
    220220        #else
     
    231231
    232232ssize_t cfa_recv(int sockfd, void *buf, size_t len, int flags) {
    233         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_RECV)
     233        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_RECV)
    234234                return recv( sockfd, buf, len, flags );
    235235        #else
     
    246246
    247247int cfa_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags) {
    248         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_ACCEPT)
     248        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_ACCEPT)
    249249                return accept4( sockfd, addr, addrlen, flags );
    250250        #else
     
    261261
    262262int cfa_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
    263         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_CONNECT)
     263        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_CONNECT)
    264264                return connect( sockfd, addr, addrlen );
    265265        #else
     
    275275
    276276int cfa_fallocate(int fd, int mode, uint64_t offset, uint64_t len) {
    277         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_FALLOCATE)
     277        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_FALLOCATE)
    278278                return fallocate( fd, mode, offset, len );
    279279        #else
     
    290290
    291291int cfa_fadvise(int fd, uint64_t offset, uint64_t len, int advice) {
    292         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_FADVISE)
     292        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_FADVISE)
    293293                return posix_fadvise( fd, offset, len, advice );
    294294        #else
     
    305305
    306306int cfa_madvise(void *addr, size_t length, int advice) {
    307         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_MADVISE)
     307        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_MADVISE)
    308308                return madvise( addr, length, advice );
    309309        #else
     
    320320
    321321int cfa_openat(int dirfd, const char *pathname, int flags, mode_t mode) {
    322         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_OPENAT)
     322        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_OPENAT)
    323323                return openat( dirfd, pathname, flags, mode );
    324324        #else
     
    335335
    336336int cfa_close(int fd) {
    337         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_CLOSE)
     337        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_CLOSE)
    338338                return close( fd );
    339339        #else
     
    349349struct statx;
    350350int cfa_statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf) {
    351         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_STATX)
     351        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_STATX)
    352352                #if defined(__NR_statx)
    353353                        return syscall( __NR_statx, dirfd, pathname, flags, mask, statxbuf );
     
    367367
    368368ssize_t cfa_read(int fd, void *buf, size_t count) {
    369         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_READ)
     369        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_READ)
    370370                return read( fd, buf, count );
    371371        #else
     
    379379
    380380ssize_t cfa_write(int fd, void *buf, size_t count) {
    381         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_WRITE)
     381        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_WRITE)
    382382                return read( fd, buf, count );
    383383        #else
     
    391391
    392392ssize_t cfa_splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags) {
    393         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_SPLICE)
     393        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_SPLICE)
    394394                return splice( fd_in, off_in, fd_out, off_out, len, flags );
    395395        #else
     
    405405}
    406406
    407 ssize_t cfa_splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags, int in_flags, int out_flags) {
    408         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_SPLICE)
    409                 return splice( fd_in, off_in, fd_out, off_out, len, flags );
    410         #else
    411                 __submit_prelude
    412 
    413                 (*sqe){ IORING_OP_SPLICE, fd_out, 0p, len, off_out };
    414                 sqe->splice_fd_in  = fd_in;
    415                 sqe->splice_off_in = off_in;
    416                 sqe->splice_flags  = flags | out_flags;
    417                 sqe->flags = in_flags;
    418 
    419                 __submit_wait
    420         #endif
    421 }
    422 
    423407ssize_t cfa_tee(int fd_in, int fd_out, size_t len, unsigned int flags) {
    424         #if !defined(CFA_HAVE_LINUX_IO_URING_H) || !defined(CFA_HAVE_IORING_OP_TEE)
     408        #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_TEE)
    425409                return tee( fd_in, fd_out, len, flags );
    426410        #else
     
    445429
    446430bool has_user_level_blocking( fptr_t func ) {
    447         #if defined(CFA_HAVE_LINUX_IO_URING_H)
     431        #if defined(HAVE_LINUX_IO_URING_H)
    448432                #if defined(HAVE_PREADV2)
    449433                        if( /*func == (fptr_t)preadv2 || */
    450434                                func == (fptr_t)cfa_preadv2 )
    451                                 #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_READV ,
    452                                 return IS_DEFINED(CFA_HAVE_IORING_OP_READV);
     435                                #define _CFA_IO_FEATURE_IORING_OP_READV ,
     436                                return IS_DEFINED(IORING_OP_READV);
    453437                #endif
    454438
     
    456440                        if( /*func == (fptr_t)pwritev2 || */
    457441                                func == (fptr_t)cfa_pwritev2 )
    458                                 #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_WRITEV ,
    459                                 return IS_DEFINED(CFA_HAVE_IORING_OP_WRITEV);
     442                                #define _CFA_IO_FEATURE_IORING_OP_WRITEV ,
     443                                return IS_DEFINED(IORING_OP_WRITEV);
    460444                #endif
    461445
    462446                if( /*func == (fptr_t)fsync || */
    463447                        func == (fptr_t)cfa_fsync )
    464                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_FSYNC ,
    465                         return IS_DEFINED(CFA_HAVE_IORING_OP_FSYNC);
     448                        #define _CFA_IO_FEATURE_IORING_OP_FSYNC ,
     449                        return IS_DEFINED(IORING_OP_FSYNC);
    466450
    467451                if( /*func == (fptr_t)ync_file_range || */
    468452                        func == (fptr_t)cfa_sync_file_range )
    469                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_SYNC_FILE_RANGE ,
    470                         return IS_DEFINED(CFA_HAVE_IORING_OP_SYNC_FILE_RANGE);
     453                        #define _CFA_IO_FEATURE_IORING_OP_SYNC_FILE_RANGE ,
     454                        return IS_DEFINED(IORING_OP_SYNC_FILE_RANGE);
    471455
    472456                if( /*func == (fptr_t)sendmsg || */
    473457                        func == (fptr_t)cfa_sendmsg )
    474                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_SENDMSG ,
    475                         return IS_DEFINED(CFA_HAVE_IORING_OP_SENDMSG);
     458                        #define _CFA_IO_FEATURE_IORING_OP_SENDMSG ,
     459                        return IS_DEFINED(IORING_OP_SENDMSG);
    476460
    477461                if( /*func == (fptr_t)recvmsg || */
    478462                        func == (fptr_t)cfa_recvmsg )
    479                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_RECVMSG ,
    480                         return IS_DEFINED(CFA_HAVE_IORING_OP_RECVMSG);
     463                        #define _CFA_IO_FEATURE_IORING_OP_RECVMSG ,
     464                        return IS_DEFINED(IORING_OP_RECVMSG);
    481465
    482466                if( /*func == (fptr_t)send || */
    483467                        func == (fptr_t)cfa_send )
    484                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_SEND ,
    485                         return IS_DEFINED(CFA_HAVE_IORING_OP_SEND);
     468                        #define _CFA_IO_FEATURE_IORING_OP_SEND ,
     469                        return IS_DEFINED(IORING_OP_SEND);
    486470
    487471                if( /*func == (fptr_t)recv || */
    488472                        func == (fptr_t)cfa_recv )
    489                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_RECV ,
    490                         return IS_DEFINED(CFA_HAVE_IORING_OP_RECV);
     473                        #define _CFA_IO_FEATURE_IORING_OP_RECV ,
     474                        return IS_DEFINED(IORING_OP_RECV);
    491475
    492476                if( /*func == (fptr_t)accept4 || */
    493477                        func == (fptr_t)cfa_accept4 )
    494                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_ACCEPT ,
    495                         return IS_DEFINED(CFA_HAVE_IORING_OP_ACCEPT);
     478                        #define _CFA_IO_FEATURE_IORING_OP_ACCEPT ,
     479                        return IS_DEFINED(IORING_OP_ACCEPT);
    496480
    497481                if( /*func == (fptr_t)connect || */
    498482                        func == (fptr_t)cfa_connect )
    499                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_CONNECT ,
    500                         return IS_DEFINED(CFA_HAVE_IORING_OP_CONNECT);
     483                        #define _CFA_IO_FEATURE_IORING_OP_CONNECT ,
     484                        return IS_DEFINED(IORING_OP_CONNECT);
    501485
    502486                if( /*func == (fptr_t)fallocate || */
    503487                        func == (fptr_t)cfa_fallocate )
    504                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_FALLOCATE ,
    505                         return IS_DEFINED(CFA_HAVE_IORING_OP_FALLOCATE);
     488                        #define _CFA_IO_FEATURE_IORING_OP_FALLOCATE ,
     489                        return IS_DEFINED(IORING_OP_FALLOCATE);
    506490
    507491                if( /*func == (fptr_t)posix_fadvise || */
    508492                        func == (fptr_t)cfa_fadvise )
    509                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_FADVISE ,
    510                         return IS_DEFINED(CFA_HAVE_IORING_OP_FADVISE);
     493                        #define _CFA_IO_FEATURE_IORING_OP_FADVISE ,
     494                        return IS_DEFINED(IORING_OP_FADVISE);
    511495
    512496                if( /*func == (fptr_t)madvise || */
    513497                        func == (fptr_t)cfa_madvise )
    514                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_MADVISE ,
    515                         return IS_DEFINED(CFA_HAVE_IORING_OP_MADVISE);
     498                        #define _CFA_IO_FEATURE_IORING_OP_MADVISE ,
     499                        return IS_DEFINED(IORING_OP_MADVISE);
    516500
    517501                if( /*func == (fptr_t)openat || */
    518502                        func == (fptr_t)cfa_openat )
    519                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_OPENAT ,
    520                         return IS_DEFINED(CFA_HAVE_IORING_OP_OPENAT);
     503                        #define _CFA_IO_FEATURE_IORING_OP_OPENAT ,
     504                        return IS_DEFINED(IORING_OP_OPENAT);
    521505
    522506                if( /*func == (fptr_t)close || */
    523507                        func == (fptr_t)cfa_close )
    524                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_CLOSE ,
    525                         return IS_DEFINED(CFA_HAVE_IORING_OP_CLOSE);
     508                        #define _CFA_IO_FEATURE_IORING_OP_CLOSE ,
     509                        return IS_DEFINED(IORING_OP_CLOSE);
    526510
    527511                if( /*func == (fptr_t)read || */
    528512                        func == (fptr_t)cfa_read )
    529                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_READ ,
    530                         return IS_DEFINED(CFA_HAVE_IORING_OP_READ);
     513                        #define _CFA_IO_FEATURE_IORING_OP_READ ,
     514                        return IS_DEFINED(IORING_OP_READ);
    531515
    532516                if( /*func == (fptr_t)write || */
    533517                        func == (fptr_t)cfa_write )
    534                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_WRITE ,
    535                         return IS_DEFINED(CFA_HAVE_IORING_OP_WRITE);
     518                        #define _CFA_IO_FEATURE_IORING_OP_WRITE ,
     519                        return IS_DEFINED(IORING_OP_WRITE);
    536520
    537521                if( /*func == (fptr_t)splice || */
    538                         func == (fptr_t)(ssize_t (*)(int, loff_t *, int, loff_t *, size_t, unsigned int))cfa_splice,
    539                         func == (fptr_t)(ssize_t (*)(int, loff_t *, int, loff_t *, size_t, unsigned int, int, int))cfa_splice )
    540                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_SPLICE ,
    541                         return IS_DEFINED(CFA_HAVE_IORING_OP_SPLICE);
     522                        func == (fptr_t)cfa_splice )
     523                        #define _CFA_IO_FEATURE_IORING_OP_SPLICE ,
     524                        return IS_DEFINED(IORING_OP_SPLICE);
    542525
    543526                if( /*func == (fptr_t)tee || */
    544527                        func == (fptr_t)cfa_tee )
    545                         #define _CFA_IO_FEATURE_CFA_HAVE_IORING_OP_TEE ,
    546                         return IS_DEFINED(CFA_HAVE_IORING_OP_TEE);
     528                        #define _CFA_IO_FEATURE_IORING_OP_TEE ,
     529                        return IS_DEFINED(IORING_OP_TEE);
    547530        #endif
    548531
  • libcfa/src/concurrency/kernel.cfa

    r54eb5ebd rf19fbbc  
    228228static void * __invoke_processor(void * arg);
    229229
    230 static init(processor & this, const char name[], cluster & _cltr) with( this ) {
     230void ?{}(processor & this, const char name[], cluster & _cltr) with( this ) {
    231231        this.name = name;
    232232        this.cltr = &_cltr;
    233233        id = -1u;
     234        terminated{ 0 };
    234235        destroyer = 0p;
    235236        do_terminate = false;
    236237        preemption_alarm = 0p;
    237238        pending_preemption = false;
     239        runner.proc = &this;
    238240
    239241        #if !defined(__CFA_NO_STATISTICS__)
     
    242244        #endif
    243245
     246        idle{};
     247
     248        __cfadbg_print_safe(runtime_core, "Kernel : Starting core %p\n", &this);
     249
     250        this.stack = __create_pthread( &this.kernel_thread, __invoke_processor, (void *)&this );
    244251        __atomic_fetch_add( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST );
    245252
    246         id = doregister((__processor_id_t*)&this);
    247 
    248         // Lock the RWlock so no-one pushes/pops while we are changing the queue
    249         uint_fast32_t last_size = ready_mutate_lock();
    250 
    251                 // Adjust the ready queue size
    252                 ready_queue_grow( cltr );
    253 
    254         // Unlock the RWlock
    255         ready_mutate_unlock( last_size );
    256 
    257253        __cfadbg_print_safe(runtime_core, "Kernel : core %p created\n", &this);
    258 }
    259 
    260 // Not a ctor, it just preps the destruction but should not destroy members
    261 void deinit(processor & this) {
    262         // Lock the RWlock so no-one pushes/pops while we are changing the queue
    263         uint_fast32_t last_size = ready_mutate_lock();
    264 
    265                 // Adjust the ready queue size
    266                 ready_queue_shrink( this.cltr );
    267 
    268                 // Make sure we aren't on the idle queue
    269                 unsafe_remove( this.cltr->idles, &this );
    270 
    271         // Unlock the RWlock
    272         ready_mutate_unlock( last_size );
    273 
    274         // Finally we don't need the read_lock any more
    275         unregister((__processor_id_t*)&this);
    276 }
    277 
    278 void ?{}(processor & this, const char name[], cluster & _cltr) {
    279         ( this.idle ){};
    280         ( this.terminated ){ 0 };
    281         ( this.runner ){};
    282         init( this, name, _cltr );
    283 
    284         __cfadbg_print_safe(runtime_core, "Kernel : Starting core %p\n", &this);
    285 
    286         this.stack = __create_pthread( &this.kernel_thread, __invoke_processor, (void *)&this );
    287 
    288254}
    289255
     
    303269
    304270        free( this.stack );
    305 
    306         deinit( this );
    307271
    308272        __atomic_fetch_sub( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST );
     
    354318
    355319        __cfadbg_print_safe(runtime_core, "Kernel : core %p starting\n", this);
    356         #if !defined(__CFA_NO_STATISTICS__)
    357                 if( this->print_halts ) {
    358                         __cfaabi_bits_print_safe( STDOUT_FILENO, "Processor : %d - %s (%p)\n", this->id, this->name, (void*)this);
    359                 }
    360         #endif
     320
     321        // register the processor unless it's the main thread which is handled in the boot sequence
     322        if(this != mainProcessor) {
     323                this->id = doregister((__processor_id_t*)this);
     324                #if !defined(__CFA_NO_STATISTICS__)
     325                        if( this->print_halts ) {
     326                                __cfaabi_bits_print_safe( STDOUT_FILENO, "Processor : %d - %s (%p)\n", this->id, this->name, (void*)this);
     327                        }
     328                #endif
     329
     330                // Lock the RWlock so no-one pushes/pops while we are changing the queue
     331                uint_fast32_t last_size = ready_mutate_lock();
     332
     333                        // Adjust the ready queue size
     334                        ready_queue_grow( this->cltr );
     335
     336                // Unlock the RWlock
     337                ready_mutate_unlock( last_size );
     338        }
    361339
    362340        {
     
    397375        V( this->terminated );
    398376
    399         if(this == mainProcessor) {
     377        // unregister the processor unless it's the main thread which is handled in the boot sequence
     378        if(this != mainProcessor) {
     379                // Lock the RWlock so no-one pushes/pops while we are changing the queue
     380                uint_fast32_t last_size = ready_mutate_lock();
     381
     382                        // Adjust the ready queue size
     383                        ready_queue_shrink( this->cltr );
     384
     385                        // Make sure we aren't on the idle queue
     386                        #if !defined(__CFA_NO_STATISTICS__)
     387                                bool removed =
     388                        #endif
     389                        unsafe_remove( this->cltr->idles, this );
     390
     391                        #if !defined(__CFA_NO_STATISTICS__)
     392                                if(removed) __tls_stats()->ready.sleep.exits++;
     393                        #endif
     394
     395                // Unlock the RWlock
     396                ready_mutate_unlock( last_size );
     397
     398                // Finally we don't need the read_lock any more
     399                unregister((__processor_id_t*)this);
     400        }
     401        else {
    400402                // HACK : the coroutine context switch expects this_thread to be set
    401403                // and it make sense for it to be set in all other cases except here
     
    857859
    858860        void ?{}(processor & this) with( this ) {
    859                 ( this.idle ){};
    860                 ( this.terminated ){ 0 };
    861                 ( this.runner ){};
    862                 init( this, "Main Processor", *mainCluster );
     861                name = "Main Processor";
     862                cltr = mainCluster;
     863                terminated{ 0 };
     864                do_terminate = false;
     865                preemption_alarm = 0p;
     866                pending_preemption = false;
    863867                kernel_thread = pthread_self();
     868                id = -1u;
     869
     870                #if !defined(__CFA_NO_STATISTICS__)
     871                        print_stats = false;
     872                        print_halts = false;
     873                #endif
    864874
    865875                runner{ &this };
    866876                __cfadbg_print_safe(runtime_core, "Kernel : constructed main processor context %p\n", &runner);
     877
     878                __atomic_fetch_add( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST );
    867879        }
    868880
     
    871883        mainProcessor = (processor *)&storage_mainProcessor;
    872884        (*mainProcessor){};
     885
     886        mainProcessor->id = doregister( (__processor_id_t*)mainProcessor);
    873887
    874888        //initialize the global state variables
     
    930944        kernel_stop_preemption();
    931945
     946        unregister((__processor_id_t*)mainProcessor);
     947
    932948        // Destroy the main processor and its context in reverse order of construction
    933949        // These were manually constructed so we need manually destroy them
    934950        void ^?{}(processor & this) with( this ){
    935                 deinit( this );
    936 
    937951                /* paranoid */ verify( this.do_terminate == true );
    938952                __atomic_fetch_sub( &cltr->nprocessors, 1u, __ATOMIC_SEQ_CST );
  • libcfa/src/concurrency/ready_queue.cfa

    r54eb5ebd rf19fbbc  
    186186//=======================================================================
    187187void ?{}(__ready_queue_t & this) with (this) {
    188         lanes.data  = 0p;
    189         lanes.count = 0;
     188
     189        lanes.data = alloc(4);
     190        for( i; 4 ) {
     191                (lanes.data[i]){};
     192        }
     193        lanes.count = 4;
     194        snzi{ log2( lanes.count / 8 ) };
    190195}
    191196
    192197void ^?{}(__ready_queue_t & this) with (this) {
    193         verify( 0  == lanes.count );
     198        verify( 4  == lanes.count );
    194199        verify( !query( snzi ) );
     200
     201        ^(snzi){};
     202
     203        for( i; 4 ) {
     204                ^(lanes.data[i]){};
     205        }
    195206        free(lanes.data);
    196207}
     
    484495}
    485496
    486 #warning remove when alloc is fixed
    487 forall( dtype T | sized(T) )
    488 static inline T * correct_alloc( T ptr[], size_t dim ) {
    489         if( dim == 0 ) {
    490                 free(ptr);
    491                 return 0p;
    492         }
    493         T * temp = alloc( dim );
    494         if(ptr) {
    495                 memcpy( temp, ptr, dim * sizeof(T));
    496                 free(ptr);
    497         }
    498         return temp;
    499 }
    500 
    501497// Grow the ready queue
    502498void ready_queue_grow  (struct cluster * cltr) {
     
    517513
    518514                // Allocate new array (uses realloc and memcpies the data)
    519                 lanes.data = correct_alloc(lanes.data, ncount);
     515                lanes.data = alloc(lanes.data, ncount);
    520516
    521517                // Fix the moved data
     
    562558                size_t ocount = lanes.count;
    563559                // Check that we have some space left
    564                 if(ocount < 4) abort("Program attempted to destroy more Ready Queues than were created");
     560                if(ocount < 8) abort("Program attempted to destroy more Ready Queues than were created");
    565561
    566562                // reduce the actual count so push doesn't use the old queues
     
    604600
    605601                // Allocate new array (uses realloc and memcpies the data)
    606                 lanes.data = correct_alloc(lanes.data, lanes.count);
     602                lanes.data = alloc(lanes.data, lanes.count);
    607603
    608604                // Fix the moved data
  • libcfa/src/concurrency/snzi.hfa

    r54eb5ebd rf19fbbc  
    120120//--------------------------------------------------
    121121// SNZI object
    122 void  ?{}( __snzi_t & this ) {
    123         this.mask = 0;
    124         this.root = 0;
    125         this.nodes = 0p;
    126 }
    127 
    128122void  ?{}( __snzi_t & this, unsigned depth ) with( this ) {
    129123        mask = (1 << depth) - 1;
  • libcfa/src/concurrency/stats.cfa

    r54eb5ebd rf19fbbc  
    2424                stats->ready.sleep.exits   = 0;
    2525
    26                 #if defined(CFA_HAVE_LINUX_IO_URING_H)
     26                #if defined(HAVE_LINUX_IO_URING_H)
    2727                        stats->io.submit_q.submit_avg.rdy = 0;
    2828                        stats->io.submit_q.submit_avg.csm = 0;
     
    5959                __atomic_fetch_add( &cltr->ready.sleep.exits  , proc->ready.sleep.exits  , __ATOMIC_SEQ_CST );
    6060
    61                 #if defined(CFA_HAVE_LINUX_IO_URING_H)
     61                #if defined(HAVE_LINUX_IO_URING_H)
    6262                        __atomic_fetch_add( &cltr->io.submit_q.submit_avg.rdy          , proc->io.submit_q.submit_avg.rdy          , __ATOMIC_SEQ_CST );
    6363                        __atomic_fetch_add( &cltr->io.submit_q.submit_avg.csm          , proc->io.submit_q.submit_avg.csm          , __ATOMIC_SEQ_CST );
     
    121121                }
    122122
    123                 #if defined(CFA_HAVE_LINUX_IO_URING_H)
     123                #if defined(HAVE_LINUX_IO_URING_H)
    124124                        if( flags & CFA_STATS_IO ) {
    125125                                double avgrdy = ((double)io.submit_q.submit_avg.rdy) / io.submit_q.submit_avg.cnt;
  • libcfa/src/concurrency/stats.hfa

    r54eb5ebd rf19fbbc  
    1111        enum {
    1212                CFA_STATS_READY_Q  = 0x01,
    13                 #if defined(CFA_HAVE_LINUX_IO_URING_H)
     13                #if defined(HAVE_LINUX_IO_URING_H)
    1414                        CFA_STATS_IO = 0x02,
    1515                #endif
     
    6464        };
    6565
    66         #if defined(CFA_HAVE_LINUX_IO_URING_H)
     66        #if defined(HAVE_LINUX_IO_URING_H)
    6767                struct __attribute__((aligned(64))) __stats_io_t{
    6868                        struct {
     
    9999        struct __attribute__((aligned(128))) __stats_t {
    100100                __stats_readQ_t ready;
    101                 #if defined(CFA_HAVE_LINUX_IO_URING_H)
     101                #if defined(HAVE_LINUX_IO_URING_H)
    102102                        __stats_io_t    io;
    103103                #endif
Note: See TracChangeset for help on using the changeset viewer.