Skip to contentSkip to conversation

A POSIX interface has landed

EVL Philippe Gerum 2 participants 3 messages Nov 22 – Nov 23

lore
Share & tools
lore
#0 lore raw

After several iterations, pauses and rewrites, a POSIX-conforming interface is finally available with libevl, alongside the original EVL API. 'libcobalt.so' is generated and installed with its headers side-by-side with 'libevl.so'. We can use any of them or both, separately or combined in a single application. The main goal is to cover what x3's libcobalt provides feature-wise, and even more in some cases. An optional compat mode wraps some v3-specific services when needed. The target spec is a subset of POSIX.1-2024 for evl, although this only meant adding pthread_cond_clockwait(), pthread_mutex_clocklock() and sem_clockwait() so far.

libcobalt is not an emulation of POSIX calls on top of the original API, it is a standalone implementation sharing a set of intrinsics with the latter. These low-level intrinsics talk to the evl core, keeping the nitty-gritty details out of the window dressing, i.e. the user-facing APIs. They are part of libevl.so, and both APIs use them the way they see fit. If you plan to write your own real-time API leveraging the evl core services, go with the intrinsics in libevl, this is their basic purpose.

Documentation is not there yet (how odd?!). This said, there is an ongoing work revamping the x4 website in order to introduce this new API and some kind of versioning as well, so everything will land in one go.

Crash course: libevl builds the POSIX API by default, you only need to pass -Dcompat=true to meson for enabling the full v3 compat shim. Once installed, use pkgconfig --libs|--cflags cobalt to retrieve the build flags for using libcobalt. evl-test runs the POSIX test suite if present along with the test suite of the original API. That's it (_that_ was short!).

The implementation required additional services from the core, so changes went to linux-evl as well. The core stays POSIX-free, but it does provide a couple of new general-purpose services which are convenient for implementing a POSIX API in user-space (e.g. see the new 'depot' element).

