All of lore.kernel.org
 help / color / mirror / Atom feed
* Xenomai ipipe x86 64 bits with 32 bits librairies
@ 2021-06-02 22:15 MONTET Julien
  2021-06-05 11:53 ` MONTET Julien
  0 siblings, 1 reply; 4+ messages in thread
From: MONTET Julien @ 2021-06-02 22:15 UTC (permalink / raw)
  To: Xenomai

Hello the Xenomai team,

First of all I thank you for all your previous answers.
Xenomai 3.1 (skins included) is working fine on arm 32bits !
Now I am trying to find a way to do the same thing on x86 - ipipe 4.19.177+

My current code is supposed to work on 32bits and I can't upgrade it to 64bits.
I know x86_32 is officially no more supported for ipipe patch since February, that is why my idea was to get an ipipe x86_64 (I already installed it on the machine) and compile Xenomai librairies in 32bits.


My commands - I try to cross compile:
./configure --host=i686-linux-gnu CFLAGS="-m32 -O2" LDFLAGS="-m32" --with-core=cobalt --enable-smp --enable-pshared
https://paste.ubuntu.com/p/h74GSvMjP9/
(I also tried to add -march=i686 in CFLAGS without success

The two lines below produce the same errors :
make ARCH=i686 CROSS_COMPILE=i686-linux-gnu-
make install DESTDIR="[PATH]/xenomai-3.1/tmp_xenomai"
https://paste.ubuntu.com/p/M39PJgTM9X/


A similar thread on the Xenomai forum :
https://xenomai.org/pipermail/xenomai/2020-May/043000.html
The strange thing with the link above is the method should be working for -m32 (and not for -mx32). I tried with old librairies (3.0+), and I had the same issues


What I found :
The macro  #ifdef CONFIG_X86_X32 may not be defined because I have errors on __COBALT_X32_BASE :
https://xenomai.org/documentation/xenomai-3/html/xeno3prm/arch_2x86_2include_2asm_2xenomai_2syscall32_8h_source.html

What I have installed on my host :
sudo apt-get install linux-libc-dev:i386
sudo apt install gcc-i686-linux-gnu


Is there a way to use i686 (x86_32) code with Xenomai ?
Do you have any advices on this subject ?

Best regards,
Julien
<mailto:xenomai@xenomai.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Xenomai ipipe x86 64 bits with 32 bits librairies
  2021-06-02 22:15 Xenomai ipipe x86 64 bits with 32 bits librairies MONTET Julien
@ 2021-06-05 11:53 ` MONTET Julien
  2021-06-05 13:15   ` Philippe Gerum
  0 siblings, 1 reply; 4+ messages in thread
From: MONTET Julien @ 2021-06-05 11:53 UTC (permalink / raw)
  To: Xenomai

Hello everyone,

To keep you informed of my progress to run a 32bits program on x86 with Xenomai:
-> I tried to build 32bits Xenomai library for a 64bits system built with a Cobalt version
--> It doesn't work and stopped my exec or sudo /usr/xenomai/bin/latency with the error below
--> 0"000.000| BUG in low_init(): [main] Cobalt core not enabled in kernel

-> I tried to build 64 bits Xenomai library for 64bits system built with Cobalt version
--> The code doesn't build because it is waiting for 32bits library (alchemy, ...)

There is still an other possibility I have in mind, but I don't know if it could work properly.
During the kernel compilation I used "menuconfig" and noticed a line named "Binary Emulations". Inside it I found :
[*] IA32 Emulation
< > IA32 a.out support
[ ] x32 ABI for 64-bit mode

I am tempted to select "IA32 a.out support" and "x32 ABI for 64-bit mode" as well.
Do these options have an impact on Xenomai or are they only used in a general case ?

Regards,


________________________________
De : MONTET Julien
Envoyé : jeudi 3 juin 2021 00:15
À : Xenomai <xenomai@xenomai.org>
Objet : Xenomai ipipe x86 64 bits with 32 bits librairies

Hello the Xenomai team,

First of all I thank you for all your previous answers.
Xenomai 3.1 (skins included) is working fine on arm 32bits !
Now I am trying to find a way to do the same thing on x86 - ipipe 4.19.177+

My current code is supposed to work on 32bits and I can't upgrade it to 64bits.
I know x86_32 is officially no more supported for ipipe patch since February, that is why my idea was to get an ipipe x86_64 (I already installed it on the machine) and compile Xenomai librairies in 32bits.


My commands - I try to cross compile:
./configure --host=i686-linux-gnu CFLAGS="-m32 -O2" LDFLAGS="-m32" --with-core=cobalt --enable-smp --enable-pshared
https://paste.ubuntu.com/p/h74GSvMjP9/
(I also tried to add -march=i686 in CFLAGS without success

The two lines below produce the same errors :
make ARCH=i686 CROSS_COMPILE=i686-linux-gnu-
make install DESTDIR="[PATH]/xenomai-3.1/tmp_xenomai"
https://paste.ubuntu.com/p/M39PJgTM9X/


A similar thread on the Xenomai forum :
https://xenomai.org/pipermail/xenomai/2020-May/043000.html
The strange thing with the link above is the method should be working for -m32 (and not for -mx32). I tried with old librairies (3.0+), and I had the same issues


What I found :
The macro  #ifdef CONFIG_X86_X32 may not be defined because I have errors on __COBALT_X32_BASE :
https://xenomai.org/documentation/xenomai-3/html/xeno3prm/arch_2x86_2include_2asm_2xenomai_2syscall32_8h_source.html

What I have installed on my host :

sudo apt-get install linux-libc-dev:i386
sudo apt install gcc-i686-linux-gnu


Is there a way to use i686 (x86_32) code with Xenomai ?
Do you have any advices on this subject ?


Best regards,

Julien

<mailto:xenomai@xenomai.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Xenomai ipipe x86 64 bits with 32 bits librairies
  2021-06-05 11:53 ` MONTET Julien
