- 02 Jul, 2021 1 commit
-
-
Jan Kiszka authored
Passing a potentially large mask by value was a bad idea of I-pipe. Dovetail uses the kernel API, and that does it right. So adjust our internal abstraction - which is unused so far anyway. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
- 18 Jun, 2021 1 commit
-
-
Jan Kiszka authored
This is needed when there is not userspace-readable clocksource available. This can happen under Dovetail where Linux selects the suitable clocksource and may see problems with, e.g., the TSC under x86. When it then switches to a clocksource that require a syscall, we so far migrate to Linux on every access. This handler resolves that problem. It's not needed under I-pipe where clock_gettime is not routed through the vDSO and the clocksource is separate. Therefore, we simply never match on the related syscall numbers under I-pipe. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
- 16 Jun, 2021 1 commit
-
-
Add missing sigarray initialization to avoid missing signal in __xnthread_signal. Signed-off-by:
Hongzhan Chen <hongzhan.chen@intel.com> [Jan: simplify size calculation] Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
- 15 Jun, 2021 3 commits
-
-
Jan Kiszka authored
Same pattern as for previous changes: All that code it common, no need to duplicate it. The only difference was that I-pipe needs to call ipipe_disable_user_intret_notifier first while dovetail does this disabling automatically. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
Same pattern as for previous changes: All that code it common, no need to duplicate it. The only difference between the two versions of handle_cleanup_event was what is now encapsulated in pipeline_cleanup_process. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
Same pattern as for previous changes: All that code it common, no need to duplicate it. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
- 14 Jun, 2021 2 commits
-
-
Jan Kiszka authored
Those functions are identical now, with the variations due to some older I-pipe releases removed. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
All those events have been added long ago to I-pipe versions we want to support with the next release. Time to drop the tests which will also allow sharing some code with dovetail. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
- 11 Jun, 2021 19 commits
-
-
Jan Kiszka authored
Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
I-pipe makes sure that arguments of compat calls are ordered just like native calls. Dovetail does not. But it is better to use the kernel's syscall_get_arguments for retrieving the arguments anyway. Introduce pipeline_get_syscall_args to abstract that difference. Xenomai/ARM syscalls have an unconventional argument marshalling, with ARM_ORIG_r0 containing the Xenomai syscall number (ORed with __COBALT_SYSCALL_BIT), followed by the first actual argument to the syscall in ARM_r1. For this reason, using syscall_get_arguments() to collect the syscall parameters won't yield the expected result, with regs[0] matching __xn_reg_sys(regs) instead of __xn_reg_arg1(regs). Allow Dovetail-enabled architectures to override the generic implementation of pipeline_get_syscall_args(), provide a working one for ARM. Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com> [Philippe: add special handling of ARM] Signed-off-by:
Philippe Gerum <rpm@xenomai.org>
-
At this chance, fix stale and missing copyright notices. Specifically, Dmitriy Cherkasov <dmitriy@mperpetuo.com> is the original author of the Xenomai/arm64 port, based on the ARM implementation; add credit where it is due. In the same move, introduce SPDX tags as replacement for GPL boilerplate for the altered files. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Unlike the I-pipe, Dovetail does not need to expose the underlying timestamp counter to applications. The best equivalent to this counter would be the common monotonic clock, expressing time as a count of nanoseconds. Fork the implementation accordingly between Dovetail and I-pipe configurations, depending on which pipeline flavour was detected at init. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Expiration dates of in-band timers are based on the monotonic time base read by ktime_get(), which is ok for us to use from non-NMI context. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
When Dovetail is enabled in the kernel, we get timestamps for common clocks (CLOCK_REALTIME, CLOCK_MONOTONIC) from the vDSO-based gettime() routine as usual. Do not expect KUSER_TSC support to be there in such a case, it is not. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
When Dovetail is enabled in the kernel, we get timestamps for common clocks (CLOCK_REALTIME, CLOCK_MONOTONIC) from the vDSO-based gettime() routine as usual. Do not expect KUSER_TSC support to be there in such a case, it is not. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Jan Kiszka authored
This is needed as cobalt_arch_check_features() will make use of __cobalt_tsc_clockfreq via cobalt_use_legacy_tsc(). Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
The license notice for arch/arm/dovetail/machine.c is fixed in order to match the remaining code, which is [1] for the prefaulting handler, and myself for the rest. [1] from Xenomai v2.5-rc1: commit 8421cc62 Author: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> Date: Sat Nov 15 23:45:24 2008 +0000 Fault heaps memory on ARM Signed-off-by:
Philippe Gerum <rpm@xenomai.org> [Jan: style fix] Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
Make sure not to raise XNSCHED when setting up the root thread, so that we can't start rescheduling from irq_exit_pipeline() before all CPUs have their runqueue fully built. At this chance, add the missing tracepoint reporting a remote scheduling request. Signed-off-by:
Philippe Gerum <rpm@xenomai.org> Signed-off-by:
Jan Kiszka <jan.kiszka@siemens.com>
-
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 9 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>
-