Skip to contentSkip to conversation

taskDelete(tid) on VxWorks Skin ?

Xenomai-help Sambasiva Rao Manchili 3 participants 14 messages Sep 1, 2011 – Sep 6, 2011

lore
Share & tools
lore
#0 lore raw

Hallo,
Additional info, the task that is trying to delete is spawned at priority 97. The task that has to be deleted is running at Priority 142.

If you need more information that I missed, please let me know. Samba.

________________________________
From: Sambasiva Rao Manchili
Sent: Thursday, 01. September, 2011 12:23
To: [email protected]
Subject: taskDelete(tid) on VxWorks Skin ?

Hallo,
During cleanup routines we call taskDelete(tid) but for some reasons we see that taskDelete is not working as expected though status returned by taskDelete call is 0(OK) and
further leads to crash as the task still exists(not deleted as assumed to be deleted with taskDelete) and trying to do something....which is not valid any more. We use options as 0 while creating task.

Also tried taskDeleteForce, but did not help. Any hints please.

To my knowledge, Xenomai does not support any Hooks adding and deleing calls of Vxworks, we did not use them either.

But I got some info from the following URL.
<http://www.xenomai.org/documentation/trunk/html/api/group__pod.html#gd2b761fb70cad30339f092edb4a89587>

Thank you,
samba.

Sambasiva Rao Manchili
Software Development Engineer
________________________________

NEXUS TELECOM AG
Network and Service Investigation
Feldbachstrasse 80
8634 Hombrechtikon
Switzerland

Direct/mobile: +41 78 750 6808
Main: +41 44 355 6611
Email: [email protected] <mailto:[email protected]>
Website: www.nexustelecom.com<http://www.nexustelecom.com/>

[cid:[email protected]]

________________________________
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.

#2 lore raw

Hi,

Version info is as follows
Linux eup1 2.6.37.6_xenomai-2.5.6 #2 PREEMPT Mon Jul 18 21:08:17 CEST 2011 i686 i686 i386 GNU/Linux

Kernel Configuraiton attached.

Actually the task that was deleted was "do_forth" task(running at priority 143) by Terminator task(priority 97). Terminator task also exited.

Crash log
-----------
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb4dc4b90 (LWP 26490)] dorxevent (dt=0xb4dc5030) at foexd2.c:724
724 foexd2.c: No such file or directory.
in foexd2.c
(gdb)
(gdb)
(gdb)
(gdb)
(gdb)
(gdb)
(gdb) where

#0  dorxevent (dt=0xb4dc5030) at foexd2.c:724
#1  0xb7f59212 in doinner (dt=0xb4dc5030) at f_kernel.c:413
#2  0xb7f59633 in docommand (dt=0xb4dc5030) at f_kernel.c:483
#3  0xb7f54d95 in state_machine (dt=0xb4dc5030) at f_extn.c:607
#4  0xb7f6428b in start_forth (config=0x80506f8) at f_lib.c:192
#5  0xb7ff266b in do_forth (confp=0x80506f8, dptr=0xb4dc5030, termNo=1) at tesarm.c:561
#6  0xb7ea0cbe in wind_task_trampoline () from /usr/xenomai/lib/libvxworks.so.1
#7  0x4b1e0832 in start_thread () from /lib/libpthread.so.0
#8  0x4b14b45e in clone () from /lib/libc.so.6

(gdb)

Please let me know if I can still give you more information Samba.
-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 13:37
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 1 line · Sambasiva Rao Manchili

If you need more information that I missed, please let me know.

See:
http://www.xenomai.org/index.php/Request_for_information

--
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.

#3 lore raw
Quoted 9 lines · Sambasiva Rao Manchili

Hi,

Version info is as follows
Linux eup1 2.6.37.6_xenomai-2.5.6 #2 PREEMPT Mon Jul 18 21:08:17 CEST 2011 i686 i686 i386 GNU/Linux

Kernel Configuraiton attached.

Actually the task that was deleted was "do_forth" task(running at priority 143) by Terminator task(priority 97). Terminator task also exited.

You missed section 4 in the page I sent you. This is the most important item.

Signature · 1 line
					    Gilles.
#4 lore raw

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. It is also huge code base and several dependencies.

In VxWorks we ran our code in Kernel space and not in user space we used lot of global data as well.
So therefore on Linux, I tied the several tasks that are being spawned into single process on Linux because of dependency and data being shared.

