1. 07 Apr, 2021 1 commit
  2. 11 Jan, 2021 1 commit
  3. 08 Jan, 2021 1 commit
  4. 14 Dec, 2020 1 commit
  5. 03 Jun, 2019 1 commit
    • Jan Kiszka's avatar
      cobalt/kernel: Simplify mayday processing · 4e7bb325
      Jan Kiszka authored
      
      
      The mayday mechanism exists in order to kick a xenomai userspace task
      into secondary mode while it is running userspace code. For that, we ask
      I-pipe to call us back when the task was interrupted and is about to
      return to userspace.
      
      So far we defer the relaxation from that callback via a VDSO-like
      mechanism that triggers a special syscall to the return path of that
      very same syscall. However, that is not desirable because it is a
      complex, arch-specific mechanism that can easily break and,
      specifically, that destroys the backtrace of ptraced tasks.
      
      Fortunately, we can fulfill the needs of mayday also by relaxing
      the task directly from the mayday callback. Tested successfully on
      x86-64 and ARM.
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      4e7bb325
  6. 03 Jul, 2018 8 commits
    • Philippe Gerum's avatar
      cobalt: syscall: don't bark at internal syscalls · fa5a45c4
      Philippe Gerum authored
      Some architectures may define a secondary system call range for
      internal operations, fix the consistency check not to warn about them.
      fa5a45c4
    • Jan Kiszka's avatar
      cobalt/tracing: Don't report current thread in tracepoints · e23670a7
      Jan Kiszka authored and Philippe Gerum's avatar Philippe Gerum committed
      
      
      All these are synchronous, and the thread context is already recorded by
      ftrace.
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      e23670a7
    • Jan Kiszka's avatar
      cobalt: Introduce xnftrace_printf · b8311643
      Jan Kiszka authored and Philippe Gerum's avatar Philippe Gerum committed
      
      
      This allows to inject a user-defined string into the system's ftrace
      without leaving RT mode (because of using a standard write on
      /sys/kernel/debug/tracing/trace_marker).
      
      As the signature of this function is different from the existing trace
      syscall, create as dedicated one.
      
      For simplicity reasons, the maximum string length that can be passed
      down to the kernel is limited to 255 characters (+1 for termination).
      
      We call directly into the internal __trace_puts to avoid both the
      unneeded strlen call of the trace_puts wrapper and the false warning
      that kernel code uses trace_printk.
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      b8311643
    • Philippe Gerum's avatar
      cobalt/timer: fix, rework ptrace detection and timer forwarding · 9ebc2b6e
      Philippe Gerum authored
      Ptracing may cause timer overruns, as the ptraced application cannot
      go waiting for the current period in a timely manner when stopped on a
      breakpoint or single-stepped. A mechanism was introduced a long time
      ago for hiding those overruns from the application, while ptracing is
      in effect.
      
      The current implementation dealing with this case has two major flaws:
      
      - it crashes the system when single-stepping (observed on ARM i.MX6q),
        revealing a past regression which went unnoticed so far.
      
      - it uses a big hammer to forward (most) timers without running their
        respective timeout handler while ptracing, in order to hide this
        timespan from the overrun accounting code. This introduces two
        issues:
      
        * the timer forwarding code sits in the tick announcement code,
          which is a very hot path, despite ptracing an application is
          definitely not a common operation.
      
        * all timers are affected / blocked during ptracing, except those
          which have been specifically marked (XNTIMER_NOBLCK) at creation,
          which turns out to be impractical for the common case.
      
      The new implementation only addresses what is at stake, i.e. hiding
      overrun reports due to ptracing from applications. This can be done
      simply by noting when a thread should disregard overruns after an exit
      from the ptraced mode (XNHICCUP), then discard the pending overruns if
      this flag is detected by the code reporting them
      (xntimer_get_overrun()).
      9ebc2b6e
    • Philippe Gerum's avatar
    • Philippe Gerum's avatar
      cobalt/syscalls: allow for handing over mode selection to syscall handlers · 87f015b5
      Philippe Gerum authored
      Specific system calls may benefit from dealing with the caller's
      runtime mode by themselves, depending on internal information which
      the generic syscall dispatcher does not have access to.
      
      To this end, a new syscall mode called "handover" is
      introduced. Syscalls bearing this mode bit are always entered from the
      current calling domain. The syscall handler may return -ENOSYS to
      trigger a switch to the converse domain until all domains have been
      visited once, at which point the syscall fails with -ENOSYS
      automatically.
      87f015b5
    • Philippe Gerum's avatar
      cobalt/thread: add schedparam lazy propagation · d731b977
      Philippe Gerum authored
      Provide a mechanism for carrying out a lazy propagation of schedparam
      updates to the regular kernel, so that userland does not have to
      switch to secondary mode for this.
      
      When userland issues sc_cobalt_thread_setschedparam_ex for updating
      the scheduling parameters of a Xenomai thread, a request for
      propagating this change to the regular kernel is made pending. Such
      request will be committed later, either when:
      
      - the thread relaxes if it is running in primary mode when the update
        request is received;
      
      - next time the thread calls back into the Cobalt core as a result of
        receiving a HOME action from a SIGSHADOW notification, which is sent
        if such thread was relaxed at the time of the update request.
      
      As a result, the target thread will have propagated the schedparams
      update to the regular kernel as soon as it resumes (relaxed) execution
      in user-space.
      d731b977
    • Philippe Gerum's avatar
      c6232b1f
  7. 17 Nov, 2017 1 commit
  8. 27 Dec, 2016 1 commit
    • Jan Kiszka's avatar
      cobalt/kernel: Allow to restart clock_nanosleep and select after signal processing · 36132cdb
      Jan Kiszka authored and Philippe Gerum's avatar Philippe Gerum committed
      
      
      Only if a signal was actually delivered to a thread that was blocked on
      sleep, [clock_]nanosleep or select, those calls should return -EINTR.
      Otherwise, they should resume with the timeout, accordingly adjusted in
      case of relative timeout. So far we returned -EINTR immediately which
      particularly disturbed the debugging of applications (SIGSTOP/CONT
      terminated those syscalls).
      
      This approach reuses the Linux restart mechanism to find out if those
      syscalls should be restarted or actually terminated after the signal
      was handled: Linux sets current->restart_block.fn in case a termination
      is required, unconditionally, thus also when the syscall did not return
      ERESTART_RESTARTBLOCK. We also use the restart_block.nanosleep.expires
      to transfer the remaining timeout to the restarted syscall.
      
      We can't use the original restart mechanism of Linux because it directs
      all ERESTART_RESTARTBLOCK through a special, Linux-only syscall. In our
      case, we would have to migrate the caller in that context to primary in
      order to resume the sleep, but this is not possible under Xenomai (we
      need to migration from within the syscall hooks).
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      36132cdb
  9. 15 Jul, 2016 1 commit
    • Philippe Gerum's avatar
      cobalt/syscalls: allow for handing over mode selection to syscall handlers · 62b824af
      Philippe Gerum authored
      Specific system calls may benefit from dealing with the caller's
      runtime mode by themselves, depending on internal information which
      the generic syscall dispatcher does not have access to.
      
      To this end, a new syscall mode called "handover" is
      introduced. Syscalls bearing this mode bit are always entered from the
      current calling domain. The syscall handler may return -ENOSYS to
      trigger a switch to the converse domain until all domains have been
      visited once, at which point the syscall fails with -ENOSYS
      automatically.
      62b824af
  10. 02 Mar, 2016 1 commit
  11. 28 Dec, 2015 1 commit
  12. 30 Sep, 2015 1 commit
  13. 20 Jul, 2015 2 commits
  14. 17 Jul, 2015 3 commits
  15. 12 Jul, 2015 1 commit
    • Philippe Gerum's avatar
      cobalt/kernel: improve handling of user debug options · 032fb4fa
      Philippe Gerum authored
      This changeset introduces individual switches for enabling/disabling
      particular user debug features. At this chance, the related
      documentation has been updated.
      
      Notification upon secondary mode switches is still considered
      regardless of the debug settings, as production setups may depend on
      it for basic sanity testing.
      032fb4fa
  16. 16 May, 2015 1 commit
    • Philippe Gerum's avatar
      cobalt/mutex, lib/cobalt: detect attempts to sleep while holding a mutex · e3153cf2
      Philippe Gerum authored
      Going to sleep intentionally while holding a mutex is an application
      issue. When user consistency checks are enabled (XENO_OPT_DEBUG_USER),
      any attempt to do so will trigger a SIGDEBUG signal to the offending
      thread, conveying the SIGDEBUG_RESCNT_SLEEP code.
      
      This change implicitly disables fast locking optimizations for
      user-space threads when XENO_OPT_DEBUG_USER is enabled. Since the
      debugging code present or future may already add some overhead, this
      seems acceptable anyway.
      e3153cf2
  17. 15 Mar, 2015 1 commit
  18. 18 Feb, 2015 1 commit
    • Philippe Gerum's avatar
      cobalt/kernel: sanitize usage of internal copy_to/from helpers · cc47a310
      Philippe Gerum authored
      Unless explicitly paired with access_w/rok() checks, all copy to/from
      helpers should implement the safe form, testing for the basic sanity
      of the address range.
      
      cobalt_copy_to/from_user() implement the safe call form in replacement
      of __xn_safe_copy_to/from_user(). __xn_copy_to/from_user() still
      implement the unchecked variant, assuming the address range will be
      checked separately.
      
      Drivers should stick with the rtdm_copy_to/from_user() helpers.
      cc47a310
  19. 17 Feb, 2015 2 commits
  20. 15 Feb, 2015 1 commit
    • Philippe Gerum's avatar
      cobalt: finalize the core control interface · 34071842
      Philippe Gerum authored
      The former sysconf and sysctl services are merged into the new core
      control interface (corectl).
      
      In addition to the pre-existing configuration retrieval requests, the
      core "stop", "start" and "status" actions are available. Those
      requests can be issued by the new corectl utility, for shutting down,
      (re-)starting, and getting the current status of the real-time
      services respectively.
      
      RTDM drivers can define state management operation handlers, for being
      notified of transitions from running to stopped state, and conversely
      (see rtdm_driver.smops).
      34071842
  21. 13 Feb, 2015 2 commits
  22. 03 Feb, 2015 1 commit
  23. 30 Oct, 2014 1 commit
  24. 29 Oct, 2014 3 commits
  25. 27 Oct, 2014 1 commit
  26. 25 Oct, 2014 1 commit