Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Nadav Har'El
On Tue, Aug 23, 2016 at 12:32 AM, Nadav Har'El wrote: > > On Mon, Aug 22, 2016 at 6:51 PM, Justin Cinkelj > wrote: > >> Seems that here and there, osv_execve returns with thread_id still at 0, >> instead of containing new thread id. >> So a little race. >> > > I didn't notice this earlier, but o

[PATCH] RFC: osv_execve: fix race in setting returned thread id

2016-08-22 Thread Nadav Har'El
osv_execve() promises to return the new thread's id in the given pointer, but it actually lets the new thread set the id itself - so osv_execve() may return before the new thread got to run and set this id. The fix in this patch is for osv_execve() to wait until this variable is set before returni

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Nadav Har'El
On Mon, Aug 22, 2016 at 6:51 PM, Justin Cinkelj wrote: > Seems that here and there, osv_execve returns with thread_id still at 0, > instead of containing new thread id. > So a little race. > I didn't notice this earlier, but osv_execve has the same race that I warned you about in your new code:

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Justin Cinkelj
Example test output, partial: TT In tst-execve.c main, my tid=246. TT argc 5 TT argv[0] = /misc-execve.so TT argv[1] = 1 TT argv[2] = /misc-execve-payload.so TT argv[3] = 123 TT argv[4] = 456 TT id=0 before osv_execve OSv osv_execve:94 path=/misc-execve-payload.so argv=0xa45f2c00 envp=0xf

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Justin Cinkelj
Seems that here and there, osv_execve returns with thread_id still at 0, instead of containing new thread id. So a little race. Then, get_all_app_threads either returns only ID of thread which called osv_execve, or thread IDs of both thread which called osv_execve and thread created by osv_exec

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Justin Cinkelj
I tested it ,without my patches. It didn't work. CPU affinity is set to wrong threads - to threads belonging to orted.so, not to mpi_app.so. Maybe with_all_app_threads gets confused, as it seems to return thread ID of threads belonging to orted.so, not to mpi_app.so. I will try to modify tst-exec

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Nadav Har'El
On Mon, Aug 22, 2016 at 12:31 PM, Justin Cinkelj wrote: > > > On 08/21/2016 04:38 PM, Nadav Har'El wrote: > > > > I've been thinking about this some more, and why you had to change your > osv_execve() implementation - which already returned a thread id, but the > "wrong" one: > > The "original si

[PATCH] RFC: osv::run() do not create a new thread

2016-08-22 Thread Nadav Har'El
The osv::run() API waits for the program it started to complete, so it doesn't really need to start a new thread, and could run the program in the existing thread. And yet, it does create a new thread, because it uses the application::run() API which starts a new application and returns to the cal

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Justin Cinkelj
On 08/21/2016 04:38 PM, Nadav Har'El wrote: On Sun, Aug 21, 2016 at 5:22 PM, Nadav Har'El > wrote: Hi Justin, Unless I'm misunderstanding something, I think there is a race in your code: osv_execve() spawns a new thread to run a function thread_run_

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Justin Cinkelj
On 08/21/2016 04:22 PM, Nadav Har'El wrote: Hi Justin, Unless I'm misunderstanding something, I think there is a race in your code: osv_execve() spawns a new thread to run a function thread_run_app_in_namespace(), and this will eventually set the value pointed by pid_t *thread_id. But tha

Re: Questions on OSv Makefile or Capstanfile

2016-08-22 Thread Rick Payne
> On 20 Aug 2016, at 20:57, Nadav Har'El wrote: > > The MIKELANGELO project (https://www.mikelangelo-project.eu/) is working on > expanding Capstan to add better application composition features. The same > people doing that work (http://www.xlab.si/?lang=en) are also looking into > expanding

Re: [PATCH 1/2] libc: add pthread_getid utility fucntion

2016-08-22 Thread Justin Cinkelj
On 08/21/2016 03:15 PM, Nadav Har'El wrote: Hi Justin, On Tue, Aug 16, 2016 at 9:50 AM, Justin Cinkelj mailto:justin.cink...@xlab.si>> wrote: pthread_getid is only a convience function to convert pthread_t to corresponding thread ID. It is added here to avoid manually casting pt