What ever I can explain, I explained over the last email about those tasks in gist. I can also give bit more information after you look at the code snippet. Please just search for string "README" in these files where I gave my observations.

I hope this is one last issue on my table to solve it in whole porting and running our legacy VxWorks code on Linux. Samba

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 14:06
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 10 lines · Sambasiva Rao Manchili

Hi,

Version info is as follows
Linux eup1 2.6.37.6_xenomai-2.5.6 #2 PREEMPT Mon Jul 18 21:08:17 CEST 2011 i686 i686 i386 GNU/Linux

Kernel Configuraiton attached.

Actually the task that was deleted was "do_forth" task(running at priority 143) by Terminator task(priority 97). Terminator task also exited.

You missed section 4 in the page I sent you. This is the most important item.

--
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.

extern int create_forth_task(SCENTABLE_ENTRY_TYPE *entry,
int priority,
int special_stack_size)
{
char name[40];
int used_stack_size;
pthread_t doForthTaskId;
int task_id;
used_stack_size = (special_stack_size != 0) ? special_stack_size : (160 * 1024) ; sprintf(name,"tForth%d",entry->toffset);

task_id = taskSpawn(name,

		   priority,
		   0,
		   used_stack_size,
		   (FUNCPTR)do_forth,
		   (int) entry->config_ptr,
		   (int) entry->dict_ptr,
                   (int)entry->toffset,0,0,0,0,0,0,0);

if (task_id == ERROR)

  {
    serr_log(SERR_ERROR,"cannot spawn tForth (%s)",
	     strerror(errnoGet()));
    return 1;

}
return task_id; /* README:- Usually I see here Xenomai returns task_id as two or three digit number*/

}

static void terminator_task(TASK_TAB_TYPE *task_listp, int termNo) {
UINT_16 i, number;
SCENTABLE_ENTRY_TYPE *entry;

  TESA_CNTRL_TYPE       msg;
  STATUS                status;
  TOffset               toffset;
  char                  name[40];
  struct timespec       ts;
  sprintf(name,"tTerminator%d",termNo);
  logOpen(name);
  serr_open2("tesa",SERR_LDF,0,&tesa_data_fieldp->tesa_ldf_vals);

  ts.tv_sec  = 0;
  ts.tv_nsec = 50000; /* 50 ms */

  msg.msgtype = TESA_FORTH_CNTRL;
  msg.data = (task_listp->control == KILL_FORTH) ? FS_KILLED : FS_RELEASED;

  number = task_listp->anzahl;
  printf("%s: Number---><%d>\n",__FUNCTION__, number);
  while (number) {
    for (i = 0; i < task_listp->anzahl; i++) {
      
      if ((toffset = task_listp->toffset[i])) {
	
	entry = &tesa_scentablep[toffset];
	taskSuspend(task_listp->token[i]);  /* README  Tried with suspend did not help */
       
        /* README , as taskDelete did not work, I tried with force but did not help either.
         * The value of TaskID that I pass here as parameter to taskDelete is taskDeleteForce
         * is same as what I got from taskSpawn from Xenomai.
         */
	status = taskDeleteForce(task_listp->token[i]); 

	serr_log(SERR_INFO,"task %x deleted status %d",task_listp->token[i],
		status);
	if (status == OK) {

           /* README  XENOMAI Retrusn STATUS OK */
	  number--;
	  task_listp->toffset[i] = 0;	  
	  msg.termoffset = toffset; /* set terminaloffset in message */
	  (void) tesa_tx_message(&msg,sizeof(TESA_CNTRL_TYPE));

	} else {

           /* README  NEVER ENTERS HERE */ 
           serrLog( serrWarn, "terminator_task: deletion of tForth%d failed! %s",
             toffset, strerror(errnoGet()) );


	  /* if errno equal S_objLib_OBJ_UNAVAILABLE: the interpreter is in 
	     a critical region ( taskSave is set ) --> try to delete it later 
	     
	     else we assume that the task is already deleted
	     
	  */
	  if (errnoGet() != S_objLib_OBJ_UNAVAILABLE) {
	    number--;
	    task_listp->toffset[i] = 0;
	    msg.termoffset = toffset; /* set terminaloffset in message */
	    (void) tesa_tx_message(&msg,sizeof(TESA_CNTRL_TYPE));
	  }
	}
      } /* if (toffset) */
    } /* for */
    taskDelay( 10 );

} /* while (number) */
free(task_listp);

  printf("%s: Not Calling Exit\n", __FUNCTION__);

/*pthread_exit(0);
exit(0); Original VxWorks code */
}

