- 11 Jun, 2021 8 commits
-
-
Dovetail provides a fast service to escalate the caller to out-of-band mode for executing a routine (run_oob_call()), which we use to enforce primary mode in ___xnsched_run() to schedule out the relaxing thread. Due to the way run_oob_call() works, enabling hardirqs during this transition can trigger a subtle bug caused by the relaxing thread to be switched out, as a result of taking an interrupt during the irqs on section, before __xnsched_run() actually runs on behalf of xnthread_relax() -> xnthread_suspend(). This may lead to a breakage of the inband interrupt state, revealed by lockdep complaining about a HARDIRQ-IN-W -> HARDIRQ-ON-W situation, when finalize_task_switch() runs for reconciling both the in-band and Xenomai scheduler states. Re-enabling hard irqs before switching out the relaxing thread was throught as a mean to reduce the scope of the interrupt-free section while relaxing a thread with the I-pipe, which unlike Dovetail requires us to open code an escalation service based on triggering a synthetic interrupt. We differentiate the behavior between the I-pipe and Dovetail by abstracting the related bits as pipeline_leave_oob_unlock(), keeping the current implementation unchanged for the I-pipe. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
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 <jan.kiszka@siemens.com>
-
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 <jan.kiszka@siemens.com>
-
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 <jan.kiszka@siemens.com>
-
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 <jan.kiszka@siemens.com>
-
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 <jan.kiszka@siemens.com>
-
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 <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
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 <jan.kiszka@siemens.com>
-
- 10 Jun, 2021 1 commit
-
-
Jan Kiszka authored
Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
- 09 Jun, 2021 2 commits
-
-
Jan Kiszka authored
With dovetail, clock_settime affects the Linux wall clock as well. When systemd-timesyncd is running, the posix-clock test will fail because its check of clock settings will immediately be overwritten by timesyncd again. So stop that service if present and running and restart it after the test. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
There are only two pipe IOCTLs that take arguments and both are int pointers. Therefore, use the compat_ptr_ioctl pattern, just open-coding it for support of kernels < 5.4.4. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
- 08 Jun, 2021 1 commit
-
-
Jan Kiszka authored
This unbreaks smokey's memory_coreheap check with 32-bit userland on 64-bit kernels. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
- 04 Jun, 2021 28 commits
-
-
add test case for clock_adjtime64 in testsuite Signed-off-by:
Song Chen <chensong_2000@189.cn> [Florian: Fix test error handling, style fixes, fix failing test] Signed-off-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
If sizeof time_t bigger than 4, which means glibc supports 64bit timespec, go to clock_adjtime64. otherwise, go to original clock_adjtime. Signed-off-by:
Song Chen <chensong_2000@189.cn> Reviewed-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Add a syscall specific for clock_adjtime with 64bit time_t. Signed-off-by:
Song Chen <chensong_2000@189.cn> Reviewed-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
add test case for clock_getres64 in testsuite Signed-off-by:
chensong <chensong@tj.kylinos.cn> [Florian: syscall()->XENOMAI_SYSCALLx(), fix test error handling] Signed-off-by:
Florian Bezdeka <florian.bezdeka@siemens.com> [Jan: style fix, simply one error test] Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
If sizeof time_t bigger than 4, which means glibc supports 64bit timespec, go to clock_getres64. otherwise, go to original clock_getres. Signed-off-by:
chensong <chensong@tj.kylinos.cn> Reviewed-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Add a syscall specific for clock_getres with 64bit time_t. Signed-off-by:
chensong <chensong@tj.kylinos.cn> Reviewed-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
It's not provided in this case. libcobalt calls libc instead. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
No checks of ret against 0 needed in those cases. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Add test case for clock_nanosleep64 in smokey testsuite Signed-off-by:
chensong <chensong@tj.kylinos.cn> [Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()] Signed-off-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
If sizeof time_t bigger than 4, which means glibc supports 64bit timespec, go to clock_nanosleep64. otherwise, go to original clock_nanosleep. Signed-off-by:
chensong <chensong@tj.kylinos.cn> Reviewed-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Add a syscall specific for clock_nanosleep with 64bit time_t. Signed-off-by:
chensong <chensong@tj.kylinos.cn> Reviewed-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Adding new test cases for clock_settime64 and clock_gettime64. Signed-off-by:
chensong <chensong@tj.kylinos.cn> [Florian: Rebased on top of next, test improvements, reword commit msg] Signed-off-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
If sizeof time_t bigger than 4, which means glibc supports 64bit timespec, go to clock_settime64. otherwise, go to original clock_settime. Signed-off-by:
chensong <chensong@tj.kylinos.cn> Reviewed-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
If sizeof time_t bigger than 4, which means glibc supports 64bit timespec, go to clock_gettime64. otherwise, go to original clock_settime. Signed-off-by:
chensong <chensong@tj.kylinos.cn> [Florian: Rebased on top of next] Signed-off-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Adding a new syscall clock_settime64 which is y2038 safe Signed-off-by:
chensong <chensong@tj.kylinos.cn> [Florian: Reword commit msg] Reviewed-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Add a syscall specific for clock_gettime with 64bit time_t. Signed-off-by:
chensong <chensong@tj.kylinos.cn> [Florian: Removed unnecessary include in syscall32.c] Signed-off-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
There were two places invoking the sc_cobalt_clock_gettime syscalls and both places would be updated while introducing y2038 support. To keep y2038 compatibility as simple as possible the code has been moved into a simple helper function. Signed-off-by:
Florian Bezdeka <florian.bezdeka@siemens.com> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
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 allocate a request descriptor from the core heap when issuing a request to enable/disable a particular IRQ channel from the in-band stage. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
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 in-band work descriptor used in triggering fd closure off the stack to a global variable, which is fine since the action of flushing the lingering fds is globally scoped. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Dovetail allows the client core to share the common kernel clocks, including CLOCK_REALTIME. This means the core does not have to maintain the latter clock, but should hand over all requests to read the clock and change its epoch to the corresponding in-band kernel services instead. Conversely, Cobalt should keep on maintaining CLOCK_REALTIME when running on top of the legacy I-pipe. Abstract the management of CLOCK_REALTIME to enable such split based on the underlying IRQ pipeline layer. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
In order to have applications calling clock_gettime(CLOCK_MONOTONIC) and Cobalt share the same monotonic source, we need Cobalt to get timestamps from ktime_get_mono_fast_ns(). Although pipeline_read_cycle_counter() does seem to hint to a raw source, with Dovetail, our idea of time is directly based on a refined count of nanoseconds since the epoch, the hardware time counter is transparent to us. This naming discrepancy comes from the legacy I-pipe support where we do manipulate hardware ticks internally; this issue should go when such support is discontinued eventually. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Ask for switching back to oob mode once ptrace core tell that current is resuming from a stopped state, leaving space for other runnable RT threads of the process to take over. Signed-off-by:
Hongzhan Chen <hongzhan.chen@intel.com> [Philippe: added missing dovetail_request_ucall to pipeline_leave_oob_prepare] Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Signed-off-by:
Philippe Gerum <rpm@xenomai.org> [Jan: style fix] Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
When running on top of Dovetail, we may want to perform a specific sequence of actions upon notification of a latency peak by some application. Let's create a dedicated trace call in the API to handle this particular case, instead of relying on the generic "user_freeze" event. NOTE: the new trace call does not return any value, because there is nothing valuable to receive from a trace call. If required, xntrace_enabled() should be tested beforehand to figure out whether the kernel tracer is enabled. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Signed-off-by:
Philippe Gerum <rpm@xenomai.org> [Jan: add missing struct xnsched_quota_group declaration, style fixes] Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
Started to bite us on newer kernels / with dovetail. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
With Dovetail in, a thread control block is fully generic, merely composed of an alternate scheduling control descriptor. Refactor the definitions of the per-architecture control blocks accordingly. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-