All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [5/9] Define new syscalls for the posix skin
Date: Fri, 25 Apr 2008 09:59:28 +0200	[thread overview]
Message-ID: <48118F60.4080005@domain.hid> (raw)
In-Reply-To: <18448.10221.879356.57696@domain.hid>

Gilles Chanteperdrix wrote:
> This patch defines the new syscalls get_heap_addr (more on this syscall later),
> and get_thread_cb. The get_thread_cb syscall is used in user-space to associate
> the thread xnthread_t pointer with each user-space xenomai thread, using POSIX
> TSD.
> 
> This is needed for the mutex implementation to allow setting the mutex owner.
> 
> However, two things: 
> - I do not know if you should like that much passing kernel-space pointers to
>   user-space;

We already did that in a few occasions. Let's consider this as an opaque handle
since those values belong to a different address space.

> - this is implemented as a posix skin service, but should probably be defined as
>   a core syscall, and called in all skin implementations, so as to allow threads
>   from other skins to user Xenomai posix skin services.
> 

Since you are doing the initial effort and designing the interface, please move
this to the nucleus directly. If the first implementation only goes through the
POSIX skin, it will likely lower the incentive for other skins to use that
feature, since the amount of work to integrate it will be higher.

> ---
>  include/posix/syscall.h  |    3 +++
>  src/skins/posix/thread.c |   11 +++++++++++
>  2 files changed, 14 insertions(+)
> 
> Index: include/posix/syscall.h
> ===================================================================
> --- include/posix/syscall.h	(revision 3718)
> +++ include/posix/syscall.h	(working copy)
> @@ -46,6 +46,7 @@
>  #define __pse51_mutex_lock            20
>  #define __pse51_mutex_timedlock       21
>  #define __pse51_mutex_trylock         22
> +#define __pse51_check_init            __pse51_mutex_trylock
>  #define __pse51_mutex_unlock          23
>  #define __pse51_cond_init             24
>  #define __pse51_cond_destroy          25
> @@ -101,6 +102,8 @@
>  #define __pse51_thread_getschedparam  75
>  #define __pse51_thread_kill           76
>  #define __pse51_select                77
> +#define __pse51_get_heap_addr         78
> +#define __pse51_get_thread_cb	      79
>  
>  #ifdef __KERNEL__
>  
> Index: src/skins/posix/thread.c
> ===================================================================
> --- src/skins/posix/thread.c	(revision 3718)
> +++ src/skins/posix/thread.c	(working copy)
> @@ -26,6 +26,7 @@
>  #include <posix/syscall.h>
>  
>  extern int __pse51_muxid;
> +extern pthread_key_t pse51_cur_key;
>  
>  static pthread_attr_t default_attr;
>  static int linuxthreads;
> @@ -41,6 +42,13 @@ static void __pthread_sigharden_handler(
>  	XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_XENO_DOMAIN);
>  }
>  
> +static void set_kthread_cb(void)
> +{
> +	void *kthread_cb;
> +	XENOMAI_SKINCALL1(__pse51_muxid, __pse51_get_thread_cb, &kthread_cb);
> +	pthread_setspecific(pse51_cur_key, kthread_cb);
> +}
> +
>  int __wrap_pthread_setschedparam(pthread_t thread,
>  				 int policy, const struct sched_param *param)
>  {
> @@ -56,6 +64,7 @@ int __wrap_pthread_setschedparam(pthread
>  
>  	if (!err && promoted) {
>  		old_sigharden_handler = signal(SIGHARDEN, &__pthread_sigharden_handler);
> +		set_kthread_cb();
>  		if (policy != SCHED_OTHER)
>  			XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_XENO_DOMAIN);
>  	}
> @@ -132,6 +141,8 @@ static void *__pthread_trampoline(void *
>  	start = iargs->start;
>  	cookie = iargs->arg;
>  
> +	set_kthread_cb();
> +
>  	__real_sem_post(&iargs->sync);
>  
>  	if (!err) {
> 
> 


-- 
Philippe.


  parent reply	other threads:[~2008-04-25  7:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24  6:16 [Xenomai-core] [0/9] Posix skin user-space mutexes Gilles Chanteperdrix
2008-04-24  6:20 ` [Xenomai-core] [1/9] Support for non cached memory mappings Gilles Chanteperdrix
2008-04-24  6:21   ` [Xenomai-core] [2/9] Define XNARCH_SHARED_HEAP_FLAGS Gilles Chanteperdrix
2008-04-24  6:22     ` [Xenomai-core] [3/9] Define more atomic operations in user-space Gilles Chanteperdrix
2008-04-24  6:24       ` [Xenomai-core] [4/9] Define ARM " Gilles Chanteperdrix
2008-04-24  6:25         ` [Xenomai-core] [5/9] Define new syscalls for the posix skin Gilles Chanteperdrix
2008-04-24  6:27           ` [Xenomai-core] [6/9] Rework posix skin shared heaps support, add per-process shared heap Gilles Chanteperdrix
2008-04-24  6:30             ` [Xenomai-core] [7/9] Poor man's object control block read-write lock Gilles Chanteperdrix
2008-04-24  6:32               ` [Xenomai-core] [8/9] Re-implementation of mutexes, kernel-space support Gilles Chanteperdrix
2008-04-24  6:33                 ` [Xenomai-core] [9/9] Re-implementation of mutex, user-space support Gilles Chanteperdrix
2008-04-25  8:03             ` [Xenomai-core] [6/9] Rework posix skin shared heaps support, add per-process shared heap Philippe Gerum
2008-04-25  7:59           ` Philippe Gerum [this message]
2008-04-25  7:51         ` [Xenomai-core] [4/9] Define ARM atomic operations in user-space Philippe Gerum
2008-04-25  7:48       ` [Xenomai-core] [3/9] Define more " Philippe Gerum
2008-04-25 13:26         ` Gilles Chanteperdrix
2008-04-25 13:42           ` Philippe Gerum
2008-04-25 13:50             ` Gilles Chanteperdrix
2008-04-25 14:01               ` Philippe Gerum
2008-04-25 14:13                 ` Gilles Chanteperdrix
2008-04-25 14:20                   ` Philippe Gerum
2008-04-25 22:09                     ` Gilles Chanteperdrix
2008-04-26  7:02                       ` Philippe Gerum
2008-04-24  7:09 ` [Xenomai-core] [0/9] Posix skin user-space mutexes Jan Kiszka
2008-04-24  7:37   ` Gilles Chanteperdrix
2008-04-24  8:23     ` 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=48118F60.4080005@domain.hid \
    --to=rpm@xenomai.org \
    --cc=gilles.chanteperdrix@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.