Bug #729
closedpatch to fix SMP vkernel reboots
0%
Description
Rebooting an SMP vkernel currently doesn't work since kern_execve()
won't exec if multiple LWPs are present. The attached patch adds a
signal handler for SIGUSR2 which calls pthread_exit() on the current
thread and a function kill_vcpus() that sends SIGUSR2 to each of the
virtual CPU threads. I'm not sure if I need to do some memory
clean-up or not, so let me know if I'm missing something.
Joe
Files
Updated by joerg almost 17 years ago
I would suggest a few modifications:
(1) Use SIGTERM. It is common to have that meaning.
(2) Memorize the original thread in a global variable. Set a second one
to notify that it was called internally.
(3) In the signal handler, check if the second variable is called. If
not, handle this as external shutdown/reboot request. If it is, compare
pthread_self() with the first variable and pthread_exit() if they don't
match. Use a conditional variable to find out when all threads are dead.
Ideally this dance would not be necessary as exec is supposed to kill
all LWPs.
Joerg
Updated by corecode almost 17 years ago
exactly. I actually designed it to do so. Strange. What's exactly the problem?
cheers
simon
Updated by dillon almost 17 years ago
:Ideally this dance would not be necessary as exec is supposed to kill
:all LWPs.
:
:Joerg
It is? I'll just make it kill all the LWPs then.
-Matt
Matthew Dillon
<dillon@backplane.com>
Updated by dillon almost 17 years ago
:Joerg Sonnenberger wrote:
:> Ideally this dance would not be necessary as exec is supposed to kill
:> all LWPs.
:
:exactly. I actually designed it to do so. Strange. What's exactly the problem?
:
:cheers
: simon
There was a glitch where the LWPs weren't being killed so I put in a sanity
check to refuse to exec if there were other LWPs.
I'll get it fixed. exec just needs to do the first part of exit1() which
kills the other LWPs before it continues.
-Matt
Matthew Dillon
<dillon@backplane.com>
Updated by joerg almost 17 years ago
Yes. That is where exec and fork differ. Fork is not required to clone
the non-current LWP and that's why only async safe functions are allowed
after fork.
Joerg