making uml work with smp
Hi,
I've tried UML+SMP with linux-2.4.24-um1. According to the project list on the uml site, this feature is ready but needs to be debugged.
I report here my attempt to start UML with smp with no success. However, as the code is already there, it would be very nice to have it work.
Would it be possible to have useful pointers toward architecture details that would help in understanding how to make it work. Useful techniques on how to debug uml+smp would also be very interesting as it looks like it is not going to be the trivial task of the day ...
The only changes that have to be made to compile with SMP is
*add the folowing to arch/um/config.in
define_bool CONFIG_SMP $CONFIG_UML_SMP
+int 'Number of CPUs' CONFIG_NR_CPUS 1
*change this line in arch/um/kernel/um_arch.c
-int ncpus = 1;
+int ncpus = 4;
*turn it on in the kernel config
When booting the machine, you can see the processors starting :
./linux-smp ubd0=cow0 umid=test devfs=nomount mode=tt [...]
Starting up other processors:
#1 - idle thread pid = 18502.. online
#2 - idle thread pid = 18504.. online
#3 - idle thread pid = 18506.. onlineAll CPUs are go!
Waiting on wait_init_idle (map = 0xe)
All processors have done init_idle
[..]
As expected problems occur when booting the UML machine,
1) a crash :
INIT: version 2.84 booting
Kernel panic: Kernel mode fault at addr 0x115, ip 0xa00c9066 <6>Stopping all CPUs...CPU#0 stopping
but gdb gives the following:
Couldn't get registers: No such process.
(gdb) bt
Couldn't get registers: No such process.
but with only one processor, you can have gdb to tell you that the problem is in tty_open
2) sometimes there is a hang with the following backtrace
[...]
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. [hang here]
#0 0xa0181eb1 in nanosleep () #1 0xa00bc516 in idle_sleep (secs=10) at time.c:160 #2 0xa00b8161 in cpu_idle () at process_kern.c:210 #3 0xa000d542 in rest_init () at init/main.c:346 #4 0xa00025f9 in start_kernel () at init/main.c:440 #5 0xa00bf1ed in start_kernel_proc (unused=0x0) at process_kern.c:437 #6 0xa00c030f in signal_tramp (arg=0xa00bf1a4) at tracer.c:120
Signature · 18 lines
Vincent Guffens PhD Student UCL/CESAME tel: +32 10 47 80 30 Value your freedom, or you will lose it, teaches history. "Don't bother us with politics," respond those who don't want to learn. -- Richard M. Stallman ------------------------------------------------------- This SF.Net email is sponsored by: GNOME Foundation Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event. GNOME Users and Developers European Conference, 28-30th June in Norway http://2004/guadec.org _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Alle 13:21, giovedì 10 giugno 2004, Vincent Guffens ha scritto:
Review
Quoted 12 lines
Hi,
The only changes that have to be made to compile with SMP is
*add the folowing to
arch/um/config.in
define_boolCONFIG_SMP$CONFIG_UML_SMP
+int 'Number of CPUs'CONFIG_NR_CPUS1*change this line in
arch/um/kernel/um_arch.c(quoted diff) +1
-1-int ncpus = 1; +int ncpus = 4;
No, please at least make CONFIG_NR_CPUS == ncpus, PLEASE!
Quoted 1 line
*turn it on in the kernel config
Well, watch this code in the patch:
+void switch_mm_skas(int mm_fd)
+{
+ int err;
+
+#warning need cpu pid in switch_mm_skas
+ err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, mm_fd);
+ if(err)
+ panic("switch_mm_skas - PTRACE_SWITCH_MM failed, errno =
%d\n",
+ errno);
+}
+
+void kill_off_processes_skas(void)
+{
+#warning need to loop over userspace_pids in kill_off_processes_skas
+ os_kill_process(userspace_pid[0], 1);
+}
userspace_pid[] is the array of the pids of the "userspace threads" (the threads in T state, i.e. ptraced, which run the actual code of the guest userspace). The warning complain that they should act onto the whole array.
Here, instead, you must use smp_processor_id() to determine which CPU you run on and then use it as userspace_pid index.
+int external_pid_skas(struct task_struct *task) +{
+#warning Need to look up userspace_pid by cpu
+ return(userspace_pid[0]);
+}
+
+int thread_pid_skas(struct thread_struct *thread) +{
+#warning Need to look up userspace_pid by cpu
+ return(userspace_pid[0]);
+}
Check any other usage of userspace_pid (on the code, not by debugging) and you've started solving the crashes. Then you can try again to see if there is still something.
Bye
Signature · 14 lines
Paolo Giarrusso, aka Blaisorblade Linux registered user n. 292729 ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel