Skip to contentSkip to conversation

Xenomai VxWorks Skin--->semTake

Xenomai-help Sambasiva Rao Manchili 3 participants 12 messages Aug 3, 2011 – Aug 5, 2011

lore
Share & tools
lore
#0 lore raw

Hallo ,
Most of code containing semTake with (WAIT_FOREVER ) ported from VxWorks to Linux using Xenomai is working, but only the following semTake is always failing.

For Example:-
semTake( restab_access_smp, 1200).

Semaphore created successfully and exists. Any reason and any hint?

Semaphore created without ERROR as follows.
if ((restab_access_smp = semMCreate (SEM_Q_PRIORITY | SEM_DELETE_SAFE

           | SEM_INVERSION_SAFE)) == NULL)

{
ERROR
}

Thanks,
Samba.

Sambasiva Rao Manchili
Software Development Engineer
________________________________

NEXUS TELECOM AG
Network and Service Investigation Feldbachstrasse 80
8634 Hombrechtikon
Switzerland

Direct/mobile: +41 78 750 6808
Main: +41 44 355 6611
Email: [email protected] <mailto:[email protected]>
Website: www.nexustelecom.com<http://www.nexustelecom.com/>

[cid:[email protected]]

________________________________
This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

#1 lore raw
Quoted 4 lines · Sambasiva Rao Manchili

Hallo ,
Most of code containing semTake with (WAIT_FOREVER ) ported from VxWorks to Linux using Xenomai is working, but only the following semTake is always failing.

Your description is a bit terse. Failing how? Hangs, returns immediately? Crashes your board? If not, any error code reported by the skin?

And rehashing a previous question which was not answered IIRC: what CPU/platform are you running on, beside "linux 2.6.37" which does not help enough? What Xenomai version?

Please make sure to send any relevant information that may help reproducing the issue, this tends to convince people to actually have a look at it.

Quoted 48 lines

For Example:-
semTake( restab_access_smp, 1200).

Semaphore created successfully and exists.
Any reason and any hint?

Semaphore created without ERROR as follows.
if ((restab_access_smp = semMCreate (SEM_Q_PRIORITY | SEM_DELETE_SAFE

           | SEM_INVERSION_SAFE)) == NULL)

{
ERROR
}

Thanks,
Samba.

Sambasiva Rao Manchili
Software Development Engineer
________________________________

NEXUS TELECOM AG
Network and Service Investigation

Feldbachstrasse 80
8634 Hombrechtikon
Switzerland

Direct/mobile: +41 78 750 6808
Main: +41 44 355 6611
Email: [email protected]
Website: www.nexustelecom.com

______________________________________________________________________
This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.
#2 lore raw

Hi Philppe,
Failed and return with error code is <Unknown error 4294967295> and continues. I do not know the granularity of time here, if it is returning immediately or not.
We have about 15 tasks spawned in this whole system. Done very very minimal changes to our VxWorks code to run on Linux over Xenomai version 2.5.6. Board does not crash.
CPU Platform is Intel x86 Arch 32 Bit.

Thank you for support.

Samba.
-----Original Message-----
From: Philippe Gerum [mailto:[email protected]]
Sent: Wednesday, 03. August, 2011 13:27
To: Sambasiva Rao Manchili
Cc: [email protected]; Antonio Gambin
Subject: Re: [Xenomai-help] Xenomai VxWorks Skin--->semTake

Quoted 4 lines · Sambasiva Rao Manchili

Hallo ,
Most of code containing semTake with (WAIT_FOREVER ) ported from VxWorks to Linux using Xenomai is working, but only the following semTake is always failing.

Your description is a bit terse. Failing how? Hangs, returns immediately? Crashes your board? If not, any error code reported by the skin?

And rehashing a previous question which was not answered IIRC: what CPU/platform are you running on, beside "linux 2.6.37" which does not help enough? What Xenomai version?

Please make sure to send any relevant information that may help reproducing the issue, this tends to convince people to actually have a look at it.

Quoted 37 lines

