All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Sambasiva Rao Manchili <sambasiva.manchili@domain.hid>
Cc: "Xenomai-help@domain.hid" <Xenomai-help@domain.hid>
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?
Date: Thu, 01 Sep 2011 22:35:31 +0200	[thread overview]
Message-ID: <1314909331.18201.35.camel@domain.hid> (raw)
In-Reply-To: <1314908857.18201.28.camel@domain.hid>

On Thu, 2011-09-01 at 22:27 +0200, Philippe Gerum wrote:
> On Thu, 2011-09-01 at 17:25 +0200, Sambasiva Rao Manchili wrote:
> > Hi,
> > It is reduced piece which explains the problem.
> > If it is much more then I will see what I can do.
> 
> User-space needs this, or something alike (not tested, not even
> compiled actually):

Keep in mind that the following hack bypasses the safe lock mechanism
totally, a complete and sane fix would need a bit more thought, and
maybe an ABI breakage. Normally we should not throw pthread_cancel() at
a task denying deletion from within a taskSafe() section, unless we pair
this with proper cancellation deferral.

> 
> diff --git a/src/skins/vxworks/taskLib.c b/src/skins/vxworks/taskLib.c
> index f751788..70f33aa 100644
> --- a/src/skins/vxworks/taskLib.c
> +++ b/src/skins/vxworks/taskLib.c
> @@ -267,10 +267,34 @@ STATUS taskDeleteForce(TASK_ID task_id)
>  
>  STATUS taskDelete(TASK_ID task_id)
>  {
> +	TASK_DESC desc;
> +	pthread_t tid;
>  	int err;
>  
> -	err =
> -	    XENOMAI_SKINCALL1(__vxworks_muxid, __vxworks_task_delete, task_id);
> +	err = XENOMAI_SKINCALL2(__vxworks_muxid,
> +				__vxworks_taskinfo_get, task_id, &desc);
> +	if (err) {
> +		errno = abs(err);
> +		return ERROR;
> +	}
> +
> +	tid = (pthread_t)desc->td_opaque;
> +	if (tid == pthread_self()) {
> +		/* Silently migrate to avoid raising SIGXCPU. */
> +		XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_LINUX_DOMAIN);
> +		pthread_exit(NULL);
> +	}
> +
> +	if (tid) {
> +		err = pthread_cancel(tid);
> +		if (err)
> +			return -err;
> +	}
> +
> +	err = XENOMAI_SKINCALL1(__vxworks_muxid, __vxworks_task_delete, task_id);
> +	if (err == S_objLib_OBJ_ID_ERROR)
> +		return OK; /* Used to be valid, but has exited. */
> +
>  	if (err) {
>  		errno = abs(err);
>  		return ERROR;
> 
> > Samba.
> > 
> > -----Original Message-----
> > From: Gilles Chanteperdrix [mailto:gilles.chanteperdrix@xenomai.org]
> > Sent: Thursday, 01. September, 2011 17:08
> > To: Sambasiva Rao Manchili
> > Cc: Xenomai-help@domain.hid
> > Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?
> > 
> > On 09/01/2011 04:51 PM, Sambasiva Rao Manchili wrote:
> > >  Hi,
> > > The reason that I have not given this piece of code was because it is not written by me oflate but  was code that exists since several years which is running on VxWorks  on  different versions.
> > > I just ported this with very very minimal effort to Linux over Xenomai.
> > >
> > 
> > I do not ask you to send your code, I ask you to send a reduced, self-contained test case, which demonstrates the issue you have, for reasons explained on the page I directed you to.
> > 
> > --
> >                                             Gilles.
> > 
> > 
> > This email and any attachment may contain confidential information which is intended for use only by the addressee(s) named above. If you received this email by mistake, please notify the sender immediately, and delete the email from your system. You are prohibited from copying, disseminating or otherwise using the email or any attachment.
> > 
> > 
> > _______________________________________________
> > Xenomai-help mailing list
> > Xenomai-help@domain.hid
> > https://mail.gna.org/listinfo/xenomai-help
> 

-- 
Philippe.




  reply	other threads:[~2011-09-01 20:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 10:32 [Xenomai-help] taskDelete(tid) on VxWorks Skin ? Sambasiva Rao Manchili
2011-09-01 11:36 ` Gilles Chanteperdrix
2011-09-01 12:01   ` Sambasiva Rao Manchili
2011-09-01 12:06     ` Gilles Chanteperdrix
2011-09-01 14:51       ` Sambasiva Rao Manchili
2011-09-01 15:08         ` Gilles Chanteperdrix
2011-09-01 15:25           ` Sambasiva Rao Manchili
2011-09-01 20:27             ` Philippe Gerum
2011-09-01 20:35               ` Philippe Gerum [this message]
2011-09-06 11:13                 ` Sambasiva Rao Manchili
2011-09-02  7:29               ` Sambasiva Rao Manchili
2011-09-02  8:00                 ` Philippe Gerum
2011-09-02  9:22                   ` Gilles Chanteperdrix
2011-09-02 15:32                     ` Philippe Gerum
  -- strict thread matches above, loose matches on Subject: below --
2011-09-01 10:23 Sambasiva Rao Manchili
2011-09-01 20:29 ` Philippe Gerum

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=1314909331.18201.35.camel@domain.hid \
    --to=rpm@xenomai.org \
    --cc=Xenomai-help@domain.hid \
    --cc=sambasiva.manchili@domain.hid \
    /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.