hm2_eth: Create support library's / Xenomai3 support - #4498
Conversation
A library is needed to avoid having to link hm2_eth to libevl and being able to create a package not depending on libevl.
...so they are less likely to conflict and remove not externaly used install_firewall_perinterface from header.
ca6fd32 to
e023330
Compare
|
To me it certainly feels like a bad choice doing dlopen in a realtime component. Is the target for compilation ever both uspace/posix, Xenomai3 and EVL at the same time? If the answer is no, then there should be only one So, what is the answer to the question, whether the build can only target one system at a time or multiple simultaneously? |
Why? It only changes from 2x to 3x dlopen in the rtapi_app main thread. But of course there is no dlopen in the realtime tasks which would be bad. Load RT extension: linuxcnc/src/rtapi/uspace_rtapi_main.cc Line 1533 in fa910f1 Load Component: linuxcnc/src/rtapi/uspace_rtapi_main.cc Line 576 in fa910f1 With this PR, there is a third dlopen in the same thread in the rtapi_app_main path called just after load: linuxcnc/src/rtapi/uspace_rtapi_main.cc Line 583 in fa910f1
At build time, if you have libxenomai / libevl installed, all three (+posix) variants are compiled in. But that also means that if you create a debian package, it will automatically depend on these libs. I use this all day for testing, just boot a different kernel and it works out of the box with the correct back-end, no rebuild needed. Looks like the reason liblinuxcnc-uspace-xenomai.so / liblinuxcnc-uspace-xenomai-evl.so for rtapi_app also exist to break this dependency, and there is even a control file to pack these in a different debian package: https://github.com/LinuxCNC/linuxcnc/blob/master/debian/control.uspace-xenomai.in But it looks like the rest was either removed or never finalized, so these packages are not built. If this is finalized, you would have: linuxcnc-uspace: Posix, not depending on libxenomai / libevl
It can target all of the existing uspace realtime systems at the same time but right now, linuxcnc-uspace will then depend on libxenomai / libevl which is unnecessary but only an issue if these libs are not available in the linuxcnc package repo. |
|
This is best argument I heard so far, for splitting the deb... |
This is also the main intent besides being able to use linuxcnc built with libevl on a system withouth. However, with a single deb, it will still depend on libevl. Might be it can be changed to recommended, i could look into how debian packages are configured and if shlibdeps can be modifyed. But I think separate packages are nicer anyway. |
|
Hello, I have two questions from a user’s perspective:
|
Basically, Xenomai3 support is already in since some time (2016). Now that the framework is in to have different backends for hm2_eth, it took only 140 lines of code for Xenomai3 support. It might be of use for some people, so why not add it, especially due to it took only a few hours to create it. All I have read so far about realtime performance, there is no way to predict which system works best on your PC. The only real way is to test it. And you can only do that if the support is there. It might well be that for some people, Xenomai3 works better. This was also the main reason for me to implement this: Being able to test how well it works.
This is a question for the maintainers creating live images. Basically, the actual framework would also support a live image with tree different kernels and depending on which you start, the matching RT framework is used. However, to have generic Debian packages which can be installed with or without libevl / libxenomai, part 1 of this PR (or one of the alternatives) is needed. |
|
Thanks for the explanation. I now understand why you want to keep the individual variants separate – mainly because of the dependencies and because, as a developer/tester, you can have a single build and test it against different kernels. I’m looking at it a little differently, though, from the perspective of a beginner who is using LinuxCNC for the first time. Someone coming from Windows or Mac is often also working with Debian for the first time. Such a user really doesn’t know what POSIX, Xenomai 3 or EVL mean. I don’t think it’s ideal to expect them to make this decision before they have even run LinuxCNC for the first time. A Debian beginner also tends to have exactly the opposite approach from an experienced developer: they would rather have “everything” installed so that it works. For a developer this may be a nightmare, but for a beginner it is completely normal. :-) So I could imagine something like a simple meta-package called An experienced user could of course still install only This is just a suggestion from a UX perspective. I’m not saying that it is technically a better solution than your package separation. One more small point about the naming. Personally, I would prefer: instead of Again, the main reason is the beginner. “EVL” doesn’t mean anything to them, whereas So perhaps it makes sense to keep the packages separate for clean dependencies, while also providing one simple “default” path for people who are just getting started with LinuxCNC and Debian. |
|
Basically, not keeping the add-ons separate would mean either:
If you don't know what this means, either google it or read the doc. I still have to update the main section about real time tough. For beginners, it's probably the best to stay with PREEMPT_RT, at least until there is some experience from more advanced users. linuxcnc -> this is already taken by the RTAI variant Suggestion which (mostly) matches the naming already used in the source: |
|
@BsAtHome Would you prefer if I separate the Xenomai4 OOB improvements to a separate PR? The library part seams to need some more discussion. But it is also needed for Xenomai3 due to Xenomai3 uses a many C and LD flags to replace posix functionality which would probably be a bad idea to apply to all components. |
e023330 to
7efe610
Compare
By attaching rtapi_app also to the EVL core, no posix initialization is needed and all can be set up in rtapi_app_main().
This is not needed any more.
7efe610 to
c49b427
Compare
|
To simplify review and testing, I decided to create a PR only concerning the Xenomai4 improvements: #4503 It should be merged first due to there will be some conflicts but they are easy to resolve. |
This PR has tree parts. If desired, I can split them also up in to separate PR's.
For now it is more about the concepts. No need to review the code from a style standpoint.
Part1: Create support library's
The issue is, that as soon as hm2_eth is linked to libevl, this module can not be used any more without libevl installed.
By creating liblinuxcnc-hm2_eth_net_evl.so and liblinuxcnc-hm2_eth_net_xenomai.so and loading them only when needed, the hard dependency is broken and the library's can be deployed in a linuxcnc-uspace-xenomai / linuxcnc-uspace-evl Debian package.
The Debian packages are not yet created but I am planning to do so if this approach is approved.
The firewall functions are moved out of the Ethernet support modules, so not so many exports are needed for the library's. The function order changes slightly but this should have no side effects.
Alternatives:
What do you think about the support library approach?
Part 2: Xenomai3 support
It was easy to do. Note that sendto(), recvfrom() and other syscalls are overwritten by the Xenomai C / LD flags, so even thoutght it looks like posix, behind are xenomai syscalls. This is just how xenomai3 posix skin works.
TBD: if anyone needs this. I just wanted to try it to see any differences to xenomai4. It needs more testing but on my hardware, performance is similar. However, setup is a bit more cumbersome. The two scripts rtnet_up.sh / rtnet_down.sh are just temporary and should go to the man page with some description how to set it up when done.
Part 3: Xenomai4 OOB improvements
The code is still in but there is an other PR only concerning this which should be merged first: #4503