For Example:-
semTake( restab_access_smp, 1200).

Semaphore created successfully and exists.
Any reason and any hint?

Semaphore created without ERROR as follows.
if ((restab_access_smp = semMCreate (SEM_Q_PRIORITY | SEM_DELETE_SAFE

           | SEM_INVERSION_SAFE)) == NULL) {

ERROR
}

Thanks,
Samba.

Sambasiva Rao Manchili
Software Development Engineer
________________________________

NEXUS TELECOM AG
Network and Service Investigation

Feldbachstrasse 80
8634 Hombrechtikon
Switzerland

Direct/mobile: +41 78 750 6808
Main: +41 44 355 6611
Email: [email protected]
Website: www.nexustelecom.com

Quoted 10 lines

______________________________________________________________________
This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

--
Philippe.

This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

#3 lore raw
Quoted 4 lines · Sambasiva Rao Manchili

Hi Philppe,
Failed and return with error code is <Unknown error 4294967295> and continues. I do not know the granularity of time here, if it is returning immediately or not.
We have about 15 tasks spawned in this whole system. Done very very minimal changes to our VxWorks code to run on Linux over Xenomai version 2.5.6. Board does not crash.
CPU Platform is Intel x86 Arch 32 Bit.

semTake does not return error code directly, it returns ERROR (which is -1, or 4294967295 if you cast to unsigned), and the real error is in the errno variable.

Signature · 1 line
					    Gilles.
#4 lore raw

Hi Gilles,
I had seen the code in src\skins\vxworks\semLib.c it returns ERROR which is -1.

The value that I sent earlier is the value that I got out of the following statement. serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s>",
strerror(errnoGet()));

Is it right ?

Now again I tried with
serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s> <%d>",
strerror(errnoGet()), errno);

Here I get value 1 for errno.

Samba.
-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Wednesday, 03. August, 2011 15:18
To: Sambasiva Rao Manchili
Cc: Philippe Gerum; Antonio Gambin; [email protected]
Subject: Re: [Xenomai-help] Xenomai VxWorks Skin--->semTake

Quoted 4 lines · Sambasiva Rao Manchili

Hi Philppe,
Failed and return with error code is <Unknown error 4294967295> and continues. I do not know the granularity of time here, if it is returning immediately or not.
We have about 15 tasks spawned in this whole system. Done very very minimal changes to our VxWorks code to run on Linux over Xenomai version 2.5.6. Board does not crash.
CPU Platform is Intel x86 Arch 32 Bit.

semTake does not return error code directly, it returns ERROR (which is -1, or 4294967295 if you cast to unsigned), and the real error is in the errno variable.

--
Gilles.

This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

#5 lore raw
Quoted 11 lines · Sambasiva Rao Manchili

Hi Gilles,
I had seen the code in src\skins\vxworks\semLib.c it returns ERROR which is -1.

The value that I sent earlier is the value that I got out of the following statement. serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s>",
strerror(errnoGet()));

Is it right ?

Quoted 6 lines

Now again I tried with
serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s> <%d>",
strerror(errnoGet()), errno);

Here I get value 1 for errno.

You are trying to grab the mutex from a non-Xenomai thread context. This is invalid.

Quoted 23 lines

Samba.
-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Wednesday, 03. August, 2011 15:18
To: Sambasiva Rao Manchili
Cc: Philippe Gerum; Antonio Gambin; [email protected]
Subject: Re: [Xenomai-help] Xenomai VxWorks Skin--->semTake

Quoted 4 lines · Sambasiva Rao Manchili

Hi Philppe,
Failed and return with error code is <Unknown error 4294967295> and continues. I do not know the granularity of time here, if it is returning immediately or not.
We have about 15 tasks spawned in this whole system. Done very very minimal changes to our VxWorks code to run on Linux over Xenomai version 2.5.6. Board does not crash.
CPU Platform is Intel x86 Arch 32 Bit.

semTake does not return error code directly, it returns ERROR (which is -1, or 4294967295 if you cast to unsigned), and the real error is in the errno variable.

