Project

General

Profile

Actions

Bug #729

closed

patch to fix SMP vkernel reboots

Added by josepht almost 17 years ago. Updated over 16 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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

vk_reboot.patch (2.45 KB) vk_reboot.patch josepht, 07/12/2007 03:55 PM
Actions #1

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

Actions #2

Updated by corecode almost 17 years ago

exactly. I actually designed it to do so. Strange. What's exactly the problem?

cheers
simon

Actions #3

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
<>
Actions #4

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
<>
Actions #5

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

Actions

Also available in: Atom PDF