Page MenuHomeFreeBSD

In preparation for switching linuxulator to the use the native 1:1 threads add hook for cleaning thread resources before the thread die.
ClosedPublic

Authored by dchagin on Oct 31 2014, 6:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 8, 10:54 PM
Unknown Object (File)
Sun, Sep 8, 4:26 AM
Unknown Object (File)
Sun, Sep 1, 7:03 PM
Unknown Object (File)
Sun, Sep 1, 5:11 AM
Unknown Object (File)
Wed, Aug 28, 11:23 AM
Unknown Object (File)
Fri, Aug 23, 7:06 AM
Unknown Object (File)
Thu, Aug 22, 10:22 PM
Unknown Object (File)
Mon, Aug 19, 1:53 AM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dchagin retitled this revision from to In preparation for switching linuxulator to the use the native 1:1 threads add hook for cleaning thread resources before the thread die..

As discussed with kib@ this change is incorrect. At this point, the execing process does not have the address space.
Possible direction is to put a sv_thread_detach hook in to the proc_exec handler.

I have not found a suitable solution, so this is the best way to handle single threading.
execve() case to be handled by eventhadler.

trasz added a subscriber: trasz.

Konstantin, is the problem still there?

In D1038#9, @trasz wrote:

Konstantin, is the problem still there?

What problem ?

Quoting the first comment above, "As discussed with kib@ this change is incorrect. At this point, the execing process does not have the address space. Possible direction is to put a sv_thread_detach hook in to the proc_exec handler". So, my question is, is this patch still incorrect, or has it been reworked to make it work properly?

In D1038#13, @trasz wrote:

Quoting the first comment above, "As discussed with kib@ this change is incorrect. At this point, the execing process does not have the address space. Possible direction is to put a sv_thread_detach hook in to the proc_exec handler". So, my question is, is this patch still incorrect, or has it been reworked to make it work properly?

I have no information about patch rewrite. Isn't Dmitry supposed to know more about state of the work on _his_ patch ?

Hm, okay... Dmitry, is the problem previously pointed out by Konstantin still there, or is the patch correct now?

whoops, sorry for the delay, im so busy these days.. ok, let me to clarify.

for Linux thread we need a proper way to do some cleanup work at thread exit time,
some of this work require access to the user space - robust futex cleanup code (sx used here).

Konstantin quite right pointed out me that this code could not work for exec() case.
As suspended threads call thread_suspend_check() from ast() or sleep() and at this time old
proc vmspace does not exist, so my sv_thread_detach() would fail.

ie, this method works only for exit1(), and in linux_exec() I must finish all threads before do_execve() call.

D1039 updated, linux_common_execve() in linux_emul.c

This revision was automatically updated to reflect the committed changes.