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: Wed, 16 Jul 2008 12:25:40 +0200	[thread overview]
Message-ID: <487DCCA4.60509@domain.hid> (raw)
In-Reply-To: <487C42CB.5080405@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 2495 bytes --]

Hi,

your patch didnt work. The bind_calls are now blocking infinite (at least much too long, still waiting...)
To compile i had to change following line in your patch:
-	if (timeout != TM_NONBLOCK && timeout != TM_INFINITE)
+	if (timeout != XN_NONBLOCK && timeout != XN_INFINITE)

I will use following patch for the moment, this works.

--- xenomai/nucleus/registry.c.old	2008-07-15 00:36:10.000000000 +0200
+++ xenomai/nucleus/registry.c	2008-07-15 15:28:23.000000000 +0200
@@ -733,8 +733,10 @@ int xnregistry_bind(const char *key, xnt
  		if (timeout != XN_INFINITE) {
  			xnticks_t now = xntbase_get_time(tbase);

-			if (stime + timeout >= now)
-				break;
+			if (stime + timeout <= now) {
+				err = -ETIMEDOUT;
+				goto unlock_and_exit;
+			}		

  			timeout -= (now - stime);
  			stime = now;


Philippe Gerum schrieb:
> Stefan Kisdaroczi wrote:
>> Hi Philippe,
>>
>> the attached patch fixed the problem for me.
> 
> Good spot. Now it's official, since four years that feature exists or so, nobody
> actually used registry timeouts... Oh, well...
> 
>> However, i think that in the "break case" still EACCES is returned.
>> Can the break be replaced with a "return ETIMEDOUT" ?
>>
> 
> Yes, normally we should do that along with your patch. Actually, the most
> appropriate fix would be to use an absolute timeout value internally, since the
> nucleus allows it.
> 
> --- ksrc/nucleus/registry.c	(revision 4044)
> +++ ksrc/nucleus/registry.c	(working copy)
> @@ -711,7 +711,6 @@
>  	xnobject_t *object;
>  	xnthread_t *thread;
>  	xntbase_t *tbase;
> -	xnticks_t stime;
>  	int err = 0;
>  	spl_t s;
> 
> @@ -723,7 +722,8 @@
> 
>  	xnlock_get_irqsave(&nklock, s);
> 
> -	stime = xntbase_get_time(tbase);
> +	if (timeout != TM_NONBLOCK && timeout != TM_INFINITE)
> +		timeout += xntbase_get_time(tbase);
> 
>  	for (;;) {
>  		object = registry_hash_find(key);
> @@ -738,18 +738,8 @@
>  			goto unlock_and_exit;
>  		}
> 
> -		if (timeout != XN_INFINITE) {
> -			xnticks_t now = xntbase_get_time(tbase);
> -
> -			if (stime + timeout >= now)
> -				break;
> -
> -			timeout -= (now - stime);
> -			stime = now;
> -		}
> -
>  		thread->registry.waitkey = key;
> -		xnsynch_sleep_on(&registry_hash_synch, timeout, XN_RELATIVE);
> +		xnsynch_sleep_on(&registry_hash_synch, timeout, XN_ABSOLUTE);
> 
>  		if (xnthread_test_info(thread, XNTIMEO)) {
>  			err = -ETIMEDOUT;
>  --
> Philippe.
> 
> 



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

  reply	other threads:[~2008-07-16 10:25 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
2008-07-15  6:25         ` Philippe Gerum
2008-07-16 10:25           ` Stefan Kisdaroczi [this message]
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=487DCCA4.60509@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.