Skip to content
Snippets Groups Projects
  1. Mar 23, 2021
    • Florian Fischer's avatar
      [IO] make the behavior of the completer thread configurable · 5ea44519
      Florian Fischer authored
      Available behaviors:
        * none - the completer thread is not started
      
        * schedule (default) - the completer thread will reap and schedule available
                               completions from worker IoContexts
      
        * wakeup - the completer thread will wakeup all workers if it observes completions
                   in a worker IoContext. The Fiber produced by the completion will
                   be scheduled when the worker in which's IoContext the cqe lies
                   reaps its completions.
      5ea44519
  2. Mar 12, 2021
  3. Mar 09, 2021
    • Florian Fischer's avatar
      [IO] make the lock implementation protecting a IoContext's cq configurable  · a619ba3e
      Florian Fischer authored
      This change introduces a new synchronization primitive "PseudoCountingTryLock"
      which takes an actual lock as template and provides a CountingTryLock interface.
      By using a PseudoCountingTryLock we don't have to change any synchronization
      code in IoContext::reapCompletion.
      
      Since all PseudoCountingTryLock code is defined in a header the compiler
      should see our constant return values and hopefully optimize away any check
      depending on those constant return values.
      
      Options:
      * spin_lock - naive CAS spin lock
      * mutex - std::mutex
      * counting_try_lock (default) - our own lightweight special
                                      purpose synchronization primitive
      a619ba3e
    • Florian Schmaus's avatar
      [meson] Fix 'iwyu' target for meson >= 0.57 · 08224cd2
      Florian Schmaus authored
      The run_target() function requires an absolute path in meson >= 0.57.
      08224cd2
  4. Mar 08, 2021
  5. Mar 01, 2021
  6. Feb 26, 2021
    • Florian Fischer's avatar
      Make LockedUnboundedQueue implementation configurable · 9b949e49
      Florian Fischer authored
      Available implementations configurations through the meson option
      'locked_unbounded_queue_implementation' are:
      
      mutex - our current LockedUnboundedQueue implementation using std::mutex
      
      rwlock - An implementation with pthread_rwlock. The implementations tries
               to upgrade its rdlock and drops and acquires a wrlock on failure
      
      shared_mutex - An implementation using std::shared_mutex.
               dequeue() acquires a shared lock at first, drops it and
               acquires a unique lock
      
      boost_shared_mutex - An implementation using boost::shared_mutex.
               dequeue() acquires an upgradable lock and upgrade it
               to a unique lock if necessary
      9b949e49
    • Florian Fischer's avatar
      add a batch optimization for the global completer · 17776ba2
      Florian Fischer authored
      This change introduces new scheduleFromAnywhere methods which take
      a range of Fibers to schedule.
      
      Blockable gets a new method returning the fiber used to start
      the unblocked context, which is used by Future/PartialCompletableFuture
      to provide a way of completion and returning the continuation Fiber
      to the caller so they may schedule the continuation how they want.
      
      If the meson option io_batch_anywhere_completions is set the global
      completer will collect all callback and continuation fibers before
      scheduling them at once when it is done reaping the completions.
      The idea is that taking the AnywhereQueue write lock and calling onNewWork
      must only be done once.
      
      TODO: investigate if onNewWork should be extended by an amountOfWork
      argument which determines how many worker can be awoken and have work to
      do. This should be trivially since our WorkerWakeupSemaphore implementations
      already support notify_many(), which may be implemented in terms of
      notify_all though.
      17776ba2
  7. Feb 23, 2021
    • Florian Fischer's avatar
      [WorkerWakeupSemaphore] add three possible implementations · 3cde3e16
      Florian Fischer authored
      LockedSemaphore is the already existening Semaphore using
      a mutex and a condition variable.
      PosixMutex is a thin wrapper around a POSIX semaphore.
      SpuriousFutexSemaphore is a atomic/futex based implementation
      prune to spurious wakeups which is fine for the worker wakeup usecase.
      3cde3e16
  8. Feb 22, 2021
  9. Feb 10, 2021
  10. Jan 26, 2021
    • Florian Fischer's avatar
      [IO] introduce emper::io a IO subsystem using io_uring · 460c2f05
      Florian Fischer authored
      Empers IO design is based on a proactor pattern where each worker
      can issue IO requests through its exclusive IoContext object which wraps an
      io_uring instance.
      
      IO completions are reaped at 4 places:
      1. After a submit to collect inline completions
      2. Before dispatching a new Fiber
      3. When no new IO can be submitted because the completion queue is full
      4. And by a global completer thread which gets notified about completions
         on worker IoContexts through registered eventfds
      
      All IO requests are modeled as Future objects which can be either
      instantiated and submitted manually, retrieved by POSIX-like non-blocking
      or implicitly used by posix-like blocking functions.
      
      User facing API is exported in the following headers:
      * emper/io.hpp (POSIX-like)
      * emper.h (POSIX-like)
      * emper/io/Future.hpp
      
      Catching short write/reads/sends and resubmitting the request without
      unblocking the Fiber is supported.
      
      Using AlarmFuture objects Fibers have a emper-native way to sleep for
      a given time.
      
      IO request timeouts with TimeoutWrapper class.
      Request Cancellation is supported with Future::cancel() or the
      CancelWrapper() Future class.
      
      A proactor design demands that buffers are committed to the kernel
      as long as the request is active. To guaranty memory safety Futures
      get canceled in their Destructor which will only return after the committed
      memory is free to use.
      
      Linking Futures to chains is supported using the Future::SetDependency()
      method. Future are submitted when their last Future gets submitted.
      A linked Request will start if the previous has finished.
      Error or partial completions will cancel the not started tail of a chain.
      
      TODO: Handle possible situations where the CQ of the global completer is full
      and no more sqe can be submitted to the SQ.
      460c2f05
    • Florian Fischer's avatar
      [Blockable] add global set of all blocked contexts for debugging · a745c865
      Florian Fischer authored
      This feature must be activated using the blocked_context_set meson option.
      a745c865
  11. Jan 22, 2021
  12. Jan 13, 2021
  13. Jan 11, 2021
  14. Jan 05, 2021
  15. Dec 17, 2020
  16. Dec 10, 2020
  17. Nov 30, 2020
    • Florian Fischer's avatar
      make logging configurable during compilation and runtime · b40099a8
      Florian Fischer authored
          Compile-time:
            * A new meson option 'log_level' is introduced which has all the values from the
              Loglevel enum
            * The 'OFF' option defines EMPER_LOG_OFF which causes the LOG* macros to be empty
              and the Logger<>::log function to return immediately
            * The default 'automatic' option sets 'log_level' to 'Error' for release builds
              and to 'ALL' otherwise
      
          Runtime:
            * The global variable emper::log_level defined in Debug.hpp controls the logging output
            * It is initialized with the meson option 'log_level' but can be changed during runtime
      b40099a8
    • Florian Fischer's avatar
    • Florian Fischer's avatar
      [userspace-rcu] make the userspace-rcu dependecy optional · 28ea72ef
      Florian Fischer authored
      Disable the userpace-rcu support by default.
      Our used userspace-rcu flavor memb is rather new and not available in
      liburcu version 0.10 available in debian buster.
      This change switches from using DCE and "if constexpr" to the C
      preprocessor so the library is only needed when the userspace-rcu support
      is actually enabled.
      28ea72ef
  18. Nov 19, 2020
  19. Nov 17, 2020
  20. Nov 05, 2020
  21. Aug 23, 2020
  22. Aug 11, 2020
  23. Jul 31, 2020
Loading