Skip to contentSkip to conversation

slackspot

Xenomai Lowell Gilbert 5 participants 18 messages Jun 16, 2016 – Aug 24, 2016

lore
Share & tools
lore
#0 lore raw

I have been unable to use slackspot, because /proc/xenomai/debug/relax is empty. I do have CONFIG_XENO_OPT_DEBUG_TRACE_RELAX enabled (without that enabled, I don't even have the file). I have not run /bin/relax, mentioned in the manual page, because I don't have such a program and can't find any reference to it.

I am using 3.0.2.

Thanks.

#1 lore raw
Quoted 3 lines · Lowell Gilbert

I have been unable to use slackspot, because /proc/xenomai/debug/relax is empty. I do have CONFIG_XENO_OPT_DEBUG_TRACE_RELAX enabled (without that enabled, I don't even have the file).

This is expected.

I have not run /bin/relax,

Quoted 4 lines

mentioned in the manual page, because I don't have such a program and can't find any reference to it.

I am using 3.0.2.

/bin/relax is only the name of a fake executable that would have produced the typical output described in the example, read /foo/bar if that helps.

Once TRACE_RELAX is enabled in the kernel, running any application that causes switches to secondary mode should populate /proc/xenomai/debug/relax with event records.

Signature · 1 line
Philippe.
#2 lore raw
Quoted 11 lines · Philippe Gerum
Quoted 5 lines · Lowell Gilbert

I have not run /bin/relax,
mentioned in the manual page, because I don't have such a program and can't find any reference to it.

I am using 3.0.2.

/bin/relax is only the name of a fake executable that would have produced the typical output described in the example, read /foo/bar if that helps.

That seems obvious now that you've explained it.

Maybe something like the following would help:
--- doc/asciidoc/man1/slackspot.adoc.~1~ 2016-02-18 07:17:40.000000000 -0500
+++ doc/asciidoc/man1/slackspot.adoc 2016-06-20 11:16:22.130252140
-0400
@@ -91,7 +91,7 @@

In the following scenario, the _target_ system built with the
CONFIG_XENO_OPT_DEBUG_TRACE_RELAX feature enabled in the kernel -configuration, just ran the _/bin/relax_ program. +configuration, just ran the Xenomai-enabled _/bin/relax_ program.

This program caused a transition to secondary mode switch of the
current task (_Task 2_) as a result of calling +putchar()+. The Cobalt

Quoted 3 lines

Once TRACE_RELAX is enabled in the kernel, running any application that causes switches to secondary mode should populate /proc/xenomai/debug/relax with event records.

Hmm. I'm still not getting the records, and the SIGXCPU method isn't giving me anything either. But the MSW, CSW, and XSC counts are all rising at exactly the rate that the thread wakes up.

Here's the design: I have a POSIX thread which calls into an RTDM ioctl which blocks on an RTDM event, then copies a couple of dozen bytes of data back to the POSIX thread. The POSIX thread does some calculations on the data, then uses another ioctl to write the results back to the hardware. And repeats.

Is it possible that the thread might be relaxing in the kernel (RTDM ioctl) and not receiving signals as as result?

I have two theories about what is happening.
1. I have made an error somewhere that is resulting in unnecessary relax events. In that case, getting the stack traces is the key to finding said error. I can create a small example if that helps me get assistance in looking at it.
2. Having a real-time pthread block in an RTDM ioctl may be an inherently bad idea. I notice that all synchronization primitives are characterized by "might-switch". Perhaps I should be using a device read to block the POSIX thread instead of doing it in an ioctl()?

My current plan is to use the I-pipe tracer, but if there is an easier way to move forward, I would appreciate advice to that effect.

Thank you very much.

- Lowell Gilbert

#3 lore raw
Quoted 59 lines · Lowell Gilbert
Quoted 11 lines · Philippe Gerum
Quoted 5 lines · Lowell Gilbert

I have not run /bin/relax,
mentioned in the manual page, because I don't have such a program and can't find any reference to it.

I am using 3.0.2.

/bin/relax is only the name of a fake executable that would have produced the typical output described in the example, read /foo/bar if that helps.

That seems obvious now that you've explained it.

Maybe something like the following would help:
--- doc/asciidoc/man1/slackspot.adoc.~1~ 2016-02-18 07:17:40.000000000 -0500
+++ doc/asciidoc/man1/slackspot.adoc 2016-06-20 11:16:22.130252140
-0400

(quoted diff) +0 -0
@@ -91,7 +91,7 @@
 
 In the following scenario, the _target_ system built with the
  CONFIG_XENO_OPT_DEBUG_TRACE_RELAX feature enabled in the kernel
  -configuration, just ran the _/bin/relax_ program.
  +configuration, just ran the Xenomai-enabled _/bin/relax_ program.
 
 This program caused a transition to secondary mode switch of the

current task (_Task 2_) as a result of calling +putchar()+. The Cobalt

Quoted 3 lines

Once TRACE_RELAX is enabled in the kernel, running any application that causes switches to secondary mode should populate /proc/xenomai/debug/relax with event records.

Hmm. I'm still not getting the records, and the SIGXCPU method isn't giving me anything either. But the MSW, CSW, and XSC counts are all rising at exactly the rate that the thread wakes up.

Here's the design: I have a POSIX thread which calls into an RTDM ioctl which blocks on an RTDM event, then copies a couple of dozen bytes of data back to the POSIX thread. The POSIX thread does some calculations on the data, then uses another ioctl to write the results back to the hardware. And repeats.

Is it possible that the thread might be relaxing in the kernel (RTDM ioctl) and not receiving signals as as result?

I have two theories about what is happening.
1. I have made an error somewhere that is resulting in unnecessary relax events. In that case, getting the stack traces is the key to finding said error. I can create a small example if that helps me get assistance in looking at it.
2. Having a real-time pthread block in an RTDM ioctl may be an inherently bad idea. I notice that all synchronization primitives are characterized by "might-switch". Perhaps I should be using a device read to block the POSIX thread instead of doing it in an ioctl()?

Quoted 2 lines

My current plan is to use the I-pipe tracer, but if there is an easier way to move forward, I would appreciate advice to that effect.

There is one possibility: if your thread runs with the SCHED_OTHER/SCHED_WEAK scheduling policy, I would not expect the relaxes to trigger anything, as you have been asking for them by choosing to use these policies.

Signature · 2 lines
					    Gilles.
https://click-hack.org
#4 lore raw
Quoted 4 lines · Gilles Chanteperdrix

There is one possibility: if your thread runs with the SCHED_OTHER/SCHED_WEAK scheduling policy, I would not expect the relaxes to trigger anything, as you have been asking for them by choosing to use these policies.

Yes, I should have mentioned that topic. I have run this under both SCHED_FIFO and SCHED_RR.

#5 lore raw
Quoted 9 lines · Lowell Gilbert
Quoted 4 lines · Gilles Chanteperdrix

There is one possibility: if your thread runs with the SCHED_OTHER/SCHED_WEAK scheduling policy, I would not expect the relaxes to trigger anything, as you have been asking for them by choosing to use these policies.

Yes, I should have mentioned that topic. I have run this under both SCHED_FIFO and SCHED_RR.

Ok. Could you post an example allowing us to reproduce the issue ?

Signature · 2 lines
					    Gilles.
https://click-hack.org
#6 lore raw
Quoted 2 lines · Gilles Chanteperdrix

Ok. Could you post an example allowing us to reproduce the issue ?

I would be happy to do so.

#7 lore raw
In reply to Gilles Chanteperdrix
Quoted 8 lines · Gilles Chanteperdrix
Quoted 7 lines · Lowell Gilbert
Quoted 4 lines · Gilles Chanteperdrix

There is one possibility: if your thread runs with the SCHED_OTHER/SCHED_WEAK scheduling policy, I would not expect the relaxes to trigger anything, as you have been asking for them by choosing to use these policies.

Quoted 4 lines
Quoted 2 lines

Yes, I should have mentioned that topic. I have run this under both SCHED_FIFO and SCHED_RR.

Ok. Could you post an example allowing us to reproduce the issue ?

I can. It took me a little longer than I figured because I had accidentally deleted the MODULE_LICENSE. Is it possible to get the kernel makefiles to tell you *why* it isn't linking in libraries you asked for?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.tar
Type: archive/tar
Size: 10240 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20160621/eb21f260/attachment.bin>
-------------- next part --------------
I'm attaching a tar file, but in case this list strips attachments, it's also at
http://be-well.ilk.org/~lowell/example.tar
It's about a hundred lines each for the application and kernel module.

Thank you.

#8 lore raw
Quoted 4 lines · Lowell Gilbert

I'm attaching a tar file, but in case this list strips attachments, it's also at
http://be-well.ilk.org/~lowell/example.tar
It's about a hundred lines each for the application and kernel module.

I have updated the tarball with a missing header file.

This time, I *tested* the tarball.
I apologize for the oversight.

Be well.

#9 lore raw
Quoted 7 lines · Lowell Gilbert
Quoted 4 lines · Lowell Gilbert

I'm attaching a tar file, but in case this list strips attachments, it's also at
http://be-well.ilk.org/~lowell/example.tar
It's about a hundred lines each for the application and kernel module.

Quoted 5 lines

I have updated the tarball with a missing header file.

This time, I *tested* the tarball.
I apologize for the oversight.

No problem, we are doing this all the time. Actually Xenomai is most likely a massive collection of oversights that tend to be working well together.

You app is missing a call to pthread_setmode_np() for enabling the warn-upon-switch bit,
e.g. calling pthread_set_mode_np(0, PTHREAD_WARNSW, NULL) would enable tracing for the calling thread.

http://www.xenomai.org/documentation/xenomai-3/html/xeno3prm/group__cobalt__api__thread.html#gae3b7df7f77c04253ed19fb6346f0f9b2

Signature · 1 line
Philippe.
#10 lore raw
Quoted 4 lines · Philippe Gerum

You app is missing a call to pthread_setmode_np() for enabling the warn-upon-switch bit,
e.g. calling pthread_set_mode_np(0, PTHREAD_WARNSW, NULL) would enable tracing for the calling thread.

My real application has that. My example stripped out everything I could live without, including lots of error-checking for errors that generally don't come up.

I did actually test setting PTHREAD_WARNSW in the example program, and there was no data to be read from /proc/xenomai/debug/relax.

Be well.

#11 lore raw
In reply to Lowell Gilbert
Quoted 10 lines · Lowell Gilbert
Quoted 1 line · Gilles Chanteperdrix

Ok. Could you post an example allowing us to reproduce the issue ?

I can. It took me a little longer than I figured because I had accidentally deleted the MODULE_LICENSE. Is it possible to get the kernel makefiles to tell you *why* it isn't linking in libraries you asked for?

http://be-well.ilk.org/~lowell/example.tar
It's about a hundred lines each for the application and kernel module.

Has anyone tried this out? My real application is meeting its latency requirements, but I'm pretty sure it's having more of an impact on the rest of the system than it needs to do.

Be well.

#12 lore raw
Quoted 10 lines · Lowell Gilbert
Quoted 7 lines · Lowell Gilbert
Quoted 1 line · Gilles Chanteperdrix

Ok. Could you post an example allowing us to reproduce the issue ?

I can. It took me a little longer than I figured because I had accidentally deleted the MODULE_LICENSE. Is it possible to get the kernel makefiles to tell you *why* it isn't linking in libraries you asked for?

Quoted 6 lines
Quoted 2 lines

http://be-well.ilk.org/~lowell/example.tar
It's about a hundred lines each for the application and kernel module.

Has anyone tried this out? My real application is meeting its latency requirements, but I'm pretty sure it's having more of an impact on the rest of the system than it needs to do.

I've tried changing the event to a semaphore, and changing the "read" ioctl to a device read, and I'm still seeing huge numbers of state switches.

#13 lore raw
Quoted 15 lines
Quoted 13 lines · Lowell Gilbert
Quoted 10 lines · Lowell Gilbert
Quoted 1 line · Gilles Chanteperdrix

Ok. Could you post an example allowing us to reproduce the issue ?

I can. It took me a little longer than I figured because I had accidentally deleted the MODULE_LICENSE. Is it possible to get the kernel makefiles to tell you *why* it isn't linking in libraries you asked for?

http://be-well.ilk.org/~lowell/example.tar
It's about a hundred lines each for the application and kernel module.

Quoted 6 lines
Quoted 3 lines

Has anyone tried this out? My real application is meeting its latency requirements, but I'm pretty sure it's having more of an impact on the rest of the system than it needs to do.

I've tried changing the event to a semaphore, and changing the "read" ioctl to a device read, and I'm still seeing huge numbers of state switches.

Hi Lowell,

Did you ever figure out how to get slackspot working? I'm experiencing the same issue - debug/relax is empty but the MSW counter is regularly incrementing for my Xenomai application. Using 3.0.2 on ARM. Enabled XENO_.._TRACE_RELAX in the kernel and set PTHREAD_WARNSW on the task. Any help appreciated.

Thanks,
--George

#14 lore raw

Hi,

Had the same issue (ARMv7/Cobalt/3.0.2), did not find any solution, fail back to debugging using the SIGDEBUG signaling catching.

Best Regards,
Alex Plits.

-----Original Message-----
From: Xenomai [mailto:[email protected]] On Behalf Of George Broz
Sent: יום ג 23 אוגוסט 2016 04:35
To: Lowell Gilbert <[email protected]>
Cc: [email protected]
Subject: Re: [Xenomai] slackspot

Quoted 15 lines
Quoted 13 lines · Lowell Gilbert
Quoted 10 lines · Lowell Gilbert
Quoted 1 line · Gilles Chanteperdrix

Ok. Could you post an example allowing us to reproduce the issue ?

I can. It took me a little longer than I figured because I had accidentally deleted the MODULE_LICENSE. Is it possible to get the kernel makefiles to tell you *why* it isn't linking in libraries you asked for?

http://be-well.ilk.org/~lowell/example.tar
It's about a hundred lines each for the application and kernel module.

Quoted 6 lines
Quoted 3 lines

Has anyone tried this out? My real application is meeting its latency requirements, but I'm pretty sure it's having more of an impact on the rest of the system than it needs to do.

I've tried changing the event to a semaphore, and changing the "read" ioctl to a device read, and I'm still seeing huge numbers of state switches.

Hi Lowell,

Did you ever figure out how to get slackspot working? I'm experiencing the same issue - debug/relax is empty but the MSW counter is regularly incrementing for my Xenomai application. Using 3.0.2 on ARM. Enabled XENO_.._TRACE_RELAX in the kernel and set PTHREAD_WARNSW on the task. Any help appreciated.

Thanks,
--George

_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai

#15 lore raw
Quoted 8 lines · Alex Plits

Hi,

Had the same issue (ARMv7/Cobalt/3.0.2), did not find any solution, fail back to debugging using the SIGDEBUG signaling catching.

Best Regards,
Alex Plits.

-----Original Message-----

Thanks.

Has anyone out there successfully run slackspot on ARM? After a day of trying with a very simple single task example, I'm giving up.

Regarding SIGDEBUG - I started with the code from here:

https://xenomai.org/2014/06/finding-spurious-relaxes/

but found I had to change signal(sig, SIG_DFL); to signal(sig, SIG_IGN); to prevent the application from exiting on the first instance
of a (non-lethal) secondary transition (and using sigdebug_reason(si) to return the correct code). With SIG_IGN, the application does not terminate, but the SIGDEBUG handler is not invoked for subsequent secondary transition events (as indicated by the MSW counter).

Is there a trick to catching multiple SIGDEBUG events on the same task?

Thanks in advance,
--George

#16 lore raw
Quoted 27 lines · George Broz
Quoted 8 lines · Alex Plits

Hi,

Had the same issue (ARMv7/Cobalt/3.0.2), did not find any solution, fail back to debugging using the SIGDEBUG signaling catching.

Best Regards,
Alex Plits.

-----Original Message-----

Thanks.

Has anyone out there successfully run slackspot on ARM? After a day of trying with a very simple single task example, I'm giving up.

Regarding SIGDEBUG - I started with the code from here:

https://xenomai.org/2014/06/finding-spurious-relaxes/

but found I had to change signal(sig, SIG_DFL); to signal(sig, SIG_IGN); to prevent the application from exiting on the first instance
of a (non-lethal) secondary transition (and using sigdebug_reason(si) to return the correct code). With SIG_IGN, the application does not terminate, but the SIGDEBUG handler is not invoked for subsequent secondary transition events (as indicated by the MSW counter).

Quoted 3 lines

Is there a trick to catching multiple SIGDEBUG events on the same task?

Yes, just don't change the re-trap the signal in the handler, leave it as is. testsuite/latency.c illustrates this, we trap SIGDEBUG to SIG_DFL only when the -b option was given (stop_upon_switch), to make sure the default action will be taken when we resend it for exiting.

Signature · 1 line
Philippe.
#17 lore raw
Quoted 28 lines · Philippe Gerum
Quoted 27 lines · George Broz
Quoted 8 lines · Alex Plits

Hi,

Had the same issue (ARMv7/Cobalt/3.0.2), did not find any solution, fail back to debugging using the SIGDEBUG signaling catching.

Best Regards,
Alex Plits.

-----Original Message-----

Thanks.

Has anyone out there successfully run slackspot on ARM? After a day of trying with a very simple single task example, I'm giving up.

Regarding SIGDEBUG - I started with the code from here:

https://xenomai.org/2014/06/finding-spurious-relaxes/

but found I had to change signal(sig, SIG_DFL); to signal(sig, SIG_IGN); to prevent the application from exiting on the first instance
of a (non-lethal) secondary transition (and using sigdebug_reason(si) to return the correct code). With SIG_IGN, the application does not terminate, but the SIGDEBUG handler is not invoked for subsequent secondary transition events (as indicated by the MSW counter).

Quoted 5 lines
Quoted 3 lines

Is there a trick to catching multiple SIGDEBUG events on the same task?

Yes, just don't change the re-trap the signal in the handler, leave it

Wow, ok, please read: just don't re-trap the signal in the handler.

Signature · 1 line
Philippe.