All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Florian Bezdeka <florian.bezdeka@siemens.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>, xenomai@xenomai.org
Subject: [xenomai4] POSIX API
Date: Wed, 20 Nov 2024 14:43:29 +0100	[thread overview]
Message-ID: <8734jm3try.fsf@xenomai.org> (raw)
In-Reply-To: <afea1670c26d61ccbd18b6a7b609498bb1dfb020.camel@siemens.com> (Florian Bezdeka's message of "Wed, 20 Nov 2024 12:59:35 +0100")

Florian Bezdeka <florian.bezdeka@siemens.com> writes:

CCing the list. This is a combined discussion about bringing a POSIX API
to xenomai4 and getting rid of the --wrap linker trick for xenomai3 in
the same move.

> On Sun, 2024-11-17 at 18:52 +0100, Philippe Gerum wrote:
>> Florian Bezdeka <florian.bezdeka@siemens.com> writes:
>> 
>> > I finally managed it to "publish" a branch [1] that holds my tries to
>> > get rid of the function wrapping in Xenomai 3.
>> > 
>> > smokey is already running fine, some TODOs are left. See commit
>> > messages for details.
>> > 
>> > Further tests with valgrind and the gcc sanitizer will hopefully follow
>> > soon. Seems I have to do some prctl()/syscall() refactorings first.
>> > 
>> > I would like to close the gap between Xenomai 3 and 4 as good as
>> > possible so that customers can easily move forward without touching
>> > code - ideally.
>> > 
>> > Best regards,
>> > Florian
>> > 
>> > [1] https://gitlab.com/Xenomai/xenomai-hacker-space/-/commits/flo/refactor-wrapping?ref_type=heads
>> 
>> Ok, I had a look at this code. I think I understood the key aspects of
>> it. I believe we can do without the trampoline which would make it CPU
>> independent. At least, I managed to implement the same scheme without
>> it [1], which eventually provides the very same support than we got with the
>> linker trick, i.e. for any frob() service from the POSIX API, we would
>> have:
>
> Yes, maybe I can remove the trampoline as well. Will try...
>
>> 
>> - __real_frob() /* original from glibc */
>> - __wrap_grob() /* a Xenomai implementation in libcobalt/libevl */
>> - __local_frob() /* a local (user-provided) override of __wrap_frob()
>> 
>> __real_frob() would require explicit call via some macro trick like
>> __STD() with libcobalt. Others would be invoked under the hood via a
>> plain call to frob(), depending on the insertion of liboverride.so
>> _before_ libposix.so on the linker command line.
>
> Yep. If we could get it flying this way it should be compatible to the
> Xenomai 3 world. __STD() for libc calls, nothing or __RT() for
> cobalt/evl calls.
>
>> 
>> I'm unsure the local override is that useful for the average user.
>
> Agree, for Xenomai 4 I would like to get rid of the user override.
> Unnecessary complexity - IMHO. 
>
> The situation is different for Xenomai 3. As I can't tell if someone is
> using that already - I heavily doubt that - I probably should keep the
> possibility to so. Backward compatibility...
>
>> 
>> Now, this hack would likely be an improvement over the --wrap directive
>> passed to ld, specifically because we'd not need wrap-link.sh to prevent
>> POSIX symbols in system libraries from being wrapped. As a matter of
>> fact, the technique illustrated in [1] relies on the library dependency
>> order on the link line to hide those symbols from the interposition we
>> would do. Only tested lightly, but this should work (see the Makefile).
>
> I did some tests in this direction as well. The results were promising,
> but more testing has to prove that.
>
>> 
>> BUT, this does not solve the fundamental issue I still see with these
>> more or less transparent interposition techniques which --wrap belongs
>> to as well: they all lack explicitness when it comes to clearly identify
>> who will handle the call by simply reading the source code. We still
>> need to understand the build context to figure out, which is a problem
>> because it's really error-prone, I believe. This is the aspect I'd like
>> to improve for libevl, if ever possible (maybe it is, I'm on something,
>> hopefully, but this requires more thought).
>
> Happy to hear your thoughts.
>
>> 
>> [1] git@source.denx.de:Xenomai/xenomai4/playground.git
>> 

-- 
Philippe.

       reply	other threads:[~2024-11-20 13:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87ses62bi5.fsf@xenomai.org>
     [not found] ` <d28b8d0200ef0e3ff63e833b64c2ad00c554e351.camel@siemens.com>
     [not found]   ` <878qthiw8i.fsf@xenomai.org>
     [not found]     ` <afea1670c26d61ccbd18b6a7b609498bb1dfb020.camel@siemens.com>
2024-11-20 13:43       ` Philippe Gerum [this message]
2024-11-20 19:34         ` [xenomai4] POSIX API Giulio Moro
2024-11-22 13:58           ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734jm3try.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=florian.bezdeka@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.