static void* thread_TesaItask(void *arg)
{
arg=arg;
logMsg(INFO_0,"Exectuting tesa_itask....");

/* README tesa_itask Should spawn 3 tasks (and one of those 3 tasks spawned will spawn
* do_forthTask on some event)
* do_forthTask is for ever and will be deleted by terminatorTask which is spawned by one of those 3 tasks
* during cleanup event.
*
*/
tesa_itask();

printf("%s: Going to sleep INFINITE", __FUNCTION__); while(1)

  {
    sleep(3600);

}
return 0;
}

int main(int argc, char **argv)
{
...
...
tesaITask = osCreateDetachedThread(thread_TesaItask,NULL);
logMsg(INFO_0, "%s: Returned from osCreateDetachedThread tesaItask<%ld>",
__FUNCTION__, tesaITask);

....
}

#5 lore raw
Quoted 4 lines · Sambasiva Rao Manchili

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.

Signature · 1 line
					    Gilles.
#6 lore raw

Hi,
It is reduced piece which explains the problem.
If it is much more then I will see what I can do.
Samba.

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 17:08
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 4 lines · Sambasiva Rao Manchili

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.

#7 lore raw
Quoted 3 lines · Sambasiva Rao Manchili

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):

src/skins/vxworks/taskLib.c +26 -2
index f751788..70f33aa 100644
@@ -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;
Quoted 28 lines

Samba.

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 17:08
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 4 lines · Sambasiva Rao Manchili

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
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.
#8 lore raw
Quoted 7 lines · Philippe Gerum
Quoted 3 lines · Sambasiva Rao Manchili

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.

Quoted 72 lines
src/skins/vxworks/taskLib.c +26 -2
index f751788..70f33aa 100644
@@ -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;
Quoted 29 lines

Samba.

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 17:08
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 4 lines · Sambasiva Rao Manchili

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
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.
#9 lore raw

Philippe,
There is one correction in the following patch. Though you told me uncompiled / untested, I just want to give a try and found minor compilation issue which I want to bring to your notice.

- tid = (pthread_t)desc->td_opaque;
+ tid = (pthread_t)desc.td_opaque;

After this correction compilation went well. I also tested with our ported software. It works as expected with taskDelete from Xenomai.

One more observation that I remember now:-
In legacy VxWorks code we create Queues of size 1000 to store each message of size 384bytes while we have memory on our Boards upto 4GB, but with Xenomai I **have to** reduce the queue size drastically otherwise msgQCreate fails(though we have memory) with error code S_memLib_NOT_ENOUGH_MEMORY.

Samba.