NOTE: The code stops short of one aspect: it does not provide symbol wrapping like v3 does (using ld's --wrap trick); explicit annotation using __EVL(call), __COBALT(call) or __RT(call) [all aliases] is required at the moment. This is deliberate, this needs more thought because symbol wrapping the way v3 implements it proved to have nasty pitfalls over the years, as it comes with hidden edge cases. I plan to RFC on this in a separate thread.

I merged the POSIX support and its test suite to the next/ branches in linux-evl and libevl; the kernel part should move to the plain rebase branches once the CI says that all is fine with its test configs. At the moment, evl-6.12.y-cip, evl-6.18.y and evl-7.2 are up to date with the POSIX support. evl-v7.3 is late, but almost ready and will appear in the coming days (I'm almost late for v7.4 which means that everything is going -*cough*- as planned). Keep Calm and Rebase.

Signature · 1 line
Philippe.
#1 lore raw

Hi Philippe,

Quoted 38 lines · Philippe Gerum

After several iterations, pauses and rewrites, a POSIX-conforming interface is finally available with libevl, alongside the original EVL API. 'libcobalt.so' is generated and installed with its headers side-by-side with 'libevl.so'. We can use any of them or both, separately or combined in a single application. The main goal is to cover what x3's libcobalt provides feature-wise, and even more in some cases. An optional compat mode wraps some v3-specific services when needed. The target spec is a subset of POSIX.1-2024 for evl, although this only meant adding pthread_cond_clockwait(), pthread_mutex_clocklock() and sem_clockwait() so far.

libcobalt is not an emulation of POSIX calls on top of the original API, it is a standalone implementation sharing a set of intrinsics with the latter. These low-level intrinsics talk to the evl core, keeping the nitty-gritty details out of the window dressing, i.e. the user-facing APIs. They are part of libevl.so, and both APIs use them the way they see fit. If you plan to write your own real-time API leveraging the evl core services, go with the intrinsics in libevl, this is their basic purpose.

Documentation is not there yet (how odd?!). This said, there is an ongoing work revamping the x4 website in order to introduce this new API and some kind of versioning as well, so everything will land in one go.

Crash course: libevl builds the POSIX API by default, you only need to pass -Dcompat=true to meson for enabling the full v3 compat shim. Once installed, use pkgconfig --libs|--cflags cobalt to retrieve the build flags for using libcobalt. evl-test runs the POSIX test suite if present along with the test suite of the original API. That's it (_that_ was short!).

The implementation required additional services from the core, so changes went to linux-evl as well. The core stays POSIX-free, but it does provide a couple of new general-purpose services which are convenient for implementing a POSIX API in user-space (e.g. see the new 'depot' element).

Quoted 7 lines

NOTE: The code stops short of one aspect: it does not provide symbol wrapping like v3 does (using ld's --wrap trick); explicit annotation using __EVL(call), __COBALT(call) or __RT(call) [all aliases] is required at the moment. This is deliberate, this needs more thought because symbol wrapping the way v3 implements it proved to have nasty pitfalls over the years, as it comes with hidden edge cases. I plan to RFC on this in a separate thread.

Is that the only blocker for running the x3 testsuite over x4?

__RT() and __STD() kept me busy so often, I'm wondering if we should really implement both of them - if at all - again.

Shouldn't be __STD() be enough? (You get __RT() by default, but there should be a way to call the "hidden" libc services.)

Quoted 8 lines

I merged the POSIX support and its test suite to the next/ branches in linux-evl and libevl; the kernel part should move to the plain rebase branches once the CI says that all is fine with its test configs. At the moment, evl-6.12.y-cip, evl-6.18.y and evl-7.2 are up to date with the POSIX support. evl-v7.3 is late, but almost ready and will appear in the coming days (I'm almost late for v7.4 which means that everything is going -*cough*- as planned). Keep Calm and Rebase.

I should try to reserve some time to look into this in more detail. Sounds very promising so far.

Florian

#2 lore raw
Quoted 49 lines · Florian Bezdeka

Hi Philippe,

Quoted 38 lines · Philippe Gerum

After several iterations, pauses and rewrites, a POSIX-conforming interface is finally available with libevl, alongside the original EVL API. 'libcobalt.so' is generated and installed with its headers side-by-side with 'libevl.so'. We can use any of them or both, separately or combined in a single application. The main goal is to cover what x3's libcobalt provides feature-wise, and even more in some cases. An optional compat mode wraps some v3-specific services when needed. The target spec is a subset of POSIX.1-2024 for evl, although this only meant adding pthread_cond_clockwait(), pthread_mutex_clocklock() and sem_clockwait() so far.

libcobalt is not an emulation of POSIX calls on top of the original API, it is a standalone implementation sharing a set of intrinsics with the latter. These low-level intrinsics talk to the evl core, keeping the nitty-gritty details out of the window dressing, i.e. the user-facing APIs. They are part of libevl.so, and both APIs use them the way they see fit. If you plan to write your own real-time API leveraging the evl core services, go with the intrinsics in libevl, this is their basic purpose.

Documentation is not there yet (how odd?!). This said, there is an ongoing work revamping the x4 website in order to introduce this new API and some kind of versioning as well, so everything will land in one go.

Crash course: libevl builds the POSIX API by default, you only need to pass -Dcompat=true to meson for enabling the full v3 compat shim. Once installed, use pkgconfig --libs|--cflags cobalt to retrieve the build flags for using libcobalt. evl-test runs the POSIX test suite if present along with the test suite of the original API. That's it (_that_ was short!).

The implementation required additional services from the core, so changes went to linux-evl as well. The core stays POSIX-free, but it does provide a couple of new general-purpose services which are convenient for implementing a POSIX API in user-space (e.g. see the new 'depot' element).

Quoted 7 lines

NOTE: The code stops short of one aspect: it does not provide symbol wrapping like v3 does (using ld's --wrap trick); explicit annotation using __EVL(call), __COBALT(call) or __RT(call) [all aliases] is required at the moment. This is deliberate, this needs more thought because symbol wrapping the way v3 implements it proved to have nasty pitfalls over the years, as it comes with hidden edge cases. I plan to RFC on this in a separate thread.

Quoted 2 lines

Is that the only blocker for running the x3 testsuite over x4?

To run it mostly unmodified, testbed apart? I believe so. The POSIX test scenarios in x3 have been implemented in the x4 test suite using explicit annotation, and those tests are all green. So far, so good.

Quoted 6 lines

__RT() and __STD() kept me busy so often, I'm wondering if we should really implement both of them - if at all - again.

Shouldn't be __STD() be enough? (You get __RT() by default, but there should be a way to call the "hidden" libc services.)

The issue with __STD() as the only explicit marker would be that we would then exclusively rely on symbol wrapping to reach libcobalt services, which raises some problems. I'll follow up on this in a separate thread.

Signature · 1 line
Philippe.