Changes in / [24fc196:4b234f0]


Ignore:
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • configure

    r24fc196 r4b234f0  
    34713471        case $host_cpu in
    34723472                i386)
    3473                         CFLAGS+="-m32"
    3474                         CXXFLAGS+="-m32"
    3475                         CFAFLAGS+="-m32"
    3476                         LDFLAGS+="-m32"
     3473                        CFLAGS+=" -m32 "
     3474                        CXXFLAGS+=" -m32 "
     3475                        CFAFLAGS+=" -m32 "
     3476                        LDFLAGS+=" -m32 "
    34773477                        ;;
    34783478                i686)
    3479                         CFLAGS+="-m32"
    3480                         CXXFLAGS+="-m32"
    3481                         CFAFLAGS+="-m32"
    3482                         LDFLAGS+="-m32"
     3479                        CFLAGS+=" -m32 "
     3480                  CXXFLAGS+=" -m32 "
     3481                  CFAFLAGS+=" -m32 "
     3482                  LDFLAGS+=" -m32 "
    34833483                        ;;
    34843484                x86_64)
    3485                         CFLAGS+="-m64"
    3486                         CXXFLAGS+="-m64"
    3487                         CFAFLAGS+="-m64"
    3488                         LDFLAGS+="-m64"
     3485                        CFLAGS+=" -m64 "
     3486                        CXXFLAGS+=" -m64 "
     3487                        CFAFLAGS+=" -m64 "
     3488                        LDFLAGS+=" -m64 "
    34893489                        ;;
    34903490        esac
  • configure.ac

    r24fc196 r4b234f0  
    167167AC_SUBST([MACHINE_TYPE],[$host_cpu])
    168168
    169 if ! test "$host_cpu" = "$build_cpu"; then 
     169if ! test "$host_cpu" = "$build_cpu"; then
    170170        case $host_cpu in
    171171                i386)
    172                         CFLAGS+="-m32"
    173                         CXXFLAGS+="-m32"
    174                         CFAFLAGS+="-m32"
    175                         LDFLAGS+="-m32"
     172                        CFLAGS+=" -m32 "
     173                        CXXFLAGS+=" -m32 "
     174                        CFAFLAGS+=" -m32 "
     175                        LDFLAGS+=" -m32 "
    176176                        ;;
    177177                i686)
    178                         CFLAGS+="-m32"
    179                         CXXFLAGS+="-m32"
    180                         CFAFLAGS+="-m32"
    181                         LDFLAGS+="-m32"
     178                        CFLAGS+=" -m32 "
     179                  CXXFLAGS+=" -m32 "
     180                  CFAFLAGS+=" -m32 "
     181                  LDFLAGS+=" -m32 "
    182182                        ;;
    183183                x86_64)
    184                         CFLAGS+="-m64"
    185                         CXXFLAGS+="-m64"
    186                         CFAFLAGS+="-m64"
    187                         LDFLAGS+="-m64"
     184                        CFLAGS+=" -m64 "
     185                        CXXFLAGS+=" -m64 "
     186                        CFAFLAGS+=" -m64 "
     187                        LDFLAGS+=" -m64 "
    188188                        ;;
    189189        esac
  • src/benchmark/create_pthrd.c

    r24fc196 r4b234f0  
    1414                n = atoi(argv[1]);
    1515        }
    16         printf("%lu\n", n);
     16        printf("create %lu pthreads ... ", n);
    1717
    1818        for (size_t i = 0; i < n; i++) {
    1919                pthread_t thread;
    2020                if (pthread_create(&thread, NULL, foo, NULL) < 0) {
     21                        perror( "failure" );
    2122                        return 1;
    2223                }
    2324
    2425                if (pthread_join( thread, NULL) < 0) {
     26                        perror( "failure" );
    2527                        return 1;
    2628                }
    2729        }
    28         pthread_exit(NULL);
    29         return 0;
     30        printf("finish\n");
    3031}
  • src/libcfa/concurrency/alarm.c

    r24fc196 r4b234f0  
    4343
    4444void __kernel_set_timer( __cfa_time_t alarm ) {
    45         LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Kernel : set timer to %lu\n", (__cfa_time_t)alarm );
     45        LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Kernel : set timer to %llu\n", (__cfa_time_t)alarm );
    4646        itimerval val;
    4747        val.it_value.tv_sec = alarm / TIMEGRAN;                 // seconds
    48         val.it_value.tv_usec = (alarm % TIMEGRAN) / ( TIMEGRAN / 1_000_000L ); // microseconds
     48        val.it_value.tv_usec = max( (alarm % TIMEGRAN) / ( TIMEGRAN / 1_000_000L ), 1000 ); // microseconds
    4949        val.it_interval.tv_sec = 0;
    5050        val.it_interval.tv_usec = 0;
  • src/libcfa/concurrency/alarm.h

    r24fc196 r4b234f0  
    1919
    2020#include <stdbool.h>
     21#include <stdint.h>
    2122
    2223#include "assert"
    2324
    24 typedef unsigned long int __cfa_time_t;
     25typedef uint64_t __cfa_time_t;
    2526
    2627struct thread_desc;
  • src/libcfa/concurrency/preemption.c

    r24fc196 r4b234f0  
    6666
    6767void tick_preemption() {
    68         // LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Ticking preemption\n" );
    69 
    7068        alarm_list_t * alarms = &systemProcessor->alarms;
    7169        __cfa_time_t currtime = __kernel_get_time();
     70
     71        // LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Ticking preemption @ %llu\n", currtime );
    7272        while( alarms->head && alarms->head->alarm < currtime ) {
    7373                alarm_node_t * node = pop(alarms);
     
    8383                verify( validate( alarms ) );
    8484
    85                 if( node->period > 0 ) {
    86                         node->alarm = currtime + node->period;
     85                __cfa_time_t period = node->period;
     86                if( period > 0 ) {
     87                        node->alarm = currtime + period;
     88                        // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Reinsert %p @ %llu (%llu + %llu)\n", node, node->alarm, currtime, period );
    8789                        insert( alarms, node );
    8890                }
     
    101103
    102104void update_preemption( processor * this, __cfa_time_t duration ) {
    103         LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Processor : %p updating preemption to %lu\n", this, duration );
     105        LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Processor : %p updating preemption to %llu\n", this, duration );
    104106
    105107        alarm_node_t * alarm = this->preemption_alarm;
     
    273275                siginfo_t info;
    274276                int sig = sigwaitinfo( &mask, &info );
    275                 if( sig < 0 ) {
    276                         abortf( "internal error, sigwait" );
    277                 }
    278                 else if( sig == SIGALRM )
     277                assertf(sig == SIGALRM, "Kernel Internal Error, sigwait: Unexpected signal %d (%d : %d)\n", sig, info.si_code, info.si_value.sival_int);
     278
     279                LIB_DEBUG_PRINT_SAFE("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int );
     280                switch( info.si_code )
    279281                {
    280                         LIB_DEBUG_PRINT_SAFE("Kernel : Caught signal %d (%d)\n", sig, info.si_value.sival_int );
    281                         if( info.si_value.sival_int == 0 )
    282                         {
    283                                 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread tick\n");
    284                                 lock( &systemProcessor->alarm_lock DEBUG_CTX2 );
    285                                 tick_preemption();
    286                                 unlock( &systemProcessor->alarm_lock );
    287                         }
    288                         else if( info.si_value.sival_int == 1 )
    289                         {
    290                                 break;
    291                         }
    292                 }
    293                 else
    294                 {
    295                         LIB_DEBUG_PRINT_SAFE("Kernel : Unexpected signal %d (%d)\n", sig, info.si_value.sival_int);
    296                 }
    297         }
    298 
     282                case SI_TIMER:
     283                case SI_KERNEL:
     284                        LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread tick\n");
     285                        lock( &systemProcessor->alarm_lock DEBUG_CTX2 );
     286                        tick_preemption();
     287                        unlock( &systemProcessor->alarm_lock );
     288                        break;
     289                case SI_QUEUE:
     290                        goto EXIT;
     291                }
     292        }
     293
     294EXIT:
    299295        LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread stopping\n");
    300296        return NULL;
  • src/tests/preempt_longrun/Makefile.am

    r24fc196 r4b234f0  
    3131all-local: ${TESTS:=.run}
    3232
     33clean-local:
     34        rm -f ${TESTS}
     35
    3336% : %.c ${CC}
    3437        ${AM_V_GEN}${CC} ${CFLAGS} ${<} -o ${@}
  • src/tests/preempt_longrun/Makefile.in

    r24fc196 r4b234f0  
    790790clean: clean-am
    791791
    792 clean-am: clean-generic mostlyclean-am
     792clean-am: clean-generic clean-local mostlyclean-am
    793793
    794794distclean: distclean-am
     
    857857
    858858.PHONY: all all-am all-local check check-TESTS check-am clean \
    859         clean-generic cscopelist-am ctags-am distclean \
     859        clean-generic clean-local cscopelist-am ctags-am distclean \
    860860        distclean-generic distdir dvi dvi-am html html-am info info-am \
    861861        install install-am install-data install-data-am install-dvi \
     
    875875all-local: ${TESTS:=.run}
    876876
     877clean-local:
     878        rm -f ${TESTS}
     879
    877880% : %.c ${CC}
    878881        ${AM_V_GEN}${CC} ${CFLAGS} ${<} -o ${@}
  • src/tests/sched-int-barge.c

    r24fc196 r4b234f0  
    44#include <stdlib>
    55#include <thread>
     6
     7#ifndef N
     8#define N 100_000
     9#endif
    610
    711enum state_t { WAIT, SIGNAL, BARGE };
     
    7377        }
    7478
    75         if( c->counter >= 100_000 ) c->done = true;
     79        if( c->counter >= N ) c->done = true;
    7680        return !c->done;
    7781}
Note: See TracChangeset for help on using the changeset viewer.