-
Notifications
You must be signed in to change notification settings - Fork 67
Merge flavor builds: modules, rtapi_app, ulapi #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge flavor builds: modules, rtapi_app, ulapi #227
Conversation
hal/hostmot2: make watchdog timeout_ns a pin
scripts/linuxcnc.in: more meaningful instructions
Convert hm2 params to pins
6ca7c99806 Merge pull request machinekit#86 from machinekoder/fix-security 2c4db3edfd update npm package to fix security vulnerability 6c52a98b0a enable support for Python 3.6/3.7 git-subtree-dir: src/machinetalk/proto git-subtree-split: 6ca7c99806401179ece164b07dc87852bfa8df9c
Merge back Machinetalk with fixes
…el-threads Revert "Remove hard kernel threads references"
machinekit/launcher: make sure zombies are excluded from running process
Signed-off-by: Mick <arceye@mgware.co.uk>
Fix hard kernel thread refs removal
lib/python/launcher: fix problems with superfluous whitespace
Add missing index handling to the pru encoder
In previous tests, I somehow missed that when the Xenomai libs are
linked to an executable (or a `dlopen()`ed plugin), if they fail to
detect Xenomai on the running system, they will exit the application
with this message:
Xenomai: /dev/rtheap is missing
(chardev, major=10 minor=254)
This seems unavoidable, because this happens in `ld-linux.so` before a
single line of application code is executed, and the [Xenomai code][1]
appears not to provide a way to turn the check off.
This patch works around the problem by splitting `xenomai.c` into two.
`xenomai.c`:
- Still linked to `rtapi.so`
- Retains the flavor descriptor struct
- Retains the flavor checks and module init and exit hooks
- Module init now:
- Calls `dlopen("xenomai_lodaer.so")`,
- Extracts the `xenomai_descriptor_updater()` function, and
- Calls that, passing the flavor descriptor to be updated
`xenomai_loader.c`:
- Linked into separate module with Xenomai libraries
- Contains all functions that depend on Xenomai libs
- Contains a `xenomai_descriptor_updater()` function that plugs those
functions into the flavor descriptor
In this way, the Xenomai libraries are only loaded when the Xenomai
flavor is picked, and don't exit `rtapi_app` on non-Xenomai systems.
[1]: https://gitlab.denx.de/Xenomai/xenomai/blob/eol/v2.6.x/src/skins/common/bind.c#L67-72
9aac00c to
1b768b7
Compare
|
@zultron, I have been looking into your changes in 8653ff2 and trying to understand it. I have been under impression, (based little a bit on information #201 (comment) which I probably misinterpreted) that you will install one However, I must have been mistaken, because this looks like the same functionality just in not very portable package. (Portable means no reinstall or update of the main Does that mean that I will have to implement this convoluted solution for all my flavored endeavors? |
The one This is how it is right now, and it is a somewhat convoluted solution, although I don't think it's too bad. In the packaging, it's a trivial change to put the Xenomai plugin into the Don't forget, this is still WIP, and you're welcome to jump in and improve things! |
|
Update: I've solved all problems with Next step after that will be to test on |
|
BTW, I believe that regression is actually present in the current master branch. We never see it because it only happens in Jessie When it does show up, it shows up nondeterministically, starting in some random tests; once it hits, every following test will fail. |
In Stretch and Buster, output formats may be combined with commas:
$ ps -p 1 -o pid=,s=
1 S
On Jessie, this does not work:
$ ps -p 1 -o pid=,s=
,s=
1
But separating them as separate options does:
$ ps -p 1 -o pid= -o s=
1 S
This patch fixes e.g. `rtapi:0` exit detection in the `realtime`
script.
OK, what about compiling the [.c/.h]/more flavor API hooks into Packaging will be Can this work? If so I can do it. (After beating the buildsystem into submission.) |
I like this kind of idea. Isolating anything flavor-specific into separate files was one of my goals for this project, of course. I considered going that last mile to remove that small mess from
That could work, but of course you'll have to build two modules for each flavor: One module that does the flavor check always gets loaded; the other module that does the real work only gets loaded after that flavor is selected. You could also teach the autoconf system to look in e.g.
Go for it, sounds like fun. For me, I'm focusing on finishing basic functionality first, since my time is limited. I'll start testing ARM and Xenomai soon (waiting on a replacement for the USB UART adapter I left back in China). In the meantime, I'm working on getting LCNC to build against MK HAL, starting with some work done by @ArcEye and of course more beating on the build system. |
Wait, why? Constructor function query the system if running threads of type is possible, i.e. calling the BTW, is there any reason why
I could, but - don't laugh - I have never written a line of EDIT: Because on any given time there would be only one |
The problem is as soon as you
POSIX threads should always be able to run. I've also often said that non-RT threads shouldn't be allowed to run without the user explicitly requesting them, but then I never did anything about it. (That actually happened once, but we actually didn't notice for quite a while because we were getting ~7us max jitter on an isolated J1900 core!)
Is this still true if we have to split up the modules? I'll have to think about this after some sleep. |
Didn't realize that the startup sequence I talked about in machinekit/machinekit#1462 would not work in Xenomai 2.6 because of no provisions from the development team. Theoretically it could be still possible to dlopen the Xenomai library only if the flavor finds working system, but then I would need to reference all used functions. Point is to create encapsulated flavor module. (So Machinekit-HAL only cares/knows about one solib. Calls dlopen on it and if after return there is nothing registered, that's it.) If I have to use two solibs for one flavor, I will grouch, but it will be OK.
Yeah, well, English lesson received.
This could work that way. If the user do not install the flavor solib, which he will have to do explicitly, into the specified folder, then there will be no chance of loading it. |
|
I think that this pull request spent enough time on the ice and that it is time to pull it into the fold. There is starting of the materialization of rot and regression given that the Machinekit-HAL master is 44 commits ahead. So to prevent further branch splitting (for lack of better terminus technicus) I propose merging the conflict and then merging the pull into Machinekit proper. Discussing this with @luminize, we came upon the idea that the fact that no new (I am somehow biased about it as my work is building atop it.) |
|
I've had to let this one drop because of time constraints. If somebody wants to take it over, I would be very happy to have multiple thread flavors simultaneously installed in the same OS image again, a feature needed for portable Docker images that I use but currently must hack around packaging file conflicts introduced at some point. I forgot exactly what is in this branch. The scope of the original PR (achieved) was merging modules into a single directory and the bonus goal of loading flavors as modules into a single, unified rtapi_app (also achieved). The main outstanding problem I remember was Xenomai threads didn't work on BeagleBone in my very brief tests. If this branch is still at that point, I bet it would be an easy job for @cerna and others to fix that problem and test. I don't remember if this branch contains a big stack of commits that restore LCNC EMC API compatibility by reverting a number of minor API changes made since the MK fork. If those commits are in this branch, they would break the MK EMC application build, and would need to be removed. |
Single module merge Merging @cerna's conflict resolutions for changes in upstream master since 2019-07 or so
This PR is a port of machinekit/machinekit#1462 to the machinekit-hal repo. There's lengthy discussion there about this work. In summary, this work merges separate flavor builds into one, solving long-standing problems from the multiple-flavor "unified build" and greatly simplifying the code, the build system and the packaging.
Changes in this PR:
rtlib/<flavor>/*.soare built once intortlib/modules/*.sortapi_app_<flavor>binaries are merged into a singlertapi_apprtapi_switchis removed and changed back to something like it was before the "unified build"rtapi_switchrtapi_appnow picks a flavor internally (using the same routines as the oldflavorutility)#ifdefblocks is now selected at run-time, either moved into functions behind the flavor API, or by checking generic characteristics of the running flavor (e.g. RT or non-RT) exposed through the flavor APIrtapi_apppicks is now mostly irrelevant outside of that executable; e.g. therealtimescript doesn't need to know about flavors, and code outside thesrc/rtapi/directory only occasionally queries those generic flavor characteristicsThis work expects to convey at least the following benefits:
comp/instcomptools don't need to worry about what flavors to build or where to install the modulesautoconfscript doesn't have to template so many config files and scripts to account for flavors being builtMakefileandSubmakefiles don't have to deal with flavorsmakecalls for thread flavor builds are now gonemachinekit-hal-rt-preemptpackages are preserved, they are simply optional metapackages that pull in the needed kernel, and the basemachinekit-halpackage is sufficientmachinekit-hal-devpackage is now revivedThis PR also ULAPI (non-RT) threads a separate, co-equal thread system, and removes flavor-specific configuration from the global data segment. Before, ULAPI threads used flavor-specific thread facilities (e.g. clock routines), and queried the global data segment for flavor information. That was unnecessary, though, since ULAPI by definition doesn't require RT performance. Flavor-specific code was changed to use POSIX thread facilities instead, and flavor information was removed from the global data segment. This further simplifies the code and further makes the thread flavor transparent outside of
rtapi_app.