--
Gilles.

This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

Signature · 1 line
Philippe.
#6 lore raw

Hi Philippe,
Why do you say that I try to grab the mutex from non-xenomai thread context ?
During porting we had written main() only this main function does pthread_create to call the very first function of VxWorks code which inturn does taskSpawn. All the taskSpawns has to go through Xenomai thread context right ?

Samba.

-----Original Message-----
From: Philippe Gerum [mailto:[email protected]]
Sent: Wednesday, 03. August, 2011 15:53
To: Sambasiva Rao Manchili
Cc: Gilles Chanteperdrix; Antonio Gambin; [email protected]
Subject: RE: [Xenomai-help] Xenomai VxWorks Skin--->semTake

Quoted 11 lines · Sambasiva Rao Manchili

Hi Gilles,
I had seen the code in src\skins\vxworks\semLib.c it returns ERROR which is -1.

The value that I sent earlier is the value that I got out of the following statement. serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s>",
strerror(errnoGet()));

Is it right ?

Quoted 6 lines

Now again I tried with
serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s> <%d>",
strerror(errnoGet()), errno);

Here I get value 1 for errno.

You are trying to grab the mutex from a non-Xenomai thread context. This is invalid.

Quoted 15 lines

Samba.
-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Wednesday, 03. August, 2011 15:18
To: Sambasiva Rao Manchili
Cc: Philippe Gerum; Antonio Gambin; [email protected]
Subject: Re: [Xenomai-help] Xenomai VxWorks Skin--->semTake

Quoted 4 lines · Sambasiva Rao Manchili

Hi Philppe,
Failed and return with error code is <Unknown error 4294967295> and continues. I do not know the granularity of time here, if it is returning immediately or not.
We have about 15 tasks spawned in this whole system. Done very very minimal changes to our VxWorks code to run on Linux over Xenomai version 2.5.6. Board does not crash.
CPU Platform is Intel x86 Arch 32 Bit.

Quoted 8 lines

semTake does not return error code directly, it returns ERROR (which is -1, or 4294967295 if you cast to unsigned), and the real error is in the errno variable.

--
Gilles.

This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

--
Philippe.

________________________________
This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

#7 lore raw
Quoted 3 lines · Sambasiva Rao Manchili

Hi Philippe,
Why do you say that I try to grab the mutex from non-xenomai thread context ?

Because this is what you are very likely doing. Calling a Xenomai-only service over a non-Xenomai thread.

Quoted 4 lines

During porting we had written main() only this main function does pthread_create to call the very first function of VxWorks code which inturn does taskSpawn. All the taskSpawns has to go through Xenomai thread context right ?

Task created by taskSpawn() are valid Xenomai context for sure. main() is not by default.

I can't check your code, but EPERM is typical of calling a resource grabbing service out of a valid Xenomai context. Xenomai can't move your calling context to primary mode before executing this service and fails early with EPERM.

Quoted 85 lines

Samba.

-----Original Message-----
From: Philippe Gerum [mailto:[email protected]]
Sent: Wednesday, 03. August, 2011 15:53
To: Sambasiva Rao Manchili
Cc: Gilles Chanteperdrix; Antonio Gambin; [email protected]
Subject: RE: [Xenomai-help] Xenomai VxWorks Skin--->semTake

Quoted 2 lines · Sambasiva Rao Manchili

Hi Gilles,
I had seen the code in src\skins\vxworks\semLib.c it returns ERROR

which is -1.

Quoted 2 lines

The value that I sent earlier is the value that I got out of the

following statement.

Quoted 2 lines

serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp

failed!!<%s>",

Quoted 8 lines
              strerror(errnoGet()));

Is it right ?

Now again I tried with
serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp

failed!!<%s> <%d>",

Quoted 3 lines
              strerror(errnoGet()), errno);

Here I get value 1 for errno.

You are trying to grab the mutex from a non-Xenomai thread context. This is invalid.

Quoted 9 lines

