1. 11 Jun, 2021 7 commits
    • Jan Kiszka's avatar
      cobalt/thread: Make sure relax inband work is on a stack outliving the wakeup · 6cacd089
      Jan Kiszka authored
      
      
      As dovetail does not copy the work passed to pipeline_post_inband_work,
      we must ensure that the one used in xnthread_relax lives as long as the
      wakeup takes. Therefore, fold post_wakeup into the only caller so that
      the stack frame of xnthread_relax is guaranteed to be used which
      fulfills this requirement.
      
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      6cacd089
    • Jan Kiszka's avatar
      cobalt/thread: Pull kthread inband work onto creator stack · 795887cd
      Jan Kiszka authored
      
      
      As dovetail does not copy the work passed to pipeline_post_inband_work,
      we must ensure that the one used in xnthread_relax lives as long as the
      wakeup takes. Therefore, embed the pipeline_inband_work struct needed
      for signaling the kthread creator into kthread_arg struct. This lives on
      the creator stack, as long as it takes to signal completion to it.
      
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      795887cd
    • Jan Kiszka's avatar
      cobalt/thread: Privatize xnthread_map to map_kthread · 2d91aa1b
      Jan Kiszka authored
      
      
      No user outside of the core, no need to export it. Move the code around
      so that we can easily use it without forward declarations.
      
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      2d91aa1b
    • Jan Kiszka's avatar
      cobalt/thread: Move xnthread_signal work off the stack · 850b3789
      Jan Kiszka authored
      
      
      Unlike the I-pipe, Dovetail does not copy the work descriptor but
      merely hands over the request to the common irq_work() mechanism. We
      must guarantee that such descriptor lives in a portion of memory which
      won't go stale until the handler has run, which by design can only
      happen once the calling out-of-band context unwinds.
      
      Therefore, we have to create signal slots per possible cause in the
      thread's control block in order to overcome sigwork in xnthread_signal.
      
      For SIGDEBUG, we are only interested in the very first event coming in,
      so one slot is enough. All SIGSHADOW_* events need their own slot:
      SIGSHADOW_ACTION_HARDEN and SIGSHADOW_ACTION_HOME can be raised by
      remote threads asynchronously to the target thread.
      SIGSHADOW_ACTION_BACKTRACE comes in addition to SIGDEBUG_MIGRATE_*. For
      the latter reason, SIGSHADOW_ACTION_BACKTRACE cannot pile up though.
      
      Including SIGTERM, we have totally 5 slots.
      
      To ensure that multiple asynchronous signals on the same slot do not
      overwrite each other (e.g. SIGSHADOW_ACTION_HOME or SIGDEBUG reasons),
      synchronize the slot usage under nklock. Create a __xnthread_signal
      variant that can be called from already locked contexts (the majority of
      xnthread_signal users).
      
      Based on original patch by Hongzhan Chen.
      
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      850b3789
    • Jan Kiszka's avatar
      cobalt/thread: Rework kthread check for xnthread_signal · 89662225
      Jan Kiszka authored
      
      
      We only reach lostage_task_signal for a kthread if xnthread_signal has
      sent us. So move the check to the caller, making debugging easier.
      
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      89662225
    • Philippe Gerum's avatar
      cobalt: dovetail: fix SMP kernel boot on uniprocessor machine · 54bc0937
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      
      
      We may be running a SMP kernel on a uniprocessor machine whose
      interrupt controller supports no IPI. We should attempt to hook IPIs
      only if the hardware can support multiple CPUs, otherwise it is
      unneeded and poised to fail.
      
      Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      54bc0937
    • Jan Kiszka's avatar
      rtdm/nrtsig: Move inband work description off the stack · 17fa132d
      Jan Kiszka authored
      
      
      Unlike the I-pipe, Dovetail does not copy the work descriptor but
      merely hands over the request to the common irq_work() mechanism. We
      must guarantee that such descriptor lives in a portion of memory which
      won't go stale until the handler has run, which by design can only
      happen once the calling out-of-band context unwinds.
      
      Therefore, we have to move the non-rt signal descriptors off the
      stack. When it comes to the basic non-RT signal, the rtdm_nrtsig_t
      descriptor itself is a proper place to host the inband work descriptor
      which carries out the work under the hood.
      
      When a task work needs to be scheduled, we enqueue it into global,
      lock-protected list, trigger a common lostage handler, and let that
      transfer the item to schedule_work.
      
      Based on original patch by Philippe Gerum, avoiding xnmalloc in RT code
      paths.
      
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      17fa132d
  2. 10 Jun, 2021 1 commit
  3. 09 Jun, 2021 2 commits
  4. 08 Jun, 2021 1 commit
  5. 04 Jun, 2021 29 commits