Hi Philippe,
Thanks for the patch! Unfortunately this does not resolve the 'stuck
in primary of prio 0 after rt_task_send'.
I'll attach the basic test application that reproduces it. All prints
should contain secondary mode because all tasks are prio 0 and the
auto-relax patches are compiled in.
The producer which does the rt_task_send() call does not auto-relax to
secondary mode.
Thanks,
Henri.
On Sun, May 1, 2011 at 5:01 PM, Philippe Gerum <[email protected]> wrote:
> On Mon, 2011-03-28 at 12:56 +0200, Henri Roosen wrote:
>> Hi,
>>
>> We are using the back-ported auto-relax patches of Xenomai-head on the
>> 2.5.6 release on Linux 2.6.32.15.
>>
>> We noticed that our prio-0 shadowed task is not always auto-relaxed
>> and traced it back to a problem with rt_task_send/receive/reply. The
>> rt_task_send/receive/reply mechanism uses the xnsynch primitive to
>> implement its PIP. However, this mechanism only acquires the xysynch
>> primitive without releasing it. This results in the resource counter
>> never be 0 anymore and thus breaking the auto-relaxed which is based
>> on this resource counter.
>>
>> I guess releasing the xnsynch resets the owner, which is not wanted either..
>> Any idea for a fix?
>
> Could you give a try at this one? TIA,
> http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=becb13774ab687d016857f6a972f4124fbd10c44
>
>>
>> Thanks,
>> Henri.
>>
>>
>> On Tue, Oct 12, 2010 at 9:16 AM, Henri Roosen <[email protected]> wrote:
>> > That was a problem with our build environment.
>> >
>> > Patches work and the base-prio 0 task nicely switches to the Linux
>> > domain and competes with the Linux threads for the processor. Now we
>> > don't loose TCP connection to our target anymore.
>> >
>> > Thanks!
>> >
>> > Henri
>> >
>> > On Mon, Oct 11, 2010 at 5:35 PM, Henri Roosen <[email protected]>
>> > wrote:
>> >> Thanks for the patches Philippe. I applied them to xenomai 2.5.5.
>> >> Tests with a basic application look good, however our bigger project
>> >> doesn't. I checked already if we release all mutexes; the base prio 0
>> >> thread thread released all of them but stays in primary domain after a
>> >> xenomai call.
>> >>
>> >> I'll setup a clean environment, just to be sure, and will investigate
>> >> further tomorrow.
>> >>
>> >> On Mon, Oct 11, 2010 at 11:31 AM, Andreas Glatz <[email protected]>
>> >> wrote:
>> >>>
>> >>>>
>> >>>> The auto-relax feature is now available from -head (upcoming
>> >>>> 2.6.x). You
>> >>>> will need all commits from
>> >>>> http://git.xenomai.org/?p=xenomai-
>> >>>> head.git;a=commit;h=b75cec19387e561f82ac55595db8c993b049f071
>> >>>> to
>> >>>> http://git.xenomai.org/?p=xenomai-
>> >>>> head.git;a=commit;h=6653a9e8eb7339b749989bd74adc3ac3bd29e4da
>> >>>>
>> >>>> --
>> >>>> Philippe.
>> >>>>
>> >>>>
>> >>>
>> >>> Very nice. Will try it out soon on my G4 PB Aluminium.
>> >>>
>> >>> Andreas
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> Xenomai-help mailing list
>> >>> [email protected]
>> >>> https://mail.gna.org/listinfo/xenomai-help
>> >>>
>> >>
>> >
>
> --
> Philippe.
>
>
>
#include <sys/mman.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <native/task.h>
#include <native/queue.h>
#include <asm-generic/xenomai/bits/current.h>
#define CONSUMER_TASK_PRI 0
#define CONSUMER_STACK_SIZE 8192
#define PRODUCER_TASK_PRI 0
#define PRODUCER_STACK_SIZE 8192
#define CONSUMER_WAIT 150
#define PRODUCER_TRIG 40
#define MAX_STRING_LEN 40
static const char *satch_s_tunes[] = {
"Surfing With The Alien",
"Lords of Karma",
"Banana Mango",
"Psycho Monkey",
"Luminous Flesh Giants",
"Moroccan Sunset",
"Satch Boogie",
"Flying In A Blue Dream",
"Ride",
"Summer Song",
"Speed Of Light",
"Crystal Planet",
"Raspberry Jam Delta-V",
"Champagne?",
"Clouds Race Across The Sky",
"Engines Of Creation"
};
static RT_TASK producer_task,
consumer_task;
void consumer(void *cookie)
{
char buf[MAX_STRING_LEN];
RT_TASK_MCB mcb;
int flowid;
int mode;
for (;;)
{
rt_task_sleep(CONSUMER_WAIT);
for (;;)
{
mcb.opcode = 0; /* Dummy. */
mcb.data = (caddr_t)buf;
mcb.size = sizeof(buf);
flowid = rt_task_receive(&mcb,TM_NONBLOCK);
mode = xeno_get_current_mode();
if (flowid < 0)
break;
printf("Now playing %s... in %s mode.\n",buf, (mode & XNRELAX) ? "secondary" : "primary");
rt_task_reply(flowid,NULL);
}
}
}
void producer(void *cookie)
{
int next_msg = 0;
RT_TASK_MCB mcb;
const char *msg;
int mode;
for (;;)
{
rt_task_sleep(PRODUCER_TRIG);
msg = satch_s_tunes[next_msg++];
next_msg %= (sizeof(satch_s_tunes) / sizeof(satch_s_tunes[0]));
mcb.opcode = 0; /* Dummy. */
mcb.data = (caddr_t)msg;
mcb.size = strlen(msg) + 1; /* \0 must be copied. */
rt_task_send(&consumer_task,&mcb,NULL,TM_INFINITE);
mode = xeno_get_current_mode();
printf("Producer mode %s\n", (mode & XNRELAX) ? "secondary" : "primary");
}
}
int main(void)
{
mlockall(MCL_CURRENT | MCL_FUTURE);
rt_timer_set_mode(1000000); /* Forc 1ms periodic tick. */
rt_task_spawn(&consumer_task,
"ConsumerTask",
CONSUMER_STACK_SIZE,
CONSUMER_TASK_PRI,
0,
&consumer,
NULL);
rt_task_spawn(&producer_task,
"ProducerTask",
PRODUCER_STACK_SIZE,
PRODUCER_TASK_PRI,
0,
&producer,
NULL);
while (1);
return 0;
}
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help