1. 07 Mar, 2021 12 commits
    • Jan Kiszka's avatar
      ipipe: Let ipipe_enable_irq return an error code · 14adddc0
      Jan Kiszka authored
      
      
      It's time to let ipipe_enable_irq return a proper error as it will gain
      another function that may fail. Drop the WARN_ON_ONCE in favor of that.
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      14adddc0
    • Philippe Gerum's avatar
      ipipe: merge ipipe base definitions into main header · a1072dbb
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      linux/ipipe_base.h was originally designed to circumvment #include
      hell by exporting only a subset of core definitions with minimum
      dependencies to other inner headers.
      
      The latest code reorganization fixed this issue in a better way, and
      linux/ipipe.h is currently the only direct reader of
      linux/ipipe_base.h, so let's merge both headers back as linux/ipipe.h.
      a1072dbb
    • Jan Kiszka's avatar
      ipipe: Introduce infrastructure for userspace return notifier · aaab39a7
      Jan Kiszka authored
      
      
      A little bit inspired by the kernel's user return notifier, this
      introduces an I-pipe hook before the kernel jumps back to a userspace
      context from the root domain. The hook is design to allow a switch back
      to the head domain, thus will not run through signal/preemption checks
      when returning from the callback over head. It is guaranteed to fire on
      return from interrupts and exceptions but may also fire on certain
      syscall-return paths.
      
      The first use case for the hook is resumption of ptraced tasks over
      head if they were stopped in that domain.
      
      This provides just the generic infrastructure, the invocation of
      __ipipe_notify_user_intreturn as well as the definition of
      TIP_USERINTRET are architecture-specific.
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      aaab39a7
    • Philippe Gerum's avatar
      PM: ipipe: converge to Dovetail's CPUIDLE management · b2c837ef
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      Handle requests for transitioning to deeper C-states the way Dovetail
      does, which prevents us from losing the timer when grabbed by a
      co-kernel, in presence of a CPUIDLE driver.
      b2c837ef
    • Philippe Gerum's avatar
      ipipe: add cpuidle control interface · 5cb4c552
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      Add a kernel interface for sharing CPU idling control between the host
      kernel and a co-kernel. The former invokes ipipe_cpuidle_control()
      which the latter should implement, for determining whether entering a
      sleep state is ok. This hook should return boolean true if so.
      
      The co-kernel may veto such entry if need be, in order to prevent
      latency spikes, as exiting sleep states might be costly depending on
      the CPU idling operation being used.
      5cb4c552
    • Philippe Gerum's avatar
      mm: ipipe: disable ondemand memory · c2baf136
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      Co-kernels cannot bear with the extra latency caused by memory access
      faults involved in COW or overcommit. __ipipe_disable_ondemand_mappings()
      force commits all common memory mappings with physical RAM.
      
      In addition, the architecture code is given a chance to pre-load page
      table entries for ioremap and vmalloc memory, for preventing further
      minor faults accessing such memory due to PTE misses (if that ever
      makes sense for them).
      c2baf136
    • Philippe Gerum's avatar
      KVM: ipipe: keep hypervisor state consistent across domain preemption · 7b099da6
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      In order for the hypervisor to operate properly in presence of a
      co-kernel, we need:
      
      - the virtualization core to know when the hypervisor stalls due
        to a preemption by the co-kernel.
      
      - to know when the VM enters and leaves guest mode.
      7b099da6
    • Philippe Gerum's avatar
      sched: ipipe: enable task migration between domains · db8d4efb
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      This is the basic code enabling alternate control of tasks between the
      regular kernel and an embedded co-kernel. The changes cover the
      following aspects:
      
      - extend the per-thread information block with a private area usable
        by the co-kernel for storing additional state information
      
      - provide the API enabling a scheduler exchange mechanism, so that
        tasks can run under the control of either kernel alternatively. This
        includes a service to move the current task to the head domain under
        the control of the co-kernel, and the converse service to re-enter
        the root domain once the co-kernel has released such task.
      
      - ensure the generic context switching code can be used from any
        domain, serializing execution as required.
      
      These changes have to be paired with arch-specific code further
      enabling context switching from the head domain.
      db8d4efb
    • Philippe Gerum's avatar
      ipipe: add kernel event notifiers · 48858891
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      Add the core API for enabling (regular) kernel event notifications to
      a co-kernel running over the head domain. For instance, such a
      co-kernel may need to know when a task is about to be resumed upon
      signal receipt, or when it gets an access fault trap.
      
      This commit adds the client-side API for enabling such notification
      for class of events, but does not provide the notification points per
      se, which comes later.
      48858891
    • Philippe Gerum's avatar
      ipipe: add latency tracer · 9fb9e230
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      The latency tracer is a variant of ftrace's 'function' tracer
      providing detailed information about the current interrupt state at
      each function entry (i.e. virtual interrupt flag and CPU interrupt
      disable bit). This commit introduces the generic tracer code, which
      builds upon the regular ftrace API.
      
      The arch-specific code should provide for ipipe_read_tsc(), a helper
      routine returning a 64bit monotonic time value for timestamping
      purpose. HAVE_IPIPE_TRACER_SUPPORT should be selected by the
      arch-specific code for enabling the tracer, which in turn makes
      CONFIG_IPIPE_TRACE available from the Kconfig interface.
      9fb9e230
    • Philippe Gerum's avatar
      ipipe: add out-of-band tick device · e0cecb8d
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      
      
      The out-of-band tick device manages the timer hardware by interposing
      on selected clockevent handlers transparently, so that a client domain
      (e.g. a co-kernel) eventually controls such hardware for scheduling
      the high-precision timer events it needs to. Those events are
      delivered to out-of-hand activities running on the head stage,
      unimpeded by (only virtually) interrupt-free sections of the regular
      kernel code.
      
      This commit introduces the generic API for controlling the out-of-band
      tick device from a co-kernel. It also provides for the internal API
      clock event chip drivers should use for enabling high-precision
      timing for their hardware.
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
      e0cecb8d
    • Philippe Gerum's avatar
      genirq: add generic I-pipe core · fd239330
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      This commit provides the arch-independent bits for implementing the
      interrupt pipeline core, a lightweight layer introducing a separate,
      high-priority execution stage for handling all IRQs in pseudo-NMI
      mode, which cannot be delayed by the regular kernel code. See
      Documentation/ipipe.rst for details about interrupt pipelining.
      
      Architectures which support interrupt pipelining should select
      HAVE_IPIPE_SUPPORT, along with implementing the required arch-specific
      code. In such a case, CONFIG_IPIPE becomes available to the user via
      the Kconfig interface for enabling the feature.
      fd239330