Samba.
-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Wednesday, 03. August, 2011 15:18
To: Sambasiva Rao Manchili
Cc: Philippe Gerum; Antonio Gambin; [email protected]
Subject: Re: [Xenomai-help] Xenomai VxWorks Skin--->semTake

Quoted 3 lines
Quoted 2 lines · Sambasiva Rao Manchili

Hi Philppe,
Failed and return with error code is <Unknown error 4294967295>

and continues. I do not know the granularity of time here, if it is returning immediately or not.

Quoted 1 line
Quoted 1 line

We have about 15 tasks spawned in this whole system. Done very

very minimal changes to our VxWorks code to run on Linux over Xenomai
version 2.5.6. Board does not crash.

Quoted 3 lines
Quoted 1 line

CPU Platform is Intel x86 Arch 32 Bit.

semTake does not return error code directly, it returns ERROR (which

is -1, or 4294967295 if you cast to unsigned), and the real error is in the errno variable.

Quoted 6 lines

--
Gilles.

This email and any attachment may contain confidential information

which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

Quoted 1 line

--
Philippe.

________________________________
This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

Signature · 1 line
Philippe.
#8 lore raw
In reply to Sambasiva Rao Manchili
Quoted 9 lines · Sambasiva Rao Manchili

Hi Gilles,
I had seen the code in src\skins\vxworks\semLib.c it returns ERROR which is -1.

The value that I sent earlier is the value that I got out of the following statement. serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s>",
strerror(errnoGet()));

Is it right ?

You want printErrno instead of strerror.

Quoted 8 lines

Now again I tried with
serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s> <%d>",
strerror(errnoGet()), errno);

Here I get value 1 for errno.

1 is EPERM. Is the thread issuing the call a thread created by Xenomai?

Signature · 1 line
					    Gilles.
#9 lore raw

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Wednesday, 03. August, 2011 16:03
To: Sambasiva Rao Manchili
Cc: Philippe Gerum; Antonio Gambin; [email protected]
Subject: Re: [Xenomai-help] Xenomai VxWorks Skin--->semTake

Quoted 9 lines · Sambasiva Rao Manchili

Hi Gilles,
I had seen the code in src\skins\vxworks\semLib.c it returns ERROR which is -1.

The value that I sent earlier is the value that I got out of the following statement. serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s>",
strerror(errnoGet()));

Is it right ?

You want printErrno instead of strerror.

Quoted 7 lines
Quoted 4 lines

Samba:
In the beginning days of our code porting from VxWorks to Linux, Xenomai failed to create message Queue that was working on VxWorks.
When xenomai failed to create message queue it returned 0x110001===>1114113. After reading the Xenomai code a bit I understood it is S_memLib_NOT_ENOUGH_MEMORY.
I therefore reduced the Queue size by 5 times and it was then successful. The way I extracted the errno in beginning days is same as I did today. So I epxected a value which >>tells the actual reason of semTake failure. But I got this huge value which is -1. Am I missing something ?

Quoted 6 lines

Now again I tried with
serrLog( serrErr,
"resu_getonline_1_svc: semTake for restab_access_smp failed!!<%s> <%d>",
strerror(errnoGet()), errno);

Here I get value 1 for errno.

1 is EPERM. Is the thread issuing the call a thread created by Xenomai?

Quoted 2 lines
Quoted 2 lines

Samba: Yes. I guess taskSpawn leads finally to Xenomai libraries to create thread. All our VxWorks code(with minor changes) as it is running on top of Xenomai. Please tell me, What will you suggest me then ?

--
Gilles.

This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.

#10 lore raw
Quoted 13 lines · Sambasiva Rao Manchili

You want printErrno instead of strerror.

Quoted 10 lines
Quoted 10 lines

Samba: In the beginning days of our code porting from VxWorks to Linux, Xenomai failed to create message Queue that was working on VxWorks. When xenomai failed to create message queue it returned 0x110001===>1114113. After reading the Xenomai code a bit I understood it is S_memLib_NOT_ENOUGH_MEMORY. I therefore reduced the Queue size by 5 times and it was then successful. The way I extracted the errno in beginning days is same as I did today. So I epxected a value which >>tells the actual reason of semTake failure. But I got this huge value which is -1. Am I missing something ?