-----Original Message-----
From: Philippe Gerum [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 22:36
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 7 lines · Philippe Gerum
Quoted 3 lines · Sambasiva Rao Manchili

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.

Quoted 64 lines
src/skins/vxworks/taskLib.c +26 -2
index f751788..70f33aa 100644
@@ -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;
Quoted 22 lines

Samba.

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 17:08
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 4 lines · Sambasiva Rao Manchili

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.

Quoted 8 lines
Quoted 7 lines

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
[email protected]
https://mail.gna.org/listinfo/xenomai-help

--
Philippe.

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.

#10 lore raw
In reply to Philippe Gerum

Thank you Philippe for your time.
Right now I did a workaround with a flag after deleting a task and checking this flag before doing any operation by task that was deleted. It works for me. I could not believe taskDelete did not work till yesterday.

I hope with next version of Xenomail release the tested patch for taskDelete will be available and for now I live with my workaround.

Overall porting of VxWorks code, Integration and testing since three months. I faced only two issues for which I got blocked.
1. semTake with specific timeout value failed in Xenomai. As a workaround I just removed this semTake and semGive , which is also OK to an extent in this area of code.
2. taskDelete

Some of the vxworks functions that are not supported, I ported to native linux methods.

Thank you one and all for your support.
Samba.

-----Original Message-----
From: Philippe Gerum [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 22:28
To: Sambasiva Rao Manchili
Cc: Gilles Chanteperdrix; [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 3 lines · Sambasiva Rao Manchili

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):

src/skins/vxworks/taskLib.c +26 -2
@@ -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;
Quoted 21 lines

Samba.

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 17:08
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 4 lines · Sambasiva Rao Manchili

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.

Quoted 7 lines

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
[email protected]
https://mail.gna.org/listinfo/xenomai-help

--
Philippe.

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.

#11 lore raw
Quoted 3 lines · Sambasiva Rao Manchili

Thank you Philippe for your time.
Right now I did a workaround with a flag after deleting a task and checking this flag before doing any operation by task that was deleted. It works for me. I could not believe taskDelete did not work till yesterday.

A kernel change has not been propagated to the vxworks library years ago. In the absence of user feedback and vxworks-specific testsuite in Xenomai 2.x, we are blind.

Quoted 5 lines

I hope with next version of Xenomail release the tested patch for taskDelete will be available and for now I live with my workaround.

Overall porting of VxWorks code, Integration and testing since three months. I faced only two issues for which I got blocked.
1. semTake with specific timeout value failed in Xenomai. As a workaround I just removed this semTake and semGive , which is also OK to an extent in this area of code.

Unlike the one with taskDelete(), this sema4 issue is surprising to me. Can you elaborate?

Quoted 4 lines

2. taskDelete

Some of the vxworks functions that are not supported, I ported to native linux methods.

At the moment, we only support the core O/S routines. This may change in xenomai 3, as we won't have to deal with the legacy in-kernel Xenomai/VxWorks API anymore.

Quoted 96 lines

Thank you one and all for your support.
Samba.

-----Original Message-----
From: Philippe Gerum [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 22:28
To: Sambasiva Rao Manchili
Cc: Gilles Chanteperdrix; [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 3 lines · Sambasiva Rao Manchili

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):

src/skins/vxworks/taskLib.c +26 -2
@@ -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;
Quoted 22 lines

Samba.

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]]
Sent: Thursday, 01. September, 2011 17:08
To: Sambasiva Rao Manchili
Cc: [email protected]
Subject: Re: [Xenomai-help] taskDelete(tid) on VxWorks Skin ?

Quoted 4 lines · Sambasiva Rao Manchili

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.

Quoted 7 lines

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
[email protected]
https://mail.gna.org/listinfo/xenomai-help

--
Philippe.

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.

Signature · 1 line
Philippe.
#12 lore raw
Quoted 10 lines · Philippe Gerum
Quoted 3 lines · Sambasiva Rao Manchili

Thank you Philippe for your time.
Right now I did a workaround with a flag after deleting a task and checking this flag before doing any operation by task that was deleted. It works for me. I could not believe taskDelete did not work till yesterday.

A kernel change has not been propagated to the vxworks library years ago. In the absence of user feedback and vxworks-specific testsuite in Xenomai 2.x, we are blind.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

I hope with next version of Xenomail release the tested patch for taskDelete will be available and for now I live with my workaround.

Overall porting of VxWorks code, Integration and testing since three months. I faced only two issues for which I got blocked.
1. semTake with specific timeout value failed in Xenomai. As a workaround I just removed this semTake and semGive , which is also OK to an extent in this area of code.

Unlike the one with taskDelete(), this sema4 issue is surprising to me. Can you elaborate?

The issue was discussed here:
https://mail.gna.org/public/xenomai-help/2011-08/msg00021.html

Signature · 1 line
					    Gilles.
#13 lore raw
Quoted 13 lines · Gilles Chanteperdrix
Quoted 12 lines · Philippe Gerum
Quoted 3 lines · Sambasiva Rao Manchili

Thank you Philippe for your time.
Right now I did a workaround with a flag after deleting a task and checking this flag before doing any operation by task that was deleted. It works for me. I could not believe taskDelete did not work till yesterday.

A kernel change has not been propagated to the vxworks library years ago. In the absence of user feedback and vxworks-specific testsuite in Xenomai 2.x, we are blind.

Quoted 3 lines

I hope with next version of Xenomail release the tested patch for taskDelete will be available and for now I live with my workaround.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Overall porting of VxWorks code, Integration and testing since three months. I faced only two issues for which I got blocked.
1. semTake with specific timeout value failed in Xenomai. As a workaround I just removed this semTake and semGive , which is also OK to an extent in this area of code.

Unlike the one with taskDelete(), this sema4 issue is surprising to me. Can you elaborate?

The issue was discussed here:
https://mail.gna.org/public/xenomai-help/2011-08/msg00021.html

Then we know for sure this is not related to a timeout issue.

Signature · 1 line
Philippe.