All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Kisdaroczi <kisda@domain.hid>
To: rpm@xenomai.org
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] rt_task_bind() and timeout values
Date: Tue, 15 Jul 2008 02:38:09 +0200	[thread overview]
Message-ID: <487BF171.2090902@domain.hid> (raw)
In-Reply-To: <487BB89B.6010604@domain.hid>


[-- Attachment #1.1: Type: text/plain, Size: 2631 bytes --]

Hi Philippe,

the attached patch fixed the problem for me.
However, i think that in the "break case" still EACCES is returned.
Can the break be replaced with a "return ETIMEDOUT" ?

kisda

Philippe Gerum schrieb:
> Stefan Kisdaroczi wrote:
>> Hi Philippe,
>>
>> Philippe Gerum schrieb:
>>> Stefan Kisdaroczi wrote:
>>>> Hi all,
>>>>
>>>> If I call rt_task_bind() with a timeout value other than TM_NONBLOCK or
>>>> TM_INFINITE
>>>> it works not as expected (by me).
>>>>
>>>> System: Debian Lenny with Xenomai 2.4.3 and Kernel 2.6.24.
>>>>
>>>> The attached example calls 3 times rt_task_bind() for a nonexistent
>>>> task:
>>>>
>>>> 1. dont wait: rt_task_bind(&task,"SomeTaskName",TM_NONBLOCK)
>>>>   -> returns -11 (EWOULDBLOCK) -> OK
>>>>
>>>> 2. wait 5 secs: rt_task_bind(&task,"SomeTaskName",5000000000LL);
>>>>   -> returns immediately -13 (EACCES) without waiting -> ?
>>>>   -> I expected ETIMEDOUT after 5 seconds
>>>>
>>> "SomeTaskName" was found in the registry, but suddenly disappeared
>>> while in the
>>> process of returning its handle (we do post-validation after binding).
>>> That task
>>> has probably exited prematurely.
>> There was and is no task with this name. This happens on a freshly
>> rebooted box
>> with any name i choose. Can someone please try my small example from the
>> first
>> mail on his box. Thank you.
>>
> 
> Can't test right now, unfortunately, and I'll be travelling tomorrow.
> 
> I suspect some weird issue with xnregistry_bind(). Please make sure to disable
> CONFIG_XENO_OPT_NATIVE_REGISTRY, and apply this trivial trace point. The only
> reason to get EACCES would be to receive a success code from xnregistry_bind(),
> which we should not. I'd be interested to know the result codes for each call
> your snippet does. TIA,
> 
> --- ksrc/nucleus/registry.c	(revision 4044)
> +++ ksrc/nucleus/registry.c	(working copy)
> @@ -776,6 +776,8 @@
> 
>  	xnlock_put_irqrestore(&nklock, s);
> 
> +	printk(KERN_INFO "%s: ret=%d\n", __FUNCTION__, err);
> +
>  	return err;
>  }
> 
> 
>>>> 3. wait forever: rt_task_bind(&task,"SomeTaskName",TM_INFINITE);
>>>>   -> blocks a expected -> OK
>>>>
>>>> I have the same problem with rt_queue_bind() calls.
>>>>
>>>> Do i expect something wrong?
>>>>
>>>> Thanks for your help!
>>>>
>>>> kisda
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> Xenomai-help mailing list
>>>> Xenomai-help@domain.hid
>>>> https://mail.gna.org/listinfo/xenomai-help
>>>
>>
> 
> 


[-- Attachment #1.2: xenomai-bind-timeout.patch --]
[-- Type: text/plain, Size: 398 bytes --]

--- xenomai/nucleus/registry.c.old	2008-07-15 00:36:10.000000000 +0200
+++ xenomai/nucleus/registry.c	2008-07-15 01:51:13.000000000 +0200
@@ -733,7 +733,7 @@ int xnregistry_bind(const char *key, xnt
 		if (timeout != XN_INFINITE) {
 			xnticks_t now = xntbase_get_time(tbase);
 
-			if (stime + timeout >= now)
+			if (stime + timeout <= now)
 				break;
 
 			timeout -= (now - stime);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2008-07-15  0:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14 17:22 [Xenomai-help] rt_task_bind() and timeout values Stefan Kisdaroczi
2008-07-14 17:50 ` Philippe Gerum
2008-07-14 19:03   ` Stefan Kisdaroczi
2008-07-14 20:35     ` Philippe Gerum
2008-07-15  0:38       ` Stefan Kisdaroczi [this message]
2008-07-15  6:25         ` Philippe Gerum
2008-07-16 10:25           ` Stefan Kisdaroczi
2008-07-16 21:17             ` Philippe Gerum
2008-07-17 11:01               ` Stefan Kisdaroczi
2008-07-17 21:58                 ` Philippe Gerum
2008-07-15 14:28         ` Stefan Kisdaroczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=487BF171.2090902@domain.hid \
    --to=kisda@domain.hid \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.