@ 2021-06-05 13:15   ` Philippe Gerum
  2021-06-05 14:25     ` MONTET Julien
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Gerum @ 2021-06-05 13:15 UTC (permalink / raw)
  To: MONTET Julien; +Cc: xenomai


MONTET Julien via Xenomai <xenomai@xenomai.org> writes:

> Hello everyone,
>
> To keep you informed of my progress to run a 32bits program on x86 with Xenomai:
> -> I tried to build 32bits Xenomai library for a 64bits system built with a Cobalt version
> --> It doesn't work and stopped my exec or sudo /usr/xenomai/bin/latency with the error below
> --> 0"000.000| BUG in low_init(): [main] Cobalt core not enabled in kernel
>

You may want to double-check in the kernel log whether the core is
actually enabled. Early init errors might prevent this.

With dmesg, check that you do have an output of this sort:

[    0.098064] [Xenomai] scheduling class idle registered.
[    0.098074] [Xenomai] scheduling class rt registered.
[    0.098258] I-pipe: head domain Xenomai registered.
[    0.100609] [Xenomai] Cobalt v3.1

Any error encountered while initializing the Cobalt core would disable
it entirely for the whole session, hence receiving the low_init() error.

> -> I tried to build 64 bits Xenomai library for 64bits system built with Cobalt version
> --> The code doesn't build because it is waiting for 32bits library (alchemy, ...)
>
> There is still an other possibility I have in mind, but I don't know if it could work properly.
> During the kernel compilation I used "menuconfig" and noticed a line named "Binary Emulations". Inside it I found :
> [*] IA32 Emulation
> < > IA32 a.out support
> [ ] x32 ABI for 64-bit mode
>
> I am tempted to select "IA32 a.out support" and "x32 ABI for 64-bit mode" as well.
> Do these options have an impact on Xenomai or are they only used in a general case ?
>

All you need is CONFIG_IA32_EMULATION=y to enable 32bit user
compatibility mode over the x86_64 kernel.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Xenomai ipipe x86 64 bits with 32 bits librairies
  2021-06-05 13:15   ` Philippe Gerum
@ 2021-06-05 14:25     ` MONTET Julien
  0 siblings, 0 replies; 4+ messages in thread
From: MONTET Julien @ 2021-06-05 14:25 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai@xenomai.org

Hello Philippe,

Thanks for your answer.

I double check on multiple reboot and I have the same outputs (I may have forgotten something with smi).
[Xenomai] scheduling class idle registered.
[    0.392623] [Xenomai] scheduling class rt registered.
[    0.392646] [Xenomai] disabling automatic C1E state promotion on Intel processor
[    0.392656] [Xenomai] SMI-enabled chipset found, but SMI workaround disabled
                         (see xenomai.smi parameter). You might encounter
                         high latencies!
[    0.392690] I-pipe: head domain Xenomai registered.
[    0.393303] [Xenomai] Cobalt v3.1

grep CONFIG_IA32_EMULATION /usr/src/linux-headers-4.19.177+/.config
gives me : CONFIG_IA32_EMULATION=y

The Xenomai library compiled in x86_64 is working :

  *   sudo /usr/xenomai/bin/latency
     *   == Sampling period: 100 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
RTT|  00:00:01  (periodic user-mode task, 100 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD|      0.230|      0.249|      1.530|       0|     0|      0.230|      1.530
RTD|      0.239|      0.250|      1.534|       0|     0|      0.230|      1.534
^C---|-----------|-----------|-----------|--------|------|-------------------------
RTS|      0.230|      0.249|      1.534|       0|     0|    00:00:02/00:00:02
  *   when I use it I get userspace and kernel events from x86_64 applications (from example)

The Xenomai library compiled in x86_32 (i686) I get the error : low_init():  ...



Method to solve my issue :

1) I checked the latency binary, and noticed the "dynamicaly linked".

command on 64bits : file latency
/usr/xenomai/bin/latency: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=f263b69d28b6c0341966b10fbe146e424d849ef8, for GNU/Linux 3.2.0, not stripped

command on 32bits : file latency
tmp_xenomai/usr/xenomai/bin/latency: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=a401c88826ab59175fc466279c95799960689c6f, for GNU/Linux 3.2.0, not stripped


2) So I looked at each file and noticed something strange for the 32bit exec:

On my host (Ubuntu 20.04)
--->  file /usr/xenomai/bin/latency
tmp_xenomai/usr/xenomai/bin/latency: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=a401c88826ab59175fc466279c95799960689c6f, for GNU/Linux 3.2.0, not stripped

---> then : file /lib/ld-linux.so.2
/lib/ld-linux.so.2: symbolic link to /lib32/ld-linux.so.2

--> then : file /lib32/ld-linux.so.2
/lib32/ld-linux.so.2: symbolic link to ld-2.31.so

BUT on th target x86 (Debian 10.9)
--> file /lib32/ld-linux.so.2
/lib32/ld-linux.so.2: symbolic link to ld-2.28.so

Host (ld-2.31.so) and target (ld-2.28.so) are different!


3) So I wondered if my compilation on host and scp to target had an issue...
I decided to compile the xenomai library directly on debian... and ... it seems to work !
That was quite a strange error hard to spot 😄

I will keep you informed if there is other issues on this topic, but I think it will be fine.

Thank you !



________________________________
De : Philippe Gerum <rpm@xenomai.org>
Envoyé : samedi 5 juin 2021 15:15
À : MONTET Julien <julien.montet@reseau.eseo.fr>
Cc : xenomai@xenomai.org <xenomai@xenomai.org>
Objet : Re: Xenomai ipipe x86 64 bits with 32 bits librairies


MONTET Julien via Xenomai <xenomai@xenomai.org> writes:

> Hello everyone,
>
> To keep you informed of my progress to run a 32bits program on x86 with Xenomai:
> -> I tried to build 32bits Xenomai library for a 64bits system built with a Cobalt version
> --> It doesn't work and stopped my exec or sudo /usr/xenomai/bin/latency with the error below
> --> 0"000.000| BUG in low_init(): [main] Cobalt core not enabled in kernel
>

You may want to double-check in the kernel log whether the core is
actually enabled. Early init errors might prevent this.

With dmesg, check that you do have an output of this sort:

[    0.098064] [Xenomai] scheduling class idle registered.
[    0.098074] [Xenomai] scheduling class rt registered.
[    0.098258] I-pipe: head domain Xenomai registered.
[    0.100609] [Xenomai] Cobalt v3.1

Any error encountered while initializing the Cobalt core would disable
it entirely for the whole session, hence receiving the low_init() error.

> -> I tried to build 64 bits Xenomai library for 64bits system built with Cobalt version
> --> The code doesn't build because it is waiting for 32bits library (alchemy, ...)
>
> There is still an other possibility I have in mind, but I don't know if it could work properly.
> During the kernel compilation I used "menuconfig" and noticed a line named "Binary Emulations". Inside it I found :
> [*] IA32 Emulation
> < > IA32 a.out support
> [ ] x32 ABI for 64-bit mode
>
> I am tempted to select "IA32 a.out support" and "x32 ABI for 64-bit mode" as well.
> Do these options have an impact on Xenomai or are they only used in a general case ?
>

All you need is CONFIG_IA32_EMULATION=y to enable 32bit user
compatibility mode over the x86_64 kernel.

--
Philippe.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-05 14:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-02 22:15 Xenomai ipipe x86 64 bits with 32 bits librairies MONTET Julien
2021-06-05 11:53 ` MONTET Julien
2021-06-05 13:15   ` Philippe Gerum
2021-06-05 14:25     ` MONTET Julien

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.