The thing is printErrno is a xenomai posix skin function which knows S_memlib_NOT_ENOUGH_MEMORY, strerror is an unrelated glibc function, and does not.

What you are missing is this comment in ksrc/skins/vxworks/syscall.c /*
* By convention, error codes are passed back through the syscall
* return value:
* - negative codes stand for internal (i.e. nucleus) errors;
* - strictly positive values stand for genuine VxWorks errors.
* - zero means success.
*

Looking at the code, I think after a service returns an error, it may be more reliable to use errno than to use errnoOfTaskGet.

Quoted 7 lines

1 is EPERM. Is the thread issuing the call a thread created by Xenomai?

Quoted 4 lines
Quoted 4 lines

Samba: Yes. I guess taskSpawn leads finally to Xenomai libraries to create thread. All our VxWorks code(with minor changes) as it is running on top of Xenomai. Please tell me, What will you suggest me then ?

Trace the kernel code to know the reason for semTake to return -EPERM. Another reason documented in txt/vxworks/skin.txt maybe that you are calling semTake in a region where the scheduler has been locked (using taskLock).

NOTE: it would be nice if you could formats your mails as everybody
does: quote the mail you reply to by prepending " >" to the beginning of the lines you are quoting, and do not put ">" characters in front of the lines you add.

Signature · 1 line
					    Gilles.
#11 lore raw

Hi Gilles,
Thank you for hint. Apparently hint (direction that I may have to look) on error that I receive -EPREM seems to be promising. To give a try I just removed all taskLock but still no luck yet.
I am trying...

I have taken your NOTE.
Thank you.
Samba.

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Wednesday, 03. August, 2011 17:19
To: Sambasiva Rao Manchili
Cc: Philippe Gerum; Antonio Gambin; [email protected]
Subject: Re: [Xenomai-help] Xenomai VxWorks Skin--->semTake

Quoted 13 lines · Sambasiva Rao Manchili

You want printErrno instead of strerror.

Quoted 10 lines
Quoted 10 lines

Samba: In the beginning days of our code porting from VxWorks to Linux, Xenomai failed to create message Queue that was working on VxWorks. When xenomai failed to create message queue it returned 0x110001===>1114113. After reading the Xenomai code a bit I understood it is S_memLib_NOT_ENOUGH_MEMORY. I therefore reduced the Queue size by 5 times and it was then successful.
The way I extracted the errno in beginning days is same as I did today. So I epxected a value which >>tells the actual reason of semTake failure. But I got this huge value which is -1. Am I missing something ?

The thing is printErrno is a xenomai posix skin function which knows S_memlib_NOT_ENOUGH_MEMORY, strerror is an unrelated glibc function, and does not.

What you are missing is this comment in ksrc/skins/vxworks/syscall.c /*
* By convention, error codes are passed back through the syscall
* return value:
* - negative codes stand for internal (i.e. nucleus) errors;
* - strictly positive values stand for genuine VxWorks errors.
* - zero means success.
*

Looking at the code, I think after a service returns an error, it may be more reliable to use errno than to use errnoOfTaskGet.

Quoted 7 lines

1 is EPERM. Is the thread issuing the call a thread created by Xenomai?

Quoted 4 lines
Quoted 4 lines

Samba: Yes. I guess taskSpawn leads finally to Xenomai libraries to create thread. All our VxWorks code(with minor changes) as it is running on top of Xenomai. Please tell me, What will you suggest me then ?

Trace the kernel code to know the reason for semTake to return -EPERM.
Another reason documented in txt/vxworks/skin.txt maybe that you are calling semTake in a region where the scheduler has been locked (using taskLock).

NOTE: it would be nice if you could formats your mails as everybody
does: quote the mail you reply to by prepending " >" to the beginning of the lines you are quoting, and do not put ">" characters in front of the lines you add.

--
Gilles.

This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.