host context switch reduction
PATCH 1/1 host context switch reduction
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it.
There's some interest in this, so I'm putting it out as-is. I haven't played with it.
Laurent did some performance testing and found ~40% speedup on a getpid loop, and a 3.5% speedup on a kernel build.
Jeff
diff -Nrc skas3-linux-2.4.22/Makefile skas4-linux-2.4.22/Makefile
*** skas3-linux-2.4.22/Makefile Tue Dec 2 21:24:14 2003
--- skas4-linux-2.4.22/Makefile Tue Dec 2 20:32:41 2003
***************
*** 1,7 ****
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 22
! EXTRAVERSION = -skas3
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
--- 1,7 ----
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 22
! EXTRAVERSION = -sysemu
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
diff -Nrc skas3-linux-2.4.22/arch/i386/kernel/entry.S skas4-linux-2.4.22/arch/i386/kernel/entry.S
*** skas3-linux-2.4.22/arch/i386/kernel/entry.S Fri Jun 13 16:51:29 2003
--- skas4-linux-2.4.22/arch/i386/kernel/entry.S Tue Dec 2 20:27:41 2003
***************
*** 203,208 ****
--- 203,210 ----
pushl %eax # save orig_eax
SAVE_ALL
GET_CURRENT(%ebx)
+ testb $0x20,tsk_ptrace(%ebx) # PT_SCEMU
+ jne emulatesys
testb $0x02,tsk_ptrace(%ebx) # PT_TRACESYS
jne tracesys
cmpl $(NR_syscalls),%eax
***************
*** 237,242 ****
--- 239,248 ----
jmp restore_all
ALIGN
+ emulatesys:
+ call SYMBOL_NAME(syscall_emulate)
+ jmp ret_from_sys_call
+ ALIGN
tracesys:
movl $-ENOSYS,EAX(%esp)
call SYMBOL_NAME(syscall_trace)
diff -Nrc skas3-linux-2.4.22/arch/i386/kernel/ptrace.c skas4-linux-2.4.22/arch/i386/kernel/ptrace.c
*** skas3-linux-2.4.22/arch/i386/kernel/ptrace.c Tue Dec 2 21:24:01 2003
--- skas4-linux-2.4.22/arch/i386/kernel/ptrace.c Tue Dec 2 18:52:10 2003
***************
*** 275,280 ****
--- 275,281 ----
}
break;
+ case PTRACE_SCEMU: /* continue and replace next syscall */
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */
long tmp;
***************
*** 282,287 ****
--- 283,292 ----
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
+ if (request == PTRACE_SCEMU)
+ child->ptrace |= PT_SCEMU;
+ else
+ child->ptrace &= ~PT_SCEMU;
if (request == PTRACE_SYSCALL)
child->ptrace |= PT_TRACESYS;
else
***************
*** 320,326 ****
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
! child->ptrace &= ~PT_TRACESYS;
if ((child->ptrace & PT_DTRACE) == 0) {
/* Spurious delayed TF traps may occur */ child->ptrace |= PT_DTRACE;
--- 325,331 ----
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
! child->ptrace &= ~(PT_TRACESYS|PT_SCEMU);
if ((child->ptrace & PT_DTRACE) == 0) {
/* Spurious delayed TF traps may occur */ child->ptrace |= PT_DTRACE;
***************
*** 482,487 ****
--- 487,515 ----
return ret;
}
+ asmlinkage void syscall_emulate(void)
+ {
+ if ((current->ptrace & (PT_PTRACED|PT_SCEMU)) !=
+ (PT_PTRACED|PT_SCEMU))
+ return;
+ /* the 0x80 provides a way for the tracing parent to distinguish
+ between a syscall stop and SIGTRAP delivery */
+ current->exit_code = SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
+ ? 0x80 : 0);
+ current->state = TASK_STOPPED;
+ notify_parent(current, SIGCHLD);
+ schedule();
+ /*
+ * this isn't the same as continuing with a signal, but it will do
+ * for normal use. strace only continues with a signal if the
+ * stopping signal is not SIGTRAP. -brl
+ */
+ if (current->exit_code) {
+ send_sig(current->exit_code, current, 1);
+ current->exit_code = 0;
+ }
+ }
+
asmlinkage void syscall_trace(void)
{
if ((current->ptrace & (PT_PTRACED|PT_TRACESYS)) !=
diff -Nrc skas3-linux-2.4.22/include/linux/ptrace.h skas4-linux-2.4.22/include/linux/ptrace.h
*** skas3-linux-2.4.22/include/linux/ptrace.h Sat Sep 15 00:55:17 2001
--- skas4-linux-2.4.22/include/linux/ptrace.h Tue Dec 2 18:42:55 2003
***************
*** 20,25 ****
--- 20,26 ----
#define PTRACE_DETACH 0x11
#define PTRACE_SYSCALL 24
+ #define PTRACE_SCEMU 25
#include <asm/ptrace.h>
diff -Nrc skas3-linux-2.4.22/include/linux/sched.h skas4-linux-2.4.22/include/linux/sched.h
*** skas3-linux-2.4.22/include/linux/sched.h Fri Jun 13 16:51:39 2003
--- skas4-linux-2.4.22/include/linux/sched.h Tue Dec 2 20:28:19 2003
***************
*** 444,449 ****
--- 444,450 ----
#define PT_DTRACE 0x00000004 /* delayed trace (used on m68k, i386) */
#define PT_TRACESYSGOOD 0x00000008
#define PT_PTRACE_CAP 0x00000010 /* ptracer can follow suid-exec */
+ #define PT_SCEMU 0x00000020 /* syscall emulation for UML */
#define is_dumpable(tsk) ((tsk)->task_dumpable && (tsk)->mm && (tsk)->mm->dumpable)
diff -Nrc uml-linux-2.4.22/arch/um/kernel/process.c sysemu-uml-linux-2.4.22/arch/um/kernel/process.c
*** uml-linux-2.4.22/arch/um/kernel/process.c Tue Oct 14 15:28:28 2003
--- sysemu-uml-linux-2.4.22/arch/um/kernel/process.c Thu Dec 4 20:14:33 2003
***************
*** 222,227 ****
--- 222,243 ----
}
stop_ptraced_child(pid, stack, 0);
printk("OK\n");
+
+ #ifdef PTRACE_SYSEMU
+ printk("Checking syscall emulation patch for ptrace...");
+
+ use_sysemu = 0;
+ pid = start_ptraced_child(&stack);
+ if(ptrace(PTRACE_SYSEMU, pid, 0, 0) >= 0)
+ {
+ printk("OK\n");
+ use_sysemu = 1;
+ }
+ else
+ printk("missing\n");
+
+ stop_ptraced_child(pid, stack, 0);
+ #endif
}
int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr)
diff -Nrc uml-linux-2.4.22/arch/um/kernel/skas/include/ptrace-skas.h sysemu-uml-linux-2.4.22/arch/um/kernel/skas/include/ptrace-skas.h
*** uml-linux-2.4.22/arch/um/kernel/skas/include/ptrace-skas.h Tue Oct 14 15:28:28 2003
--- sysemu-uml-linux-2.4.22/arch/um/kernel/skas/include/ptrace-skas.h Thu Dec 4 20:15:34 2003
***************
*** 10,15 ****
--- 10,22 ----
#ifdef UML_CONFIG_MODE_SKAS
+ /* syscall emulation path in ptrace */
+
+ #ifndef PTRACE_SYSEMU
+ #define PTRACE_SYSEMU 25
+ #endif
+ extern int use_sysemu;
+
#include "skas_ptregs.h"
#define HOST_FRAME_SIZE 17
diff -Nrc uml-linux-2.4.22/arch/um/kernel/skas/process.c sysemu-uml-linux-2.4.22/arch/um/kernel/skas/process.c
*** uml-linux-2.4.22/arch/um/kernel/skas/process.c Wed Dec 3 18:53:54 2003
--- sysemu-uml-linux-2.4.22/arch/um/kernel/skas/process.c Fri Dec 5 17:57:03 2003
***************
*** 27,32 ****
--- 27,36 ----
#include "skas_ptrace.h"
#include "chan_user.h"
+ #ifdef PTRACE_SYSEMU
+ int use_sysemu = 0;
+ #endif
+
int is_skas_winch(int pid, int fd, void *data)
{
if(pid != getpid())
***************
*** 65,85 ****
return;
}
! err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid);
! if(err < 0)
! panic("handle_trap - nullifying syscall failed errno = %d\n",
! errno);
! err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
! if(err < 0)
! panic("handle_trap - continuing to end of syscall failed, "
! "errno = %d\n", errno);
!
! err = waitpid(pid, &status, WUNTRACED);
! if((err < 0) || !WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
! panic("handle_trap - failed to wait at end of syscall, "
! "errno = %d, status = %d\n", errno, status);
handle_syscall(regs); }
--- 69,91 ----
return;
}
! if (!use_sysemu)
! {
! err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid);
! if(err < 0)
! panic("handle_trap - nullifying syscall failed errno = %d\n",
! errno);
! err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
! if(err < 0)
! panic("handle_trap - continuing to end of syscall failed, "
! "errno = %d\n", errno);
+ err = waitpid(pid, &status, WUNTRACED);
+ if((err < 0) || !WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
+ panic("handle_trap - failed to wait at end of syscall, "
+ "errno = %d, status = %d\n", errno, status);
+ }
handle_syscall(regs);
}
***************
*** 134,140 ****
--- 140,154 ----
restore_registers(regs);
+ #ifdef PTRACE_SYSEMU
+ if (use_sysemu)
+ err = ptrace(PTRACE_SYSEMU, userspace_pid, 0, 0);
+ else
+ err = ptrace(PTRACE_SYSCALL, userspace_pid, 0, 0);
+ #else
err = ptrace(PTRACE_SYSCALL, userspace_pid, 0, 0);
+ #endif
+
if(err)
panic("userspace - PTRACE_SYSCALL failed, errno = %d\n",
errno);
***************
*** 172,179 ****
--- 186,202 ----
restore_registers(regs);
+ #ifdef PTRACE_SYSEMU
+ if (use_sysemu)
+ op = singlestepping_skas() ? PTRACE_SINGLESTEP :
+ PTRACE_SYSEMU;
+ else
+ op = singlestepping_skas() ? PTRACE_SINGLESTEP :
+ PTRACE_SYSCALL;
+ #else
op = singlestepping_skas() ? PTRACE_SINGLESTEP :
PTRACE_SYSCALL;
+ #endif
err = ptrace(op, userspace_pid, 0, 0); if(err)
panic("userspace - PTRACE_SYSCALL failed, "
Alle 05:35, domenica 29 febbraio 2004, Jeff Dike ha scritto:
Quoted 11 lines
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it.
There's some interest in this, so I'm putting it out as-is. I haven't played with it.
Laurent did some performance testing and found ~40% speedup on a getpid loop, and a 3.5% speedup on a kernel build.
Jeff
That is very interesting (I've not yet looked well at the code). About the same subject, I've had a very vague idea passing through my head: on 2.6 the vsyscall stuff can use whatever mechanism it likes to talk with the kernel - int 0x80, or possibly something else. However a binary can legitimately still use the int 0x80, so we cannot avoid ptracing it (which would possibly be the faster thing to do).
For instance, some trick possibly with normal IPC (futexes, SysV messages or whatever; I think the futexes are the faster one). If we somehow mark the needed syscalls with a not-intercept flag and on ptrace we specify something as "exclude the not-intercept syscalls", we could actually have an improvement. The not-intercept syscalls could be the ones done through sysenter (anyway, UML is not able to handle sysenter syscalls right now, since it would need to learn the new register layout, since there has probably been been some change).
Signature · 14 lines
Paolo Giarrusso, aka Blaisorblade Linux registered user n. 292729 ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 6 lines · Jeff Dike
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it.
There's some interest in this, so I'm putting it out as-is. I haven't played with it.
Well, we did now a bit. First, we need to change the patch a bit:
the patch for uml failed in arch/um/kernel/skas/process.c. There was a call:
err = ptrace(PTRACE_SYSCALL, userspace_pid, 0, 0); which is now:
err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
so we changed all userspace_pid's in the patch to just pid. After that, the uml kernel was ready to build which was done without any error. But UML seem to go crazy a bit with the patch. In 2 of 3 times uml crashed at startup:
Checking for host processor cmov support...Yes
Checking for host processor xmm support...No
Checking that ptrace can change system call numbers...OK Checking syscall emulation patch for ptrace...OK
Lernel panic: check_ptrace : ptrace failed, errno = 3
In idle task - not syncing
Well, but since it sometimes starts we just start it as long as it need to run ;) (for testing ok..)
Quoted 2 lines
Laurent did some performance testing and found ~40% speedup on a getpid loop, and a 3.5% speedup on a kernel build.
Well, we just looked at the context switches. We started 3 UMLs which were doing a make world for xfree. Without patches the number of context switches per second was around 60k, with the patch it was around 40k - so it's noticeable, at least from the cs.
Sven
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 4 lines · Sven 'Darkman' Michels
Well, we just looked at the context switches. We started 3 UMLs which were doing a make world for xfree. Without patches the number of context switches per second was around 60k, with the patch it was around 40k - so it's noticeable, at least from the cs.
Sure it's going to have a noticable effect on cs, that's its whole point.
However, users don't see cs - they see how quickly things run. I was a bit dismissive of the 3.5% improvement of the kernel build, but if you look at the 20-30% hit that UML takes, that 3.5% is a noticable chunk of it.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
hi !
has this / will this be ported to 2.6 ?
have there been made further performance comparisons ? regards
roland
Quoted 5 lines
Well, we just looked at the context switches. We started 3 UMLs which were doing a make world for xfree. Without patches the number of context switches per second was around 60k, with the patch it was around 40k - so it's noticeable, at least from the cs.
Sven
----- Original Message -----
From: "Jeff Dike" <[email protected]>
To: <[email protected]>
Sent: Sunday, February 29, 2004 6:35 AM
Subject: [uml-devel] [PATCH] host context switch reduction
Quoted 4 lines
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it.
Quoted 9 lines
There's some interest in this, so I'm putting it out as-is. I haven't played with it.
Laurent did some performance testing and found ~40% speedup on a getpid loop, and a 3.5% speedup on a kernel build.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Hi,
find hereunder the measurements I sent to Jeff.
If someone think this patch is really useful for 2.6 I can make the port.
Regards,
Laurent
Please CC: me, as I'm not in the mailing list.
Quoted 13 lines · roland
hi !
has this / will this be ported to 2.6 ?
have there been made further performance comparisons ? regards
rolandQuoted 5 lines
Well, we just looked at the context switches. We started 3 UMLs which were doing a make world for xfree. Without patches the number of context switches per second was around 60k, with the patch it was around 40k - so it's noticeable, at least from the cs.
Sven
Quoted 20 lines
----- Original Message -----
From: "Jeff Dike" <[email protected]>
To: <[email protected]>
Sent: Sunday, February 29, 2004 6:35 AM
Subject: [uml-devel] [PATCH] host context switch reductionQuoted 13 lines
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it.
There's some interest in this, so I'm putting it out as-is. I haven't played with it.
Laurent did some performance testing and found ~40% speedup on a getpid loop, and a 3.5% speedup on a kernel build.
Jeff
#include <stdio.h>
int main(int argc, char** argv)
{
int i;
int loop = atol(argv[1]);
for (i = 0; i < loop; i++)
{
getpid();
}
}NATIF:
time ./getpid 10000000
real 0m7.920s user 0m3.990s sys 0m3.940s
UML with sysemu
real 3m55.052s user 0m5.962s sys 0m46.385s
real 3m56.964s user 0m5.846s sys 0m42.635s
real 3m54.179s user 0m5.981s sys 0m47.154s
UML w/o sysemu
real 6m16.956s user 0m5.250s sys 0m58.462s
real 6m17.126s user 0m4.846s sys 1m1.731s
real 6m16.461s user 0m5.077s sys 0m59.365s
---------------------------------------
original UML:
time make dep > /dev/null
real 4m51.669s user 0m37.462s sys 0m51.846s
time make bzImage modules > /dev/null
real 13m35.457s user 4m18.885s sys 1m40.481s
UML with sysemu:
time make dep > /dev/null
real 3m52.486s user 0m37.981s sys 0m50.808s
time make bzImage modules > /dev/null
real 13m5.980s user 4m18.096s sys 1m40.115s
Quoted 2 lines
If someone think this patch is really useful for 2.6 I can make the port.
for my personal opinion, every attempt to improve the performance of uml is useful. :)
the question is:
is the "real world" performance benefit, uml get`s from this patch worth taking your time and is it implemented in a way, so that uml maintainers are happy with that ?
i cannot really estimate, what performance benefits your patch brings to uml in detail, but what i have seen so far, this seems quite worth doing the work. reducing context switches by 1/3 is a LOT, imho - and reducing the execution time of the getpid-loop to nearly the half is quite impressive.
are there any "con`s" that argue for that work _NOT_ being done ?
i would be a happy tester of a patch for 2.6 :)
regards
roland
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "roland" <[email protected]>
Cc: <[email protected]>
Sent: Tuesday, May 18, 2004 12:00 AM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Quoted 4 lines
Hi,
find hereunder the measurements I sent to Jeff.
Quoted 42 lines
If someone think this patch is really useful for 2.6 I can make the port.
Regards,
Laurent
Please CC: me, as I'm not in the mailing list.Quoted 33 lines · roland
hi !
has this / will this be ported to 2.6 ?
have there been made further performance comparisons ? regards
rolandQuoted 5 lines
Well, we just looked at the context switches. We started 3 UMLs which were doing a make world for xfree. Without patches the number of context switches per second was around 60k, with the patch it was around 40k - so it's noticeable, at least from the cs.
Sven----- Original Message -----
From: "Jeff Dike" <[email protected]>
To: <[email protected]>
Sent: Sunday, February 29, 2004 6:35 AM
Subject: [uml-devel] [PATCH] host context switch reductionQuoted 13 lines
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it.
There's some interest in this, so I'm putting it out as-is. I haven't played with it.
Laurent did some performance testing and found ~40% speedup on a getpid loop, and a 3.5% speedup on a kernel build.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 3 lines · roland
the question is:
is the "real world" performance benefit, uml get`s from this patch worth taking your time and is it implemented in a way, so that uml maintainers are happy with that ?
The patch seems reasonable to me. I'd be happiest with Laurent pushing this into mainline himself.
Quoted 3 lines
i cannot really estimate, what performance benefits your patch brings to uml in detail, but what i have seen so far, this seems quite worth doing the work. reducing context switches by 1/3 is a LOT, imho - and reducing the execution time of the getpid-loop to nearly the half is quite impressive.
Yeah, but no real workloads do while(1) getpid();
The kernel build improvement is obviously smaller, but still worth having.
Quoted 1 line
are there any "con`s" that argue for that work _NOT_ being done ?
No. But testing, and happy reports to the appropriate mailing lists would help.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Hi,
as it is a plebiscite ;-), find attached the patch for UML 2.6.6 and measurements I made on my poor netserver.
Laurent
Quoted 14 lines · Jeff Dike
Quoted 3 lines · roland
the question is:
is the "real world" performance benefit, uml get`s from this patch worth taking your time and is it implemented in a way, so that uml maintainers are happy with that ?The patch seems reasonable to me. I'd be happiest with Laurent pushing this into mainline himself.
Quoted 3 lines
i cannot really estimate, what performance benefits your patch brings to uml in detail, but what i have seen so far, this seems quite worth doing the work. reducing context switches by 1/3 is a LOT, imho - and reducing the execution time of the getpid-loop to nearly the half is quite impressive.
Yeah, but no real workloads do while(1)
getpid();
Quoted 8 lines
The kernel build improvement is obviously smaller, but still worth having.
Quoted 1 line
are there any "con`s" that argue for that work _NOT_ being done ?
No. But testing, and happy reports to the appropriate mailing lists would help.
Jeff
HP Netserver LH Pro bi-pro 200 MHz / 256 MB RAM
NATIF:
netserver:/usr/src# uname -a Linux netserver 2.4.24-sysemu #4 SMP Tue Feb 17 16:43:11 CET 2004 i686 GNU/Linux
netserver:/usr/src# time ./getpid 1000000
real 0m1.763s user 0m0.910s sys 0m0.860s
real 0m1.759s user 0m0.900s sys 0m0.870s
real 0m1.759s user 0m0.950s sys 0m0.800s
UML with sysemu:
(none):~# uname -a Linux (none) 2.6.6-1um #10 Wed May 19 12:54:37 CEST 2004 i686 unknown
(none):/mnt/usr/src# time ./getpid 1000000
real 1m1.508s user 0m7.960s sys 0m53.450s
real 1m1.881s user 0m6.630s sys 0m55.240s
real 1m1.920s user 0m6.580s sys 0m55.340s
UML w/o sysemu
real 1m32.833s user 0m7.610s sys 1m25.130s
real 1m32.921s user 0m7.890s sys 1m24.980s
real 1m33.493s user 0m8.010s sys 1m24.960s
diff -rNc linux-2.6.6/arch/um/kernel/process.c uml-linux-2.6.6/arch/um/kernel/process.c
*** linux-2.6.6/arch/um/kernel/process.c Wed May 19 14:27:13 2004
--- uml-linux-2.6.6/arch/um/kernel/process.c Wed May 19 14:25:40 2004
***************
*** 19,24 ****
--- 19,25 ----
#include <asm/sigcontext.h>
#include <asm/unistd.h>
#include <asm/page.h>
+ #include <asm/user.h>
#include "user_util.h"
#include "kern_util.h"
#include "user.h"
***************
*** 227,232 ****
--- 228,267 ----
}
stop_ptraced_child(pid, stack, 0);
printk("OK\n");
+
+ #ifdef PTRACE_SYSEMU
+ printk("Checking syscall emulation patch for ptrace...");
+ use_sysemu = 0;
+ pid = start_ptraced_child(&stack);
+ if(ptrace(PTRACE_SYSEMU, pid, 0, 0) >= 0) {
+ struct user_regs_struct regs;
+
+ if (waitpid(pid, &status, WUNTRACED) < 0)
+ panic("check_ptrace : wait failed, errno = %d", errno);
+ if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
+ panic("check_ptrace : expected SIGTRAP, "
+ "got status = %d", status);
+
+ if (ptrace(PTRACE_GETREGS, pid, 0, ®s) < 0)
+ panic("check_ptrace : failed to read child "
+ "registers, errno = %d", errno);
+ regs.orig_eax = pid;
+ if (ptrace(PTRACE_SETREGS, pid, 0, ®s) < 0)
+ panic("check_ptrace : failed to modify child "
+ "registers, errno = %d", errno);
+
+ stop_ptraced_child(pid, stack, 0);
+
+ printk("OK\n");
+ use_sysemu = 1;
+ }
+ else
+ {
+ printk("missing\n");
+ stop_ptraced_child(pid, stack, 1);
+ }
+
+ # endif /* PTRACE_SYSEMU */
}
int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr)
diff -rNc linux-2.6.6/arch/um/kernel/skas/include/ptrace-skas.h uml-linux-2.6.6/arch/um/kernel/skas/include/ptrace-skas.h
*** linux-2.6.6/arch/um/kernel/skas/include/ptrace-skas.h Wed May 19 14:27:13 2004
--- uml-linux-2.6.6/arch/um/kernel/skas/include/ptrace-skas.h Wed May 19 11:22:04 2004
***************
*** 10,15 ****
--- 10,22 ----
#ifdef UML_CONFIG_MODE_SKAS
+ /* syscall emulation path in ptrace */
+
+ #ifndef PTRACE_SYSEMU
+ #define PTRACE_SYSEMU 25
+ #endif
+ extern int use_sysemu;
+
#include "skas_ptregs.h"
#define HOST_FRAME_SIZE 17
diff -rNc linux-2.6.6/arch/um/kernel/skas/process.c uml-linux-2.6.6/arch/um/kernel/skas/process.c
*** linux-2.6.6/arch/um/kernel/skas/process.c Wed May 19 14:27:13 2004
--- uml-linux-2.6.6/arch/um/kernel/skas/process.c Wed May 19 11:22:04 2004
***************
*** 28,33 ****
--- 28,37 ----
#include "chan_user.h"
#include "signal_user.h"
+ #ifdef PTRACE_SYSEMU
+ int use_sysemu = 0;
+ #endif
+
int is_skas_winch(int pid, int fd, void *data)
{
if(pid != getpid())
***************
*** 68,73 ****
--- 72,81 ----
return;
}
+ #ifdef PTRACE_SYSEMU
+ if (!use_sysemu)
+ {
+ #endif
err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid); if(err < 0)
panic("handle_trap - nullifying syscall failed errno = %d\n",
***************
*** 82,87 ****
--- 90,98 ----
if((err < 0) || !WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
panic("handle_trap - failed to wait at end of syscall, "
"errno = %d, status = %d\n", errno, status);
+ #ifdef PTRACE_SYSEMU
+ }
+ #endif
handle_syscall(regs);
}
***************
*** 139,144 ****
--- 150,160 ----
restore_registers(regs);
+ #ifdef PTRACE_SYSEMU
+ if (use_sysemu)
+ err = ptrace(PTRACE_SYSEMU, pid, 0, 0);
+ else
+ #endif
err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
if(err)
panic("userspace - PTRACE_SYSCALL failed, errno = %d\n",
***************
*** 177,182 ****
--- 193,204 ----
restore_registers(regs);
+ #ifdef PTRACE_SYSEMU
+ if (use_sysemu)
+ op = singlestepping_skas() ? PTRACE_SINGLESTEP :
+ PTRACE_SYSEMU;
+ else
+ #endif
op = singlestepping_skas() ? PTRACE_SINGLESTEP :
PTRACE_SYSCALL;
err = ptrace(op, pid, 0, 0);
Hi Laurent !
Great!
Thanks a lot for your work :)
but i have a question:
old mail from jeff:
Quoted 3 lines
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it
so - if your patch adds a new feature for ptrace on the HOST - shouldn`t we need TWO patches for 2.6 ? One patch for uml and one patch for the host ?
this one seems for uml only.
some of us already run uml 2.6(.x) on a 2.6.(.x) host and put their focus on the "new kernel" (me too).
regards
roland
ps:
since this would be the 2nd patch for the HOST (besides skas), would it make sense, to merge "skas" and "sysemu" into one common HOST-patch (if it has been tested and approved stable) ?
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "Jeff Dike" <[email protected]>
Cc: "roland" <[email protected]>; <[email protected]>
Sent: Wednesday, May 19, 2004 7:27 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Hi,
as it is a plebiscite ;-), find attached the patch for UML 2.6.6 and measurements I made on my poor netserver.
Laurent
Quoted 3 lines · Jeff Dike
Quoted 2 lines · roland
the question is:
is the "real world" performance benefit, uml get`s from this patch worth taking your time and is it implemented in a way, so
that
Quoted 7 lines
Quoted 1 line
uml maintainers are happy with that ?
The patch seems reasonable to me. I'd be happiest with Laurent pushing this into mainline himself.
Quoted 2 lines
i cannot really estimate, what performance benefits your patch brings to uml in detail, but what i have seen so far, this seems quite worth doing the work. reducing context switches by 1/3 is a LOT, imho - and reducing the execution time of the
getpid-loop to
Quoted 4 lines
Quoted 1 line
nearly the half is quite impressive.
Yeah, but no real workloads do while(1)
getpid();
Quoted 8 lines
The kernel build improvement is obviously smaller, but still worth having.
Quoted 1 line
are there any "con`s" that argue for that work _NOT_ being done ?
No. But testing, and happy reports to the appropriate mailing lists would help.
Jeff
--------------------------------------------------------------------------------
Quoted 46 lines
HP Netserver LH Pro bi-pro 200 MHz / 256 MB RAM
NATIF:
netserver:/usr/src# uname -a Linux netserver 2.4.24-sysemu #4 SMP Tue Feb 17 16:43:11 CET 2004 i686 GNU/Linuxnetserver:/usr/src# time ./getpid 1000000real 0m1.763s user 0m0.910s sys 0m0.860sreal 0m1.759s user 0m0.900s sys 0m0.870sreal 0m1.759s user 0m0.950s sys 0m0.800sUML with sysemu:
(none):~# uname -a Linux (none) 2.6.6-1um #10 Wed May 19 12:54:37 CEST 2004 i686 unknown(none):/mnt/usr/src# time ./getpid 1000000real 1m1.508s user 0m7.960s sys 0m53.450sreal 1m1.881s user 0m6.630s sys 0m55.240sreal 1m1.920s user 0m6.580s sys 0m55.340sUML w/o sysemu
real 1m32.833s user 0m7.610s sys 1m25.130s
Quoted 8 lines
real 1m32.921s user 0m7.890s sys 1m24.980sreal 1m33.493s user 0m8.010s sys 1m24.960s
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 11 lines · roland
Hi Laurent !
Great!
Thanks a lot for your work :)but i have a question:
old mail from jeff:
Quoted 3 lines
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it
Quoted 5 lines
so - if your patch adds a new feature for ptrace on the HOST - shouldn`t we need TWO patches for 2.6 ? One patch for uml and one patch for the host ?
this one seems for uml only.
some of us already run uml 2.6(.x) on a 2.6.(.x) host and put their focus on the "new kernel" (me too).
OK, as I didn't find skas patch for 2.6 I thought it didn't exist... anyway I tried to port the 2.4 host sysemu patch to 2.6, find it attached. I never tested it, or compiled it ! I have no system with 2.6 kernel, and the only I386 system I have is very, very, very noisy... it's a good system only when it is switched off ;-) !
Quoted 7 lines
regards
rolandps:
since this would be the 2nd patch for the HOST (besides skas), would it make sense, to merge "skas" and "sysemu" into one common HOST-patch (if it has been tested and approved stable) ?
YES, I think... but Jeff is the boss ;-)
Quoted 38 lines
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "Jeff Dike" <[email protected]>
Cc: "roland" <[email protected]>; <[email protected]>
Sent: Wednesday, May 19, 2004 7:27 PM
Subject: Re: [uml-devel] [PATCH] host context switch reductionHi,
as it is a plebiscite ;-), find attached the patch for UML 2.6.6 and measurements I made on my poor netserver.
Laurent
Quoted 3 lines · Jeff Dike
Quoted 2 lines · roland
the question is:
is the "real world" performance benefit, uml get`s from this patch worth taking your time and is it implemented in a way, sothat
Quoted 7 lines
Quoted 1 line
uml maintainers are happy with that ?
The patch seems reasonable to me. I'd be happiest with Laurent pushing this into mainline himself.
Quoted 2 lines
i cannot really estimate, what performance benefits your patch brings to uml in detail, but what i have seen so far, this seems quite worth doing the work. reducing context switches by 1/3 is a LOT, imho - and reducing the execution time of the
getpid-loop to
Quoted 8 lines
Quoted 1 line
nearly the half is quite impressive.
Yeah, but no real workloads do while(1)
getpid();The kernel build improvement is obviously smaller, but still worth having.
Quoted 1 line
are there any "con`s" that argue for that work _NOT_ being done ?
Quoted 65 lines
Quoted 4 lines
No. But testing, and happy reports to the appropriate mailing lists would help.
Jeff
--------------------------------------------------------------------------------
Quoted 54 lines
HP Netserver LH Pro bi-pro 200 MHz / 256 MB RAM
NATIF:
netserver:/usr/src# uname -a Linux netserver 2.4.24-sysemu #4 SMP Tue Feb 17 16:43:11 CET 2004 i686 GNU/Linuxnetserver:/usr/src# time ./getpid 1000000real 0m1.763s user 0m0.910s sys 0m0.860sreal 0m1.759s user 0m0.900s sys 0m0.870sreal 0m1.759s user 0m0.950s sys 0m0.800sUML with sysemu:
(none):~# uname -a Linux (none) 2.6.6-1um #10 Wed May 19 12:54:37 CEST 2004 i686 unknown(none):/mnt/usr/src# time ./getpid 1000000real 1m1.508s user 0m7.960s sys 0m53.450sreal 1m1.881s user 0m6.630s sys 0m55.240sreal 1m1.920s user 0m6.580s sys 0m55.340sUML w/o sysemu
real 1m32.833s user 0m7.610s sys 1m25.130sreal 1m32.921s user 0m7.890s sys 1m24.980sreal 1m33.493s user 0m8.010s sys 1m24.960s
diff -rNc linux-2.6.6/arch/i386/kernel/entry.S linux-2.6.6-sysemu/arch/i386/kernel/entry.S
*** linux-2.6.6/arch/i386/kernel/entry.S Mon May 10 04:32:26 2004
--- linux-2.6.6-sysemu/arch/i386/kernel/entry.S Tue May 18 11:36:52 2004
***************
*** 286,291 ****
--- 286,294 ----
GET_THREAD_INFO(%ebp)
cmpl $(nr_syscalls), %eax
jae syscall_badsys
+ # system call emulation
+ testb $(_TIF_SYSCALL_EMU),TI_FLAGS(%ebp)
+ jnz syscall_emu_entry
# system call tracing in operation testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_FLAGS(%ebp) jnz syscall_trace_entry *************** *** 339,344 **** --- 342,351 ---- call do_notify_resume jmp restore_all
+ # perform syscal emulation
+ syscall_emu_entry:
+ call do_syscall_emu
+ jmp syscall_exit
# perform syscall exit tracing ALIGN syscall_trace_entry: diff -rNc linux-2.6.6/arch/i386/kernel/ptrace.c linux-2.6.6-sysemu/arch/i386/kernel/ptrace.c *** linux-2.6.6/arch/i386/kernel/ptrace.c Mon May 10 04:32:26 2004 --- linux-2.6.6-sysemu/arch/i386/kernel/ptrace.c Tue May 18 11:43:54 2004 *************** *** 356,361 **** --- 356,362 ---- } break;
+ case PTRACE_SCEMU: /* continue and replace next syscall */
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ case PTRACE_CONT: { /* restart after signal. */
long tmp;
***************
*** 363,368 ****
--- 364,375 ----
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
+ if (request == PTRACE_SCEMU) {
+ set_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+ }
+ else {
+ clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+ }
if (request == PTRACE_SYSCALL) {
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
}
***************
*** 403,409 ****
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
! clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
if ((child->ptrace & PT_DTRACE) == 0) {
/* Spurious delayed TF traps may occur */
child->ptrace |= PT_DTRACE;
--- 410,416 ----
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
! clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE|TIF_SYSCALL_EMU);
if ((child->ptrace & PT_DTRACE) == 0) {
/* Spurious delayed TF traps may occur */
child->ptrace |= PT_DTRACE;
***************
*** 538,543 ****
--- 545,572 ----
return;
if (!(current->ptrace & PT_PTRACED))
return;
+ /* the 0x80 provides a way for the tracing parent to distinguish
+ between a syscall stop and SIGTRAP delivery */
+ ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
+ ? 0x80 : 0));
+
+ /*
+ * this isn't the same as continuing with a signal, but it will do
+ * for normal use. strace only continues with a signal if the
+ * stopping signal is not SIGTRAP. -brl
+ */
+ if (current->exit_code) {
+ send_sig(current->exit_code, current, 1);
+ current->exit_code = 0;
+ }
+ }
+
+ void do_syscall_emu(void)
+ {
+ if (!test_thread_flag(TIF_SYSCALL_EMU))
+ return;
+ if (!(current->ptrace & PT_PTRACED))
+ return;
/* the 0x80 provides a way for the tracing parent to distinguish
between a syscall stop and SIGTRAP delivery */
ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
diff -rNc linux-2.6.6/include/asm-i386/thread_info.h linux-2.6.6-sysemu/include/asm-i386/thread_info.h
*** linux-2.6.6/include/asm-i386/thread_info.h Mon May 10 04:32:01 2004
--- linux-2.6.6-sysemu/include/asm-i386/thread_info.h Tue May 18 11:33:00 2004
***************
*** 151,156 ****
--- 151,157 ----
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
#define TIF_IRET 5 /* return with iret */
+ #define TIF_SYSCALL_EMU 6 /* syscall emulation active */
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
***************
*** 160,165 ****
--- 161,167 ----
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
#define _TIF_IRET (1<<TIF_IRET)
+ #define _TIF_SYSCALL_EMU (1<<TIF_SYSCALL_EMU)
#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
diff -rNc linux-2.6.6/include/linux/ptrace.h linux-2.6.6-sysemu/include/linux/ptrace.h
*** linux-2.6.6/include/linux/ptrace.h Mon May 10 04:32:00 2004
--- linux-2.6.6-sysemu/include/linux/ptrace.h Tue May 18 11:44:39 2004
***************
*** 20,25 ****
--- 20,26 ----
#define PTRACE_DETACH 0x11
#define PTRACE_SYSCALL 24
+ #define PTRACE_SCEMU 25
/* 0x4200-0x4300 are reserved for architecture-independent additions. */ #define PTRACE_SETOPTIONS 0x4200
Quoted 1 line
OK, as I didn't find skas patch for 2.6 I thought it didn't exist...
there exists one at:
http://www.user-mode-linux.org/~blaisorblade/patches/host-skas3-2.6.6-v1.patch
i applied your patch after applying the skas patch. it applies cleanly - good ,
but compile fails very early with the following errormessage:
arch/i386/kernel/ptrace.c: In function `sys_ptrace':arch/i386/kernel/ptrace.c:509: error: duplicate case value arch/i386/kernel/ptrace.c:509: error: previously used here make[1]: *** [arch/i386/kernel/ptrace.o] Error 1
make: *** [arch/i386/kernel] Error 2
unfortunately, i don`t get this managed to fix myself. could you (or someone else) take a look ?
regards
roland
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "roland" <[email protected]>
Cc: "Jeff Dike" <[email protected]>; <[email protected]>
Sent: Wednesday, May 19, 2004 8:17 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Quoted 11 lines · roland
Hi Laurent !
Great!
Thanks a lot for your work :)but i have a question:
old mail from jeff:
Quoted 3 lines
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it
Quoted 5 lines
so - if your patch adds a new feature for ptrace on the HOST - shouldn`t we need TWO patches for 2.6 ? One patch for uml and one patch for the host ?
this one seems for uml only.
some of us already run uml 2.6(.x) on a 2.6.(.x) host and put their focus on the "new kernel" (me too).
OK, as I didn't find skas patch for 2.6 I thought it didn't exist... anyway I tried to port the 2.4 host sysemu patch to 2.6, find it attached. I never tested it, or compiled it ! I have no system with 2.6 kernel, and the only I386 system I have is very, very, very noisy... it's a good system only when it is switched off ;-) !
Quoted 7 lines
regards
rolandps:
since this would be the 2nd patch for the HOST (besides skas), would it make sense, to merge "skas" and "sysemu" into one common HOST-patch (if it has been tested and approved stable) ?
YES, I think... but Jeff is the boss ;-)
Quoted 15 lines
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "Jeff Dike" <[email protected]>
Cc: "roland" <[email protected]>; <[email protected]>
Sent: Wednesday, May 19, 2004 7:27 PM
Subject: Re: [uml-devel] [PATCH] host context switch reductionHi,
as it is a plebiscite ;-), find attached the patch for UML 2.6.6 and measurements I made on my poor netserver.
Quoted 13 lines
Laurent
Quoted 3 lines · Jeff Dike
Quoted 2 lines · roland
the question is:
is the "real world" performance benefit, uml get`s from this patch worth taking your time and is it implemented in a way, sothat
Quoted 6 lines
Quoted 1 line
uml maintainers are happy with that ?
The patch seems reasonable to me. I'd be happiest with Laurent pushing this into mainline himself.
Quoted 1 line
i cannot really estimate, what performance benefits your patch brings to uml in detail, but what i have seen so far, this
seems
Quoted 10 lines
Quoted 1 line
Quoted 1 line
quite worth doing the work. reducing context switches by 1/3 is a LOT, imho - and reducing the execution time of the
getpid-loop to
Quoted 8 lines
Quoted 1 line
nearly the half is quite impressive.
Yeah, but no real workloads do while(1)
getpid();The kernel build improvement is obviously smaller, but still worth having.
Quoted 1 line
are there any "con`s" that argue for that work _NOT_ being done ?
Quoted 65 lines
Quoted 4 lines
No. But testing, and happy reports to the appropriate mailing lists would help.
Jeff
--------------------------------------------------------------------------------
Quoted 54 lines
HP Netserver LH Pro bi-pro 200 MHz / 256 MB RAM
NATIF:
netserver:/usr/src# uname -a Linux netserver 2.4.24-sysemu #4 SMP Tue Feb 17 16:43:11 CET 2004 i686 GNU/Linuxnetserver:/usr/src# time ./getpid 1000000real 0m1.763s user 0m0.910s sys 0m0.860sreal 0m1.759s user 0m0.900s sys 0m0.870sreal 0m1.759s user 0m0.950s sys 0m0.800sUML with sysemu:
(none):~# uname -a Linux (none) 2.6.6-1um #10 Wed May 19 12:54:37 CEST 2004 i686 unknown(none):/mnt/usr/src# time ./getpid 1000000real 1m1.508s user 0m7.960s sys 0m53.450sreal 1m1.881s user 0m6.630s sys 0m55.240sreal 1m1.920s user 0m6.580s sys 0m55.340sUML w/o sysemu
real 1m32.833s user 0m7.610s sys 1m25.130sreal 1m32.921s user 0m7.890s sys 1m24.980sreal 1m33.493s user 0m8.010s sys 1m24.960s
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
In include/linux/ptrace.h ,
change
#define PTRACE_SCEMU 25
by
#define PTRACE_SCEMU 31
Quoted 168 lines · roland
Quoted 1 line
OK, as I didn't find skas patch for 2.6 I thought it didn't exist...
there exists one at:
http://www.user-mode-linux.org/~blaisorblade/patches/host-skas3-2.6.6-v1.patchi applied your patch after applying the skas patch. it applies cleanly - good ,
but compile fails very early with the following errormessage:
arch/i386/kernel/ptrace.c: In function `sys_ptrace':arch/i386/kernel/ptrace.c:509: error: duplicate case valuearch/i386/kernel/ptrace.c:509: error: previously used here make[1]: *** [arch/i386/kernel/ptrace.o] Error 1
make: *** [arch/i386/kernel] Error 2unfortunately, i don`t get this managed to fix myself. could you (or someone else) take a look ?
regards
roland----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "roland" <[email protected]>
Cc: "Jeff Dike" <[email protected]>; <[email protected]>
Sent: Wednesday, May 19, 2004 8:17 PM
Subject: Re: [uml-devel] [PATCH] host context switch reductionQuoted 11 lines · roland
Hi Laurent !
Great!
Thanks a lot for your work :)but i have a question:
old mail from jeff:
Quoted 3 lines
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it
Quoted 5 lines
so - if your patch adds a new feature for ptrace on the HOST - shouldn`t we need TWO patches for 2.6 ? One patch for uml and one patch for the host ?
this one seems for uml only.
some of us already run uml 2.6(.x) on a 2.6.(.x) host and put their focus on the "new kernel" (me too).OK, as I didn't find skas patch for 2.6 I thought it didn't exist... anyway I tried to port the 2.4 host sysemu patch to 2.6, find it attached. I never tested it, or compiled it ! I have no system with 2.6 kernel, and the only I386 system I have is very, very, very noisy... it's a good system only when it is switched off ;-) !
Quoted 7 lines
regards
rolandps:
since this would be the 2nd patch for the HOST (besides skas), would it make sense, to merge "skas" and "sysemu" into one common HOST-patch (if it has been tested and approved stable) ?YES, I think... but Jeff is the boss ;-)
Quoted 15 lines
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "Jeff Dike" <[email protected]>
Cc: "roland" <[email protected]>; <[email protected]>
Sent: Wednesday, May 19, 2004 7:27 PM
Subject: Re: [uml-devel] [PATCH] host context switch reductionHi,
as it is a plebiscite ;-), find attached the patch for UML 2.6.6 and measurements I made on my poor netserver.
Quoted 13 lines
Laurent
Quoted 3 lines · Jeff Dike
Quoted 2 lines · roland
the question is:
is the "real world" performance benefit, uml get`s from this patch worth taking your time and is it implemented in a way, sothat
Quoted 6 lines
Quoted 1 line
uml maintainers are happy with that ?
The patch seems reasonable to me. I'd be happiest with Laurent pushing this into mainline himself.
Quoted 1 line
i cannot really estimate, what performance benefits your patch brings to uml in detail, but what i have seen so far, this
seems
Quoted 75 lines
Quoted 1 line
Quoted 1 line
quite worth doing the work. reducing context switches by 1/3 is a LOT, imho - and reducing the execution time of the
getpid-loop to
Quoted 4 lines
Quoted 1 line
nearly the half is quite impressive.
Yeah, but no real workloads do while(1)
getpid();Quoted 8 lines
The kernel build improvement is obviously smaller, but still worth having.
Quoted 1 line
are there any "con`s" that argue for that work _NOT_ being done ?
No. But testing, and happy reports to the appropriate mailing lists would help.
Jeff
--------------------------------------------------------------------------------
Quoted 54 lines
HP Netserver LH Pro bi-pro 200 MHz / 256 MB RAM
NATIF:
netserver:/usr/src# uname -a Linux netserver 2.4.24-sysemu #4 SMP Tue Feb 17 16:43:11 CET 2004 i686 GNU/Linuxnetserver:/usr/src# time ./getpid 1000000real 0m1.763s user 0m0.910s sys 0m0.860sreal 0m1.759s user 0m0.900s sys 0m0.870sreal 0m1.759s user 0m0.950s sys 0m0.800sUML with sysemu:
(none):~# uname -a Linux (none) 2.6.6-1um #10 Wed May 19 12:54:37 CEST 2004 i686 unknown(none):/mnt/usr/src# time ./getpid 1000000real 1m1.508s user 0m7.960s sys 0m53.450sreal 1m1.881s user 0m6.630s sys 0m55.240sreal 1m1.920s user 0m6.580s sys 0m55.340sUML w/o sysemu
real 1m32.833s user 0m7.610s sys 1m25.130sreal 1m32.921s user 0m7.890s sys 1m24.980sreal 1m33.493s user 0m8.010s sys 1m24.960s
Hi Laurent,
i wondered about:
"Checking syscall emulation patch for ptrace...missing"
so - i dig into this:
the uml-patch needs to be adjusted to the fix you gave for the host patch:
in arch/um/kernel/skas/include/ptrace-skas.h
i changed :
#define PTRACE_SYSEMU 25
to
#define PTRACE_SYSEMU 31
whoha - now sysemu patch is running with 2.6.6 :)
same positive effect: the getpid loop runs MUCH faster.
i have tested some other commands and if i run a "vmstat 1" on the HOST, i can see the context-swap-rate drop down significantly.
great!
laurent, can you post the sysemu uml and host patch again in ONE mail, containing the corrected defines?
others will probably have it easier this way!
(maybe some notes about how it works and what it does would be helpful, too)
thanks a lot!
now we need some real-world performance tests/comparisons :) regards
roland
ps:
i will do some more tests. maybe blaisorblade already wants to mention that patch in his 2.6 documentation at: http://www.user-mode-linux.org/~blaisorblade/ ?
Quoted 5 lines
in
include/linux/ptrace.h,
change
#definePTRACE_SCEMU25
by
#definePTRACE_SCEMU31
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "roland" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, May 19, 2004 9:49 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Hi,
I put all related information at this URL:
http://perso.wanadoo.fr/laurent.vivier/UML
I have modified the 2.4.24 patches to set PTRACE_SYSEMU to 31 too. This modification allows to use 2.4.24 UML on 2.6.6 host, and 2.6.6 UML on 2.4.24 host.
Regards,
Laurent
Quoted 59 lines · roland
Hi Laurent,
i wondered about:
"Checking syscall emulation patch for ptrace...missing"so - i dig into this:
the uml-patch needs to be adjusted to the fix you gave for the host patch:
inarch/um/kernel/skas/include/ptrace-skas.h
i changed :
#definePTRACE_SYSEMU25
to
#definePTRACE_SYSEMU31whoha - now sysemu patch is running with 2.6.6 :)
same positive effect: the getpid loop runs MUCH faster.
i have tested some other commands and if i run a "vmstat 1" on the HOST, i can see the context-swap-rate drop down significantly.great!
laurent, can you post the sysemu uml and host patch again in ONE mail, containing the corrected defines?
others will probably have it easier this way!
(maybe some notes about how it works and what it does would be helpful, too)thanks a lot!
now we need some real-world performance tests/comparisons :) regards
rolandps:
i will do some more tests. maybe blaisorblade already wants to mention that patch in his 2.6 documentation at: http://www.user-mode-linux.org/~blaisorblade/ ?Quoted 5 lines
in
include/linux/ptrace.h,
change
#definePTRACE_SCEMU25
by
#definePTRACE_SCEMU31----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "roland" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, May 19, 2004 9:49 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
PATCH 1/1 commandline switch for sysemu patch
hi !
I have enhanced laurents sysemu patch a little bit.
the attached patch adds an additional commandline-switch to uml. if you specify "sysemu" on the commandline, it makes uml use sysemu, if the host has the sysemu patch,too.
if you dont specify it, uml doesnt use sysemu at all.
this makes it easier to compare uml behaviour with and without sysemu (you don`t need 2 different kernels for that purpose)
Laurent - if you like it, perhaps you could publish that on your website or include it in your sysemu patch?
regards
roland
ps:
sorry - i have only done it for 2.6.6
pps:
since this is my first patch, maybe this is far from being perfect. feel free to comment. :)
Quoted 65 lines
Hi,
I put all related information at this URL:
http://perso.wanadoo.fr/laurent.vivier/UML
I have modified the 2.4.24 patches to set
PTRACE_SYSEMUto 31 too. This modification allows to use 2.4.24 UML on 2.6.6 host, and 2.6.6 UML on 2.4.24 host.Regards,
LaurentLe jeu 20/05/2004 à 04:30, roland a écrit :
Hi Laurent,
i wondered about:
"Checking syscall emulation patch for ptrace...missing"so - i dig into this:
the uml-patch needs to be adjusted to the fix you gave for the host patch:
inarch/um/kernel/skas/include/ptrace-skas.h
i changed :
#definePTRACE_SYSEMU25
to
#definePTRACE_SYSEMU31whoha - now sysemu patch is running with 2.6.6 :)
same positive effect: the getpid loop runs MUCH faster.
i have tested some other commands and if i run a "vmstat 1" on the HOST, i can see the context-swap-rate drop down significantly.great!
laurent, can you post the sysemu uml and host patch again in ONE mail, containing the corrected defines?
others will probably have it easier this way!
(maybe some notes about how it works and what it does would be helpful, too)thanks a lot!
now we need some real-world performance tests/comparisons :) regards
rolandps:
i will do some more tests. maybe blaisorblade already wants to mention that patch in his 2.6 documentation at: http://www.user-mode-linux.org/~blaisorblade/ ?Quoted 5 lines
in
include/linux/ptrace.h,
change
#definePTRACE_SCEMU25
by
#definePTRACE_SCEMU31
Quoted 7 lines
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "roland" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, May 19, 2004 9:49 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
arch/um/kernel/process.c.sysemu renamed from arch/um/kernel/process.c +39 -11
@@ -41,6 +41,8 @@ #include "skas_ptrace.h" #endif +int sysemu_active=0; + void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)) { int flags = 0, pages;
@@ -230,12 +232,12 @@ printk("OK\n"); #ifdef PTRACE_SYSEMU - printk("Checking syscall emulation patch for ptrace..."); + printk("Checking syscall emulation patch for ptrace on HOST..."); use_sysemu = 0; pid = start_ptraced_child(&stack); if(ptrace(PTRACE_SYSEMU, pid, 0, 0) >= 0) { - struct user_regs_struct regs; - + struct user_regs_struct regs; + if (waitpid(pid, &status, WUNTRACED) < 0) panic("check_ptrace : wait failed, errno = %d", errno); if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
@@ -252,18 +254,44 @@ stop_ptraced_child(pid, stack, 0); - printk("OK\n"); - use_sysemu = 1; - } - else - { - printk("missing\n"); + printk("Found!\n"); + printk("Syscall emulation is..."); + if(sysemu_active) { + use_sysemu = 1; + printk("On!\n"); + } + else { + use_sysemu = 0; + printk("Off!\n"); + } + + } + else + { + printk("Missing!\n"); + if(sysemu_active) { + printk("Notice: You cannot use syscall emulation on this host!\n"); + } stop_ptraced_child(pid, stack, 1); - } - + } + + # endif /* PTRACE_SYSEMU */ } + +static void sysemufnc(char *str) +{ + sysemu_active=1; +} + +__uml_setup("sysemu",sysemufnc, +"sysemu\n Turn syscall emulation patch for ptrace (SYSEMU) on.\n" +" SYSEMU is a performance-patch introduced by Laurent Vivier. It changes\n" +" behaviour of ptrace() and helps reducing host context switch rate.\n" +" To make it working, you need a kernel patch for your host, too.\n" +" See http://perso.wanadoo.fr/laurent.vivier/UML/ for further information.\n\n"); + int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) { jmp_buf buf;
hi,
i know - im an awful bad programmer - but perhaps someone can help me implementing /proc/sysemu ? thats somewhat "cosmetic stuff" for turning sysemu (http://perso.wanadoo.fr/laurent.vivier/UML)
on/off at runtime. (yes - this isn`t really important feature - but i would like to have that feature and i like hacking it for programming exercise purpose) :)
i added the following to arch/um/kernel/process.c (that`s, where most of the sysemu patch goes into):
#include "linux/proc_fs.h"
#include "linux/file.h"
static struct file_operations proc_sysemu_fops;
static int make_proc_sysemu(void)
{
struct proc_dir_entry *ent;
ent = create_proc_entry("sysemu", 0x777, &proc_root);
if(ent == NULL){
printk("Failed to register /proc/sysemu\n");
return(0);
}
ent->proc_fops = &proc_mm_fops;
return(0);
}compile fails with:
gcc -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -U__i386__ -Ui386 -D__arch_um__ -DSUBARCH=\"i386\" -D_LARGEFILE64_SOURCE -Iarch/um/include -I/tmp/uml/2.6.6/linux-2.6.6/arch/um/kernel/tt/include -I/tmp/uml/2.6.6/linux-2.6.6/arch/um
/kernel/skas/include -D_GNU_SOURCE -Os -g -c -o arch/um/kernel/process.o arch/um/kernel/process.c
In file included from arch/um/kernel/process.c:47:/usr/include/linux/proc_fs.h:244: error: field `vfs_inode' has incomplete type/usr/include/linux/proc_fs.h: In function `PROC_I':/usr/include/linux/proc_fs.h:249: error: parse error before "struct"
In file included from arch/um/kernel/process.c:48:/usr/include/linux/file.h: At top level:/usr/include/linux/file.h:33: error: BITS_PER_LONG' undeclared here (not in a function) arch/um/kernel/process.c: In function make_proc_sysemu':arch/um/kernel/process.c:61: error: `proc_mm_fops' undeclared (first use in this function) arch/um/kernel/process.c:61: error: (Each undeclared identifier is reported only once arch/um/kernel/process.c:61: error: for each function it appears in.)arch/um/kernel/process.c: At top level:arch/um/kernel/process.c:313: warning: initialization from incompatible pointer type arch/um/kernel/process.c:50: error: storage size of proc_sysemu_fops' isn't known arch/um/kernel/process.c:50: warning: proc_sysemu_fops' defined but not usedarch/um/kernel/process.c:53: warning: `make_proc_sysemu' defined but not used
make[1]: *** [arch/um/kernel/process.o] Error 1
make: *** [arch/um/kernel] Error 2
this looks like the wrong header-files being included. scratching my head now.....
can someone give me a hint ?
regards
roland
ps:
sorry - maybe this is a dumb error and maybe i shouldnt start with such complex things - but i dont like to program the tutorials written down in a c-programming book :)
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "roland" <[email protected]>
Cc: <[email protected]>; "Jeff Dike" <[email protected]>; <[email protected]>
Sent: Thursday, May 20, 2004 2:49 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 6 lines · [email protected] said:
Le mer 19/05/2004 à 20:01, roland a écrit :
Quoted 3 lines
since this would be the 2nd patch for the HOST (besides skas), would it make sense, to merge "skas" and "sysemu" into one common HOST-patch (if it has been tested and approved stable) ?
YES, I think... but Jeff is the boss ;-)
Sometimes I wish I were less the boss. There is absolutely nothing preventing anyone from repackaging, porting, etc patches, and I wish people were doing more of it.
That would make UML more useful for more people on more systems, and would lessen my workload some.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id�66&opÌk
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
while testing laurents patch,
i have made the following interesting observation:
if i run a getpid-loop inside one uml, the other umls behaviour becomes quite sluggish - this doesnt seem to have a relation to laurents patch - i just recognized this for the first time, because i never did getpid-loops inside a uml. :)
ok - i would say:
yes - the system is heavily stressed - a busy uml makes the other one behave sluggish, too .....but.....
why don`t i see any sluggish behaviour on the HOST itself ?
want to reproduce?
compile this little program and transfer it to your uml-root_fs`s
--------------------------
int main(void)
{
int i;
for(i=0;i<1000000;i++)
getpid();
}
--------------------------
- let it run in one uml and the other uml(s) get sluggish - typing into the window and issuing commands gives very slow response
- on the HOST there is no noticeable performance loss - typing,echoing, ls -la, df -kl, ... all seems normal and "feels" quite good.
- stop the getpid program and start another cpu/io hog (e.g. "while true;do find /;done) inside one uml and compare that behaviour. other uml`s behave quite ok - the host, too. no sluggish behaviour.
maybe this behaviour is quite normal (ok - a getpid-loop is a worst case scenario) - but my system knowledge isnt good enough, to explain , whats going on here in detail.
is it, because the processing overhead of an uml is so high - so typing a char or issuing a command "costs" so much more in an uml, so that we just can "see" the performance drop here, and not on the host ?
regards
roland
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "roland" <[email protected]>
Cc: "Jeff Dike" <[email protected]>; <[email protected]>
Sent: Wednesday, May 19, 2004 8:17 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Quoted 11 lines · roland
Hi Laurent !
Great!
Thanks a lot for your work :)but i have a question:
old mail from jeff:
Quoted 3 lines
The patches below are from Laurent Vivier who didn't make them public. They add a new feature to ptrace on the host which cuts down on the number of context switches needed for a UML system call, plus makes UML use it
Quoted 5 lines
so - if your patch adds a new feature for ptrace on the HOST - shouldn`t we need TWO patches for 2.6 ? One patch for uml and one patch for the host ?
this one seems for uml only.
some of us already run uml 2.6(.x) on a 2.6.(.x) host and put their focus on the "new kernel" (me too).
OK, as I didn't find skas patch for 2.6 I thought it didn't exist... anyway I tried to port the 2.4 host sysemu patch to 2.6, find it attached. I never tested it, or compiled it ! I have no system with 2.6 kernel, and the only I386 system I have is very, very, very noisy... it's a good system only when it is switched off ;-) !
Quoted 7 lines
regards
rolandps:
since this would be the 2nd patch for the HOST (besides skas), would it make sense, to merge "skas" and "sysemu" into one common HOST-patch (if it has been tested and approved stable) ?
YES, I think... but Jeff is the boss ;-)
Quoted 15 lines
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "Jeff Dike" <[email protected]>
Cc: "roland" <[email protected]>; <[email protected]>
Sent: Wednesday, May 19, 2004 7:27 PM
Subject: Re: [uml-devel] [PATCH] host context switch reductionHi,
as it is a plebiscite ;-), find attached the patch for UML 2.6.6 and measurements I made on my poor netserver.
Quoted 13 lines
Laurent
Quoted 3 lines · Jeff Dike
Quoted 2 lines · roland
the question is:
is the "real world" performance benefit, uml get`s from this patch worth taking your time and is it implemented in a way, sothat
Quoted 6 lines
Quoted 1 line
uml maintainers are happy with that ?
The patch seems reasonable to me. I'd be happiest with Laurent pushing this into mainline himself.
Quoted 1 line
i cannot really estimate, what performance benefits your patch brings to uml in detail, but what i have seen so far, this
seems
Quoted 10 lines
Quoted 1 line
Quoted 1 line
quite worth doing the work. reducing context switches by 1/3 is a LOT, imho - and reducing the execution time of the
getpid-loop to
Quoted 8 lines
Quoted 1 line
nearly the half is quite impressive.
Yeah, but no real workloads do while(1)
getpid();The kernel build improvement is obviously smaller, but still worth having.
Quoted 1 line
are there any "con`s" that argue for that work _NOT_ being done ?
Quoted 65 lines
Quoted 4 lines
No. But testing, and happy reports to the appropriate mailing lists would help.
Jeff
--------------------------------------------------------------------------------
Quoted 54 lines
HP Netserver LH Pro bi-pro 200 MHz / 256 MB RAM
NATIF:
netserver:/usr/src# uname -a Linux netserver 2.4.24-sysemu #4 SMP Tue Feb 17 16:43:11 CET 2004 i686 GNU/Linuxnetserver:/usr/src# time ./getpid 1000000real 0m1.763s user 0m0.910s sys 0m0.860sreal 0m1.759s user 0m0.900s sys 0m0.870sreal 0m1.759s user 0m0.950s sys 0m0.800sUML with sysemu:
(none):~# uname -a Linux (none) 2.6.6-1um #10 Wed May 19 12:54:37 CEST 2004 i686 unknown(none):/mnt/usr/src# time ./getpid 1000000real 1m1.508s user 0m7.960s sys 0m53.450sreal 1m1.881s user 0m6.630s sys 0m55.240sreal 1m1.920s user 0m6.580s sys 0m55.340sUML w/o sysemu
real 1m32.833s user 0m7.610s sys 1m25.130sreal 1m32.921s user 0m7.890s sys 1m24.980sreal 1m33.493s user 0m8.010s sys 1m24.960s
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 4 lines · roland
if i run a getpid-loop inside one uml, the other uml
s behaviour becomes quite sluggish - this doesnt seem to have a relation to laurents patch - i just recognized this for the first time, because i never did getpid-loops inside a uml. :)
I would suspect this is due to the high dependency on context switching by UML in system calls.. but I do not have a clearcut explanation.
What can be said is that applications running on the host is by far not as dependent on context switching responsiveness to "feel good", and a CPU hog in one UML does not cause any noticeable amount of extra context switches, not much different from a CPU hog on the host in terms of performance.
Regards
Henrik
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 5 lines
What can be said is that applications running on the host is by far not as dependent on context switching responsiveness to "feel good", and a CPU hog in one UML does not cause any noticeable amount of extra context switches, not much different from a CPU hog on the host in terms of performance.
mh - maybe i don`t understand you completely right here - but - for me, most hogging processes in uml produces a gazillion of context-switches on the host.
if i run getpid on the host, i cannot see (vmstat) a noticeable raise in the amount of context switches.
if i run getpid inside an uml - i see cs on the host raise from ~400 to ~230000 !! the same getpid in a sysemu-patched uml/host results in a raise from ~400 to ~173000 cs - so this is noticeably better.
similar things happen with other "hogs" (idle state is always ~400 cs on host, cs rate is from vmstat output on the host) :
"while true; do /bin/true; done"
host: ~ 2000 uml: ~ 24000 uml-sysemu: ~ 17000
"while true; do find /; done"
host: up to ~ 24000 (alternating very much - didn`t measure average value) uml: up to ~ 60000 ( " ) uml-sysemu: up to ~ 48000 ( " )
"dd if=/dev/urandom of=/dev/null"
host: no noticeably differnce uml: ~ 16000
uml-sysemu ~ 8500
regards
roland
----- Original Message -----
From: "Henrik Nordstrom" <[email protected]>
To: "roland" <[email protected]>
Cc: "Laurent Vivier" <[email protected]>; "Jeff Dike" <[email protected]>; <[email protected]>
Sent: Thursday, May 20, 2004 4:12 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Quoted 10 lines · roland
Quoted 5 lines
if i run a getpid-loop inside one uml, the other uml
s behaviour becomes quite sluggish - this doesnt seem to have a relation to laurents patch - i just recognized this for the first time, because i never did getpid-loops inside a uml. :)I would suspect this is due to the high dependency on context switching by UML in system calls.. but I do not have a clearcut explanation.
Quoted 9 lines
What can be said is that applications running on the host is by far not as dependent on context switching responsiveness to "feel good", and a CPU hog in one UML does not cause any noticeable amount of extra context switches, not much different from a CPU hog on the host in terms of performance.
Regards
Henrik
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 2 lines · roland
mh - maybe i don`t understand you completely right here - but - for me, most hogging processes in uml produces a gazillion of context-switches on the host.
Only if the hoggin process is doing syscalls..
Quoted 2 lines
if i run getpid on the host, i cannot see (vmstat) a noticeable raise in the amount of context switches.
Correct, as normally there is no context switch in a syscall on the host.
Quoted 1 line
if i run getpid inside an uml - i see cs on the host raise from ~400 to ~230000 !!
Yes.
Quoted 2 lines
the same getpid in a sysemu-patched uml/host results in a raise from ~400 to ~173000 cs - so this is noticeably better.
Good.
Quoted 7 lines
similar things happen with other "hogs" (idle state is always ~400 cs on host, cs rate is from vmstat output on the host) :
"while true; do
/bin/true; done"host: ~ 2000 uml: ~ 24000 uml-sysemu: ~ 17000
This is not a CPU hog. This is a syscall hog. Not as intense as the getpid hog as there is more overhead, but still..
Quoted 1 line
"while true; do find /; done"
Same here..
Try
strace -f sh -c "while true; do /bin/true; done"
and you'll see the very high syscall rate in such hog.
Here is a silly example of a pure CPU hog:
perl -e 'while (1) {}'
Regards
Henrik
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Laurent Vivier wrote:
[..]
| netserver:/usr/src# uname -a
| Linux netserver 2.4.24-sysemu #4 SMP Tue Feb 17 16:43:11 CET 2004 i686 GNU/Linux
| | netserver:/usr/src# time ./getpid 1000000 | | real 0m1.763s | user 0m0.910s
Just want to comment on this.
Benchmarks of syscall performance on systems with TLS and recent glibc should not use getpid()... I don't know why, but on my system getpid alone is *very* fast.
(This is wrt the host. UML doesn't do TLS yet)
To benchmark simple syscalls you may get "real" (in the sense that you can compare the result values to UML/host systems) values with something like this:
int main()
{
~ long counter=0;
~ int a;
~ while( counter < 10000000)
~ {
~ counter++; ~ a=getppid(); ~ a=getgid();
~ }
}
Regards,
Nuno Silva
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFAq+JEOPig54MP17wRAvYlAJ9GlJTvsXpf3iuSN/dNtCak9bp09ACgiUnv N6ZJgS48H7OsQ3yjVhSh9qw=
=GBzz
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
hi,
i had a conversation with laurent regarding dynamic toggling of the new sysemu feature via procfs.
Quoted 7 lines
I think switching on/off sysemu is only needed if sysemu doesn't work correctly and in a debug context.
You must know that I don't want to make "cosmetic" work on sysemu (except correcting the strace problem) because : I don't use UML (I make this patch in a prospecting work), all my systems are powerpc based, and he acknoweledged, that it would be ok,
....
Quoted 1 line
Quoted 1 line
if not, via kernel-commandline-param, maybe this is even possible dynamically, from
inside uml ?
Quoted 2 lines
yes, from a
/proc/systoggle to set the internal "use_sysemu" variable to 0.
i think this would be useful to do better performance comparison and for determining the "real world" benefit of this patch (it`s like applying and releasing the brake)
echo 1 >/proc/sysemu - now sysemu is ON
benchmark your application/uml
echo 0 >/proc/sysemu - now sysemu is OFF
benchmark your application/uml again
compare
do you think this is useful ?
i would have already done this "cosmetic work", but for sure i need some help because i`m no good programmer (but i would like starting some kernelhacking :)
i have read some docs how procfs programming is being done and it seems reasonable simple for me.
so i want to hear your opinion first, before getting on your nerves with (really dumb kernel- hackernewbie) questions for a feature, nobody wants to have :)
roland
----- Original Message -----
From: "Laurent Vivier" <[email protected]>
To: "Jeff Dike" <[email protected]>
Cc: "roland" <[email protected]>; <[email protected]>
Sent: Wednesday, May 19, 2004 7:27 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Hi,
as it is a plebiscite ;-), find attached the patch for UML 2.6.6 and measurements I made on my poor netserver.
Laurent
Quoted 3 lines · Jeff Dike
Quoted 2 lines · roland
the question is:
is the "real world" performance benefit, uml get`s from this patch worth taking your time and is it implemented in a way, so
that
Quoted 7 lines
Quoted 1 line
uml maintainers are happy with that ?
The patch seems reasonable to me. I'd be happiest with Laurent pushing this into mainline himself.
Quoted 2 lines
i cannot really estimate, what performance benefits your patch brings to uml in detail, but what i have seen so far, this seems quite worth doing the work. reducing context switches by 1/3 is a LOT, imho - and reducing the execution time of the
getpid-loop to
Quoted 4 lines
Quoted 1 line
nearly the half is quite impressive.
Yeah, but no real workloads do while(1)
getpid();
Quoted 8 lines
The kernel build improvement is obviously smaller, but still worth having.
Quoted 1 line
are there any "con`s" that argue for that work _NOT_ being done ?
No. But testing, and happy reports to the appropriate mailing lists would help.
Jeff
--------------------------------------------------------------------------------
Quoted 46 lines
HP Netserver LH Pro bi-pro 200 MHz / 256 MB RAM
NATIF:
netserver:/usr/src# uname -a Linux netserver 2.4.24-sysemu #4 SMP Tue Feb 17 16:43:11 CET 2004 i686 GNU/Linuxnetserver:/usr/src# time ./getpid 1000000real 0m1.763s user 0m0.910s sys 0m0.860sreal 0m1.759s user 0m0.900s sys 0m0.870sreal 0m1.759s user 0m0.950s sys 0m0.800sUML with sysemu:
(none):~# uname -a Linux (none) 2.6.6-1um #10 Wed May 19 12:54:37 CEST 2004 i686 unknown(none):/mnt/usr/src# time ./getpid 1000000real 1m1.508s user 0m7.960s sys 0m53.450sreal 1m1.881s user 0m6.630s sys 0m55.240sreal 1m1.920s user 0m6.580s sys 0m55.340sUML w/o sysemu
real 1m32.833s user 0m7.610s sys 1m25.130s
Quoted 8 lines
real 1m32.921s user 0m7.890s sys 1m24.980sreal 1m33.493s user 0m8.010s sys 1m24.960s
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 2 lines · roland
i think this would be useful to do better performance comparison and for determining the "real world" benefit of this patch (it`s like applying and releasing the brake)
For a start there should be a boot option for this much like there is for most other host dependent options. When there is a boot option one could consider adding a proc entry but I don't see any real value for a UML proc entry for this, with the sole exception for benchmarking which is only marginally much harder with a boot option..
Regards
Henrik
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Hello Laurent,
Thanks you for the performance patches. I'm looking forwarding to testing them, but ran into a snag while patching 2.4.24-um.
http://perso.wanadoo.fr/laurent.vivier/UML/um-sysemu-2.4.24-1.patch
Looks like it's against 2.4.22. The patch is somewhat mangled, but once I get around the rejects, I still get...
Checking syscall emulation patch for ptrace...missing
Kernel panic: check_ptrace : child exited with status 0x100
In idle task - not syncing
...on a host that doesn't have the sysemu patch. It does run correctly on a host with the sysemu patch. I believe the 2.4-um sysemu patch needs updating, because a few months back when I tried your first set of patches I received the same thing.
Care to post a more recent 2.4-um sysemu patch for UML?
Thanks!
-Chris
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 10 lines · Christopher S. Aker
Hello Laurent,
Thanks you for the performance patches. I'm looking forwarding to testing them, but ran into a snag while patching 2.4.24-um.
http://perso.wanadoo.fr/laurent.vivier/UML/um-sysemu-2.4.24-1.patch
Looks like it's against 2.4.22. The patch is somewhat mangled, but once I get around the rejects, I still get...
It's effectively a patch for 2.4.22. Sorry. I correct the typo on the web page.
I create a new patch for 2.4.26 (do you really want 2.4.24 ???)
Quoted 13 lines
Checking syscall emulation patch for ptrace...missing
Kernel panic: check_ptrace : child exited with status 0x100In idle task - not syncing
...on a host that doesn't have the sysemu patch. It does run correctly on a host with the sysemu patch. I believe the 2.4-um sysemu patch needs updating, because a few months back when I tried your first set of patches I received the same thing.
Care to post a more recent 2.4-um sysemu patch for UML?
Thanks!
-Chris
Signature · 4 lines
Laurent Vivier
+------------------------------------------------+
"Any sufficiently advanced technology is
indistinguishable from magic." -- Arthur C. ClarkeQuoted 2 lines
It's effectively a patch for 2.4.22. Sorry. I correct the typo on the web page. I create a new patch for 2.4.26 (do you really want 2.4.24 ???)
2.4.26 would be great, although I'm using the 2.4.24-1um patch against a 2.4.26 tree, but the more up-to-date the better.
Thanks,
-Chris
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 6 lines · Christopher S. Aker
Quoted 2 lines
It's effectively a patch for 2.4.22. Sorry. I correct the typo on the web page. I create a new patch for 2.4.26 (do you really want 2.4.24 ???)
2.4.26 would be great, although I'm using the 2.4.24-1um patch against a 2.4.26 tree, but the more up-to-date the better.
Could you try this one, please ?
http://perso.wanadoo.fr/laurent.vivier/UML/um-sysemu-2.4.26-1.patch
Quoted 2 lines
Thanks,
-Chris
Signature · 4 lines
Laurent Vivier
+------------------------------------------------+
"Any sufficiently advanced technology is
indistinguishable from magic." -- Arthur C. ClarkeRe: [uml-devel] [PATCH] host context switch reduction Benchmarks
Using Mysql's "run-all-tests" as a benchmark, the sysemu patches provide about a 33% performance improvement over a "vanilla" UML+skas.
w/ sysemu:
real 13m57.353s user 2m17.370s sys 3m54.310s
w/o sysemu:
real 18m38.329s user 2m37.370s sys 6m3.040s
Mysql test results here:
http://www.theshore.net/~caker/uml/sysemu-benchmarks.txt
For a kernel compile, the improvement isn't as drastic -- but compiling spends most of it's time in user-space...
w/ sysemu:
real 5m15.182s user 4m22.470s sys 0m52.230s
w/o sysemu:
real 5m28.466s user 4m32.030s sys 0m55.370s
Nice stuff, thanks!
-Chris
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel