* [Xenomai-help] Re : sqrt() function in xenomai kernel module
@ 2007-08-29 9:02 Mathieu JOINIE-MAURIN
2007-08-29 9:16 ` Jan Kiszka
2007-08-29 9:25 ` Herman Bruyninckx
0 siblings, 2 replies; 10+ messages in thread
From: Mathieu JOINIE-MAURIN @ 2007-08-29 9:02 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]
The application I used is a small controller for robot developped by people in the lab. Before it used to be in RTAI. But now they are trying to use Xenomai. The application is splitted in two parts:
the user side which saves data, manages interfaces and the kernel module which realise all the real time tisk (sampling, writing to electronic card, controler).
The communications between the two is made by 5 pipes (command, parameters, acknowledgment, save, status).
This is why i need to make my sqrt() function (of double variables) into my kernel modul part.
Mathieu
----- Message d'origine ----
De : Jan Kiszka <jan.kiszka@domain.hid>
À : Mathieu JOINIE-MAURIN <mjoiniem@domain.hid>
Cc : xenomai@xenomai.org le : Mercredi, 29 Août 2007, 10h43mn 16s
Objet : Re: [Xenomai-help] sqrt() function in xenomai kernel module
Mathieu JOINIE-MAURIN wrote:
> Hi,
>
> I need to use a sqrt() function in a kernel module code. I am a beginner with Xenomai. Is there any math_module which already exists ?
Counter question: Why do you need to use math in kernel code? It is
generally a sign something is not well split-up between kernel-based
driver code and user-space RT applications.
To answer your question: No, Xenomai does not come with a kernel math
lib because there is not much use for it - generally. Porting the app to
user-space is recommended.
Jan
_____________________________________________________________________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
[-- Attachment #2: Type: text/html, Size: 2020 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Xenomai-help] Re : sqrt() function in xenomai kernel module
2007-08-29 9:02 [Xenomai-help] Re : sqrt() function in xenomai kernel module Mathieu JOINIE-MAURIN
@ 2007-08-29 9:16 ` Jan Kiszka
2007-08-29 9:32 ` Gilles Chanteperdrix
2007-08-29 9:25 ` Herman Bruyninckx
1 sibling, 1 reply; 10+ messages in thread
From: Jan Kiszka @ 2007-08-29 9:16 UTC (permalink / raw)
To: Mathieu JOINIE-MAURIN; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1322 bytes --]
Mathieu JOINIE-MAURIN wrote:
> The application I used is a small controller for robot developped by people in the lab. Before it used to be in RTAI. But now they are trying to use Xenomai. The application is splitted in two parts:
> the user side which saves data, manages interfaces and the kernel module which realise all the real time tisk (sampling, writing to electronic card, controler).
> The communications between the two is made by 5 pipes (command, parameters, acknowledgment, save, status).
>
> This is why i need to make my sqrt() function (of double variables) into my kernel modul part.
Given that this is also a "small" application, I bet it will be far
easier for you to port it to user-space (POSIX or native skin) than
porting a math lib into kernel space. You could even continue to use
pipes (with Linux devices on the non-RT side) for communication to keep
the porting effort low. Hardware access can also remain part of the
application if you prefer (use iopl() & friends), though a clean
separation into generic driver and application is recommended for the
long-term.
Kernel space RT _applications_ really belong to an outdated design
pattern (due to missing libraries, GPL requirements, debuggability with
gdb, etc.). Take the chance and improve your application!
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-help] Re : sqrt() function in xenomai kernel module
2007-08-29 9:16 ` Jan Kiszka
@ 2007-08-29 9:32 ` Gilles Chanteperdrix
2007-08-29 13:20 ` Gilles Chanteperdrix
0 siblings, 1 reply; 10+ messages in thread
From: Gilles Chanteperdrix @ 2007-08-29 9:32 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
On 8/29/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> Mathieu JOINIE-MAURIN wrote:
> > The application I used is a small controller for robot developped by people in the lab. Before it used to be in RTAI. But now they are trying to use Xenomai. The application is splitted in two parts:
> > the user side which saves data, manages interfaces and the kernel module which realise all the real time tisk (sampling, writing to electronic card, controler).
> > The communications between the two is made by 5 pipes (command, parameters, acknowledgment, save, status).
> >
> > This is why i need to make my sqrt() function (of double variables) into my kernel modul part.
>
> Given that this is also a "small" application, I bet it will be far
> easier for you to port it to user-space (POSIX or native skin) than
> porting a math lib into kernel space.
Compiling a libm in kernel-space is not hard at all, especially since
a libm does not use any system call. But Mathieu could even do a
simpler thing: if the only math function used is sqrt, he could simply
add an implementation of this function into his kernel module.
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Xenomai-help] Re : sqrt() function in xenomai kernel module
2007-08-29 9:32 ` Gilles Chanteperdrix
@ 2007-08-29 13:20 ` Gilles Chanteperdrix
2007-08-29 13:47 ` Paul
0 siblings, 1 reply; 10+ messages in thread
From: Gilles Chanteperdrix @ 2007-08-29 13:20 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
On 8/29/07, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
> On 8/29/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> > Mathieu JOINIE-MAURIN wrote:
> > > The application I used is a small controller for robot developped by people in the lab. Before it used to be in RTAI. But now they are trying to use Xenomai. The application is splitted in two parts:
> > > the user side which saves data, manages interfaces and the kernel module which realise all the real time tisk (sampling, writing to electronic card, controler).
> > > The communications between the two is made by 5 pipes (command, parameters, acknowledgment, save, status).
> > >
> > > This is why i need to make my sqrt() function (of double variables) into my kernel modul part.
> >
> > Given that this is also a "small" application, I bet it will be far
> > easier for you to port it to user-space (POSIX or native skin) than
> > porting a math lib into kernel space.
>
> Compiling a libm in kernel-space is not hard at all, especially since
> a libm does not use any system call. But Mathieu could even do a
> simpler thing: if the only math function used is sqrt, he could simply
> add an implementation of this function into his kernel module.
Actually the rtai_math module seems to have no external dependency.
So, you can use it freely with Xenomai. If you want to port it a bit
more cleanly to xenomai, all you have to do is replacing libm_errno
with *xnthread_get_errno_location() (defined in nucleus/thread.h).
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Xenomai-help] Re : sqrt() function in xenomai kernel module
2007-08-29 13:20 ` Gilles Chanteperdrix
@ 2007-08-29 13:47 ` Paul
2007-08-29 14:14 ` Jan Kiszka
0 siblings, 1 reply; 10+ messages in thread
From: Paul @ 2007-08-29 13:47 UTC (permalink / raw)
To: xenomai
On Wednesday 29 August 2007 14:20, Gilles Chanteperdrix wrote:
> On 8/29/07, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
> > On 8/29/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> > > Mathieu JOINIE-MAURIN wrote:
> > > > The application I used is a small controller for robot developped by
> > > > people in the lab. Before it used to be in RTAI. But now they are
> > > > trying to use Xenomai. The application is splitted in two parts: the
> > > > user side which saves data, manages interfaces and the kernel module
> > > > which realise all the real time tisk (sampling, writing to electronic
> > > > card, controler). The communications between the two is made by 5
> > > > pipes (command, parameters, acknowledgment, save, status).
> > > >
> > > > This is why i need to make my sqrt() function (of double variables)
> > > > into my kernel modul part.
> > >
> > > Given that this is also a "small" application, I bet it will be far
> > > easier for you to port it to user-space (POSIX or native skin) than
> > > porting a math lib into kernel space.
> >
> > Compiling a libm in kernel-space is not hard at all, especially since
> > a libm does not use any system call. But Mathieu could even do a
> > simpler thing: if the only math function used is sqrt, he could simply
> > add an implementation of this function into his kernel module.
>
> Actually the rtai_math module seems to have no external dependency.
> So, you can use it freely with Xenomai. If you want to port it a bit
> more cleanly to xenomai, all you have to do is replacing libm_errno
> with *xnthread_get_errno_location() (defined in nucleus/thread.h).
Running the x86_64 build here, I found a GCC flag (-mno-sse IIRC) being used
by the kernel make that prevents any floating point instructions from being
used. So a port/cleanup of rtai_math would most likely only work for i386 &
ppc architectures..
Regards, Paul.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-help] Re : sqrt() function in xenomai kernel module
2007-08-29 13:47 ` Paul
@ 2007-08-29 14:14 ` Jan Kiszka
2007-08-29 14:53 ` Gilles Chanteperdrix
0 siblings, 1 reply; 10+ messages in thread
From: Jan Kiszka @ 2007-08-29 14:14 UTC (permalink / raw)
To: Paul; +Cc: Xenomai
[-- Attachment #1: Type: text/plain, Size: 2405 bytes --]
Paul wrote:
> On Wednesday 29 August 2007 14:20, Gilles Chanteperdrix wrote:
>> On 8/29/07, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
>>> On 8/29/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
>>>> Mathieu JOINIE-MAURIN wrote:
>>>>> The application I used is a small controller for robot developped by
>>>>> people in the lab. Before it used to be in RTAI. But now they are
>>>>> trying to use Xenomai. The application is splitted in two parts: the
>>>>> user side which saves data, manages interfaces and the kernel module
>>>>> which realise all the real time tisk (sampling, writing to electronic
>>>>> card, controler). The communications between the two is made by 5
>>>>> pipes (command, parameters, acknowledgment, save, status).
>>>>>
>>>>> This is why i need to make my sqrt() function (of double variables)
>>>>> into my kernel modul part.
>>>> Given that this is also a "small" application, I bet it will be far
>>>> easier for you to port it to user-space (POSIX or native skin) than
>>>> porting a math lib into kernel space.
>>> Compiling a libm in kernel-space is not hard at all, especially since
>>> a libm does not use any system call. But Mathieu could even do a
>>> simpler thing: if the only math function used is sqrt, he could simply
>>> add an implementation of this function into his kernel module.
>> Actually the rtai_math module seems to have no external dependency.
>> So, you can use it freely with Xenomai. If you want to port it a bit
>> more cleanly to xenomai, all you have to do is replacing libm_errno
>> with *xnthread_get_errno_location() (defined in nucleus/thread.h).
>
> Running the x86_64 build here, I found a GCC flag (-mno-sse IIRC) being used
> by the kernel make that prevents any floating point instructions from being
> used. So a port/cleanup of rtai_math would most likely only work for i386 &
> ppc architectures..
>
And that rtai_math stuff is arch-independent, i.e. the slower your CPU
is, the less efficient that code gets. Back in the old days when we used
RTAI kernel space modules (LXRT was unstable), we had to hack our own
i386 math lib with inline assembly for accelerated hw support, thus
acceptable performance.
Kernel-space math remains a dead end, just the point where it ends may
vary. We should really encourage people to port away from it whenever
possible.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-help] Re : sqrt() function in xenomai kernel module
2007-08-29 14:14 ` Jan Kiszka
@ 2007-08-29 14:53 ` Gilles Chanteperdrix
2007-08-29 15:35 ` Philippe Gerum
0 siblings, 1 reply; 10+ messages in thread
From: Gilles Chanteperdrix @ 2007-08-29 14:53 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Xenomai
On 8/29/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> Paul wrote:
> > On Wednesday 29 August 2007 14:20, Gilles Chanteperdrix wrote:
> >> On 8/29/07, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
> >>> On 8/29/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> >>>> Mathieu JOINIE-MAURIN wrote:
> >>>>> The application I used is a small controller for robot developped by
> >>>>> people in the lab. Before it used to be in RTAI. But now they are
> >>>>> trying to use Xenomai. The application is splitted in two parts: the
> >>>>> user side which saves data, manages interfaces and the kernel module
> >>>>> which realise all the real time tisk (sampling, writing to electronic
> >>>>> card, controler). The communications between the two is made by 5
> >>>>> pipes (command, parameters, acknowledgment, save, status).
> >>>>>
> >>>>> This is why i need to make my sqrt() function (of double variables)
> >>>>> into my kernel modul part.
> >>>> Given that this is also a "small" application, I bet it will be far
> >>>> easier for you to port it to user-space (POSIX or native skin) than
> >>>> porting a math lib into kernel space.
> >>> Compiling a libm in kernel-space is not hard at all, especially since
> >>> a libm does not use any system call. But Mathieu could even do a
> >>> simpler thing: if the only math function used is sqrt, he could simply
> >>> add an implementation of this function into his kernel module.
> >> Actually the rtai_math module seems to have no external dependency.
> >> So, you can use it freely with Xenomai. If you want to port it a bit
> >> more cleanly to xenomai, all you have to do is replacing libm_errno
> >> with *xnthread_get_errno_location() (defined in nucleus/thread.h).
> >
> > Running the x86_64 build here, I found a GCC flag (-mno-sse IIRC) being used
> > by the kernel make that prevents any floating point instructions from being
> > used. So a port/cleanup of rtai_math would most likely only work for i386 &
> > ppc architectures..
> >
>
> And that rtai_math stuff is arch-independent, i.e. the slower your CPU
> is, the less efficient that code gets. Back in the old days when we used
> RTAI kernel space modules (LXRT was unstable), we had to hack our own
> i386 math lib with inline assembly for accelerated hw support, thus
> acceptable performance.
>
> Kernel-space math remains a dead end, just the point where it ends may
> vary. We should really encourage people to port away from it whenever
> possible.
Still, I think that having some libm support in kernel-space may help
people when porting their applications to Xenomai.
Of course, if the rtai_math module suffers from some quality issues,
we should not start from it.
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Xenomai-help] Re : sqrt() function in xenomai kernel module
2007-08-29 14:53 ` Gilles Chanteperdrix
@ 2007-08-29 15:35 ` Philippe Gerum
0 siblings, 0 replies; 10+ messages in thread
From: Philippe Gerum @ 2007-08-29 15:35 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: Xenomai, Jan Kiszka
On Wed, 2007-08-29 at 16:53 +0200, Gilles Chanteperdrix wrote:
> On 8/29/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> > Paul wrote:
> > > On Wednesday 29 August 2007 14:20, Gilles Chanteperdrix wrote:
> > >> On 8/29/07, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> wrote:
> > >>> On 8/29/07, Jan Kiszka <jan.kiszka@domain.hid> wrote:
> > >>>> Mathieu JOINIE-MAURIN wrote:
> > >>>>> The application I used is a small controller for robot developped by
> > >>>>> people in the lab. Before it used to be in RTAI. But now they are
> > >>>>> trying to use Xenomai. The application is splitted in two parts: the
> > >>>>> user side which saves data, manages interfaces and the kernel module
> > >>>>> which realise all the real time tisk (sampling, writing to electronic
> > >>>>> card, controler). The communications between the two is made by 5
> > >>>>> pipes (command, parameters, acknowledgment, save, status).
> > >>>>>
> > >>>>> This is why i need to make my sqrt() function (of double variables)
> > >>>>> into my kernel modul part.
> > >>>> Given that this is also a "small" application, I bet it will be far
> > >>>> easier for you to port it to user-space (POSIX or native skin) than
> > >>>> porting a math lib into kernel space.
> > >>> Compiling a libm in kernel-space is not hard at all, especially since
> > >>> a libm does not use any system call. But Mathieu could even do a
> > >>> simpler thing: if the only math function used is sqrt, he could simply
> > >>> add an implementation of this function into his kernel module.
> > >> Actually the rtai_math module seems to have no external dependency.
> > >> So, you can use it freely with Xenomai. If you want to port it a bit
> > >> more cleanly to xenomai, all you have to do is replacing libm_errno
> > >> with *xnthread_get_errno_location() (defined in nucleus/thread.h).
> > >
> > > Running the x86_64 build here, I found a GCC flag (-mno-sse IIRC) being used
> > > by the kernel make that prevents any floating point instructions from being
> > > used. So a port/cleanup of rtai_math would most likely only work for i386 &
> > > ppc architectures..
> > >
> >
> > And that rtai_math stuff is arch-independent, i.e. the slower your CPU
> > is, the less efficient that code gets. Back in the old days when we used
> > RTAI kernel space modules (LXRT was unstable), we had to hack our own
> > i386 math lib with inline assembly for accelerated hw support, thus
> > acceptable performance.
> >
> > Kernel-space math remains a dead end, just the point where it ends may
> > vary. We should really encourage people to port away from it whenever
> > possible.
>
> Still, I think that having some libm support in kernel-space may help
> people when porting their applications to Xenomai.
>
> Of course, if the rtai_math module suffers from some quality issues,
> we should not start from it.
>
FWIW, I will never ever merge an extended in-kernel math support for
Xenomai. It's ugly, it's a dead end, it's a loss of precious time, and
reminds me the way we used to work ten years ago, and I have zero
nostalgia for the Ice Age. We do have decent floating-point support in
user-space RT mode (you actually made it happen by contributing the
required code for most archs), so we should rather aim at a predictable
libm in user-space primary mode if it's not already the case.
And above all, FPU support has always been banned from Linux's kernel
space, I see no reason for introducing a libm there in order to be
compatible with ugly and deprecated use cases.
--
Philippe.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-help] Re : sqrt() function in xenomai kernel module
2007-08-29 9:02 [Xenomai-help] Re : sqrt() function in xenomai kernel module Mathieu JOINIE-MAURIN
2007-08-29 9:16 ` Jan Kiszka
@ 2007-08-29 9:25 ` Herman Bruyninckx
1 sibling, 0 replies; 10+ messages in thread
From: Herman Bruyninckx @ 2007-08-29 9:25 UTC (permalink / raw)
To: Mathieu JOINIE-MAURIN; +Cc: xenomai
On Wed, 29 Aug 2007, Mathieu JOINIE-MAURIN wrote:
> The application I used is a small controller for robot developped by
> people in the lab. Before it used to be in RTAI. But now they are trying
> to use Xenomai. The application is splitted in two parts:
> the user side which saves data, manages interfaces and the kernel module
> which realise all the real time tisk (sampling, writing to electronic card,
> controler). The communications between the two is made by 5 pipes (command,
> parameters, acknowledgment, save, status).
<shameless plug>
These aspects are all covered in our Orocos project
(<http://www.orocos.org>) in which everything runs in "user space" (if you
use the Xenomai or RTAI versions.
</shameless plug>
> This is why i need to make my sqrt() function (of double variables) into
> my kernel modul part.
I do agree very much with Jan that you should not be doing the application
logic in kernel space. There is really no need for that in 99,99% of the
applications.
Herman
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Xenomai-help] Re : sqrt() function in xenomai kernel module
@ 2007-08-29 16:10 Fillod Stephane
0 siblings, 0 replies; 10+ messages in thread
From: Fillod Stephane @ 2007-08-29 16:10 UTC (permalink / raw)
To: Xenomai
Gilles Chanteperdrix wrote:
[..]
>> Kernel-space math remains a dead end, just the point where it ends
may
>> vary. We should really encourage people to port away from it whenever
>> possible.
>
> Still, I think that having some libm support in kernel-space may help
> people when porting their applications to Xenomai.
IIRC, Mathieu's need for libm support in kernel-space was because its
(legacy) application was written for the RTAI API. Instead of providing
libm support in kernel-space (which sucks anyway performance-wise
compared
to a fixed point implementation), a user-space port of the RTAI skin
could enable easier porting of its application. That said, I would
strongly advocate for converting the use of the RTAI API to either
native
or Posix skin API.
--
Stephane
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-08-29 16:10 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-29 9:02 [Xenomai-help] Re : sqrt() function in xenomai kernel module Mathieu JOINIE-MAURIN
2007-08-29 9:16 ` Jan Kiszka
2007-08-29 9:32 ` Gilles Chanteperdrix
2007-08-29 13:20 ` Gilles Chanteperdrix
2007-08-29 13:47 ` Paul
2007-08-29 14:14 ` Jan Kiszka
2007-08-29 14:53 ` Gilles Chanteperdrix
2007-08-29 15:35 ` Philippe Gerum
2007-08-29 9:25 ` Herman Bruyninckx
-- strict thread matches above, loose matches on Subject: below --
2007-08-29 16:10 Fillod Stephane
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.