All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [Xenomai-git] common: do not let u_mode exceptional cases leak out of current.[ch]
Date: Mon, 08 Mar 2010 18:00:03 +0100	[thread overview]
Message-ID: <4B952D13.3080306@domain.hid> (raw)
In-Reply-To: <4B9527FD.3040806@domain.hid>

Jan Kiszka wrote:
> xenomai-git-request@domain.hid wrote:
>> diff --git a/include/asm-generic/bits/current.h b/include/asm-generic/bits/current.h
>> index f0e569c..b9ac680 100644
>> --- a/include/asm-generic/bits/current.h
>> +++ b/include/asm-generic/bits/current.h
> 
> ...
> 
>> @@ -33,25 +33,16 @@ static inline xnhandle_t xeno_get_current(void)
>>  {
>>  	void *val = pthread_getspecific(xeno_current_key);
>>  
>> -	if (!val)
>> -		return XN_NO_HANDLE;
>> -
>> -	return (xnhandle_t)val;
>> +	return (xnhandle_t)val ?: xeno_slow_get_current();
>>  }
> 
> So when used with normal Linux threads, this will always trigger the
> syscall of xeno_slow_get_current()?
> 
>> diff --git a/src/rtdk/assert_context.c b/src/rtdk/assert_context.c
>> index bad19f3..f67bcd8 100644
>> --- a/src/rtdk/assert_context.c
>> +++ b/src/rtdk/assert_context.c
>> @@ -30,12 +30,9 @@ void assert_nrt(void)
>>  	xnthread_info_t info;
>>  	int err;
>>  
>> -	if (xeno_get_current() != XN_NO_HANDLE)
>> -		return;
>> +	if (unlikely(xeno_get_current() != XN_NO_HANDLE &&
>> +		     !(xeno_get_current_mode() & XNRELAX))) {
> 
> Then please provide a different API for assert_nrt as this makes the
> service too heavy for common use.

It is a non real-time thread. Its performances are not critical. A
non-blocking syscall is not that heavy. Especially compared to the
execution time of malloc. Ok, will not argue on this any more, as
obviously our opinions differ in that area.

The point is that NULL (XN_NO_HANDLE) means at the same time a freed
mode and a mode after the TSD cleanup was run. So, emitting a syscall in
that case is the simplest thing we can do. And no, I did not find it
expensive. But in fact, using an additional syscall, assert_nrt could be
implemented as a simple dummy syscall which returns 0 and asks the
caller to be put in primary mode (and it would be even lighter). So, I
guess if you did not implemented that way, it means that you already
wanted to avoid the syscall.

-- 
					    Gilles.


  reply	other threads:[~2010-03-08 17:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.4538.1268063562.8399.xenomai-git@xenomai.org>
2010-03-08 16:38 ` [Xenomai-core] [Xenomai-git] common: do not let u_mode exceptional cases leak out of current.[ch] Jan Kiszka
2010-03-08 17:00   ` Gilles Chanteperdrix [this message]
2010-03-08 17:08     ` Jan Kiszka
2010-03-08 17:14       ` Jan Kiszka
2010-03-08 17:17         ` Gilles Chanteperdrix
2010-03-08 17:53           ` Gilles Chanteperdrix
2010-03-09 13:41             ` Gilles Chanteperdrix
2010-03-09 14:20         ` Gilles Chanteperdrix
2010-03-09 14:49           ` Jan Kiszka
2010-03-09 15:16             ` Gilles Chanteperdrix
2010-03-08 16:50 ` [Xenomai-core] [Xenomai-git] common: modify leak warning Jan Kiszka
2010-03-08 17:01   ` Gilles Chanteperdrix

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=4B952D13.3080306@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=jan.kiszka@domain.hid \
    --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.