* [uml-devel] [PATCH] host context switch reduction
@ 2004-02-29 4:35 Jeff Dike
2004-02-29 16:48 ` BlaisorBlade
` (2 more replies)
0 siblings, 3 replies; 31+ messages in thread
From: Jeff Dike @ 2004-02-29 4:35 UTC (permalink / raw)
To: user-mode-linux-devel
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
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
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 4539 bytes --]
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)
[-- Attachment #3: y --]
[-- Type: text/plain, Size: 4124 bytes --]
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, "
^ permalink raw reply [flat|nested] 31+ messages in thread* Re: [uml-devel] [PATCH] host context switch reduction
2004-02-29 4:35 [uml-devel] [PATCH] host context switch reduction Jeff Dike
@ 2004-02-29 16:48 ` BlaisorBlade
2004-03-15 11:42 ` Sven 'Darkman' Michels
2004-05-17 20:08 ` roland
2 siblings, 0 replies; 31+ messages in thread
From: BlaisorBlade @ 2004-02-29 16:48 UTC (permalink / raw)
To: user-mode-linux-devel
Alle 05:35, domenica 29 febbraio 2004, Jeff Dike ha scritto:
> 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).
--
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-02-29 4:35 [uml-devel] [PATCH] host context switch reduction Jeff Dike
2004-02-29 16:48 ` BlaisorBlade
@ 2004-03-15 11:42 ` Sven 'Darkman' Michels
2004-03-15 19:13 ` Jeff Dike
2004-05-17 20:08 ` roland
2 siblings, 1 reply; 31+ messages in thread
From: Sven 'Darkman' Michels @ 2004-03-15 11:42 UTC (permalink / raw)
To: Jeff Dike; +Cc: user-mode-linux-devel
Jeff Dike wrote:
> 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..)
> 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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-03-15 11:42 ` Sven 'Darkman' Michels
@ 2004-03-15 19:13 ` Jeff Dike
0 siblings, 0 replies; 31+ messages in thread
From: Jeff Dike @ 2004-03-15 19:13 UTC (permalink / raw)
To: Sven 'Darkman' Michels; +Cc: user-mode-linux-devel
On Mon, Mar 15, 2004 at 12:42:33PM +0100, Sven 'Darkman' Michels wrote:
> 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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-02-29 4:35 [uml-devel] [PATCH] host context switch reduction Jeff Dike
2004-02-29 16:48 ` BlaisorBlade
2004-03-15 11:42 ` Sven 'Darkman' Michels
@ 2004-05-17 20:08 ` roland
2004-05-17 22:00 ` Laurent Vivier
2 siblings, 1 reply; 31+ messages in thread
From: roland @ 2004-05-17 20:08 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: LaurentVivier
hi !
has this / will this be ported to 2.6 ?
have there been made further performance comparisons ?
regards
roland
>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" <jdike@addtoit.com>
To: <user-mode-linux-devel@lists.sourceforge.net>
Sent: Sunday, February 29, 2004 6:35 AM
Subject: [uml-devel] [PATCH] 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
>
>
-------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-17 20:08 ` roland
@ 2004-05-17 22:00 ` Laurent Vivier
2004-05-17 22:22 ` roland
0 siblings, 1 reply; 31+ messages in thread
From: Laurent Vivier @ 2004-05-17 22:00 UTC (permalink / raw)
To: roland; +Cc: user-mode-linux-devel
[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]
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.
Le lun 17/05/2004 à 22:08, roland a écrit :
> hi !
> has this / will this be ported to 2.6 ?
> have there been made further performance comparisons ?
> regards
> roland
>
>
> >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" <jdike@addtoit.com>
> To: <user-mode-linux-devel@lists.sourceforge.net>
> Sent: Sunday, February 29, 2004 6:35 AM
> Subject: [uml-devel] [PATCH] 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
> >
> >
[-- Attachment #2: measure-getpid.txt --]
[-- Type: text/plain, Size: 1050 bytes --]
#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
^ permalink raw reply [flat|nested] 31+ messages in thread* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-17 22:00 ` Laurent Vivier
@ 2004-05-17 22:22 ` roland
2004-05-18 17:59 ` Jeff Dike
0 siblings, 1 reply; 31+ messages in thread
From: roland @ 2004-05-17 22:22 UTC (permalink / raw)
To: Laurent Vivier; +Cc: user-mode-linux-devel, Jeff Dike
> 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" <LaurentVivier@wanadoo.fr>
To: "roland" <for_spam@gmx.de>
Cc: <user-mode-linux-devel@lists.sourceforge.net>
Sent: Tuesday, May 18, 2004 12:00 AM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
> 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.
>
> Le lun 17/05/2004 à 22:08, roland a écrit :
> > hi !
> > has this / will this be ported to 2.6 ?
> > have there been made further performance comparisons ?
> > regards
> > roland
> >
> >
> > >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" <jdike@addtoit.com>
> > To: <user-mode-linux-devel@lists.sourceforge.net>
> > Sent: Sunday, February 29, 2004 6:35 AM
> > Subject: [uml-devel] [PATCH] 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
> > >
> > >
>
-------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-17 22:22 ` roland
@ 2004-05-18 17:59 ` Jeff Dike
2004-05-19 17:27 ` Laurent Vivier
0 siblings, 1 reply; 31+ messages in thread
From: Jeff Dike @ 2004-05-18 17:59 UTC (permalink / raw)
To: roland; +Cc: Laurent Vivier, user-mode-linux-devel
On Tue, May 18, 2004 at 12:22:45AM +0200, roland wrote:
> 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.
> 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.
> 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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-18 17:59 ` Jeff Dike
@ 2004-05-19 17:27 ` Laurent Vivier
2004-05-19 18:01 ` roland
` (3 more replies)
0 siblings, 4 replies; 31+ messages in thread
From: Laurent Vivier @ 2004-05-19 17:27 UTC (permalink / raw)
To: Jeff Dike; +Cc: roland, user-mode-linux-devel
[-- Attachment #1.1: Type: text/plain, Size: 1188 bytes --]
Hi,
as it is a plebiscite ;-), find attached the patch for UML 2.6.6 and
measurements I made on my poor netserver.
Laurent
Le mar 18/05/2004 à 19:59, Jeff Dike a écrit :
> On Tue, May 18, 2004 at 12:22:45AM +0200, roland wrote:
> > 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.
>
> > 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.
>
> > 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
[-- Attachment #1.2: measure-getpid-2.6.6.txt --]
[-- Type: text/plain, Size: 909 bytes --]
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
[-- Attachment #1.3: um-sysemu-2.6.6.patch --]
[-- Type: text/x-patch, Size: 4054 bytes --]
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);
[-- Attachment #2: Ceci est une partie de message numériquement signée. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 17:27 ` Laurent Vivier
@ 2004-05-19 18:01 ` roland
2004-05-19 18:17 ` Laurent Vivier
2004-05-19 22:40 ` Nuno Silva
` (2 subsequent siblings)
3 siblings, 1 reply; 31+ messages in thread
From: roland @ 2004-05-19 18:01 UTC (permalink / raw)
To: Laurent Vivier, Jeff Dike; +Cc: user-mode-linux-devel
Hi Laurent !
Great!
Thanks a lot for your work :)
but i have a question:
old mail from jeff:
>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" <LaurentVivier@wanadoo.fr>
To: "Jeff Dike" <jdike@addtoit.com>
Cc: "roland" <for_spam@gmx.de>; <user-mode-linux-devel@lists.sourceforge.net>
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
Le mar 18/05/2004 à 19:59, Jeff Dike a écrit :
> On Tue, May 18, 2004 at 12:22:45AM +0200, roland wrote:
> > 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.
>
> > 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.
>
> > 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
>
-------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 18:01 ` roland
@ 2004-05-19 18:17 ` Laurent Vivier
2004-05-19 19:39 ` roland
` (2 more replies)
0 siblings, 3 replies; 31+ messages in thread
From: Laurent Vivier @ 2004-05-19 18:17 UTC (permalink / raw)
To: roland; +Cc: Jeff Dike, user-mode-linux-devel
[-- Attachment #1.1: Type: text/plain, Size: 4096 bytes --]
Le mer 19/05/2004 à 20:01, roland a écrit :
> Hi Laurent !
> Great!
> Thanks a lot for your work :)
>
> but i have a question:
>
> old mail from jeff:
> >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).
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 ;-) !
> 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) ?
>
YES, I think... but Jeff is the boss ;-)
>
>
> ----- Original Message -----
> From: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
> To: "Jeff Dike" <jdike@addtoit.com>
> Cc: "roland" <for_spam@gmx.de>; <user-mode-linux-devel@lists.sourceforge.net>
> 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
>
> Le mar 18/05/2004 à 19:59, Jeff Dike a écrit :
> > On Tue, May 18, 2004 at 12:22:45AM +0200, roland wrote:
> > > 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.
> >
> > > 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.
> >
> > > 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
> >
>
[-- Attachment #1.2: host-sysemu-2.6.6.patch --]
[-- Type: text/x-patch, Size: 4884 bytes --]
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
[-- Attachment #2: Ceci est une partie de message numériquement signée. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 18:17 ` Laurent Vivier
@ 2004-05-19 19:39 ` roland
2004-05-19 19:49 ` Laurent Vivier
2004-05-19 23:54 ` Jeff Dike
2004-05-20 1:01 ` roland
2 siblings, 1 reply; 31+ messages in thread
From: roland @ 2004-05-19 19:39 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Jeff Dike, user-mode-linux-devel
>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" <LaurentVivier@wanadoo.fr>
To: "roland" <for_spam@gmx.de>
Cc: "Jeff Dike" <jdike@addtoit.com>; <user-mode-linux-devel@lists.sourceforge.net>
Sent: Wednesday, May 19, 2004 8:17 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Le mer 19/05/2004 à 20:01, roland a écrit :
> Hi Laurent !
> Great!
> Thanks a lot for your work :)
>
> but i have a question:
>
> old mail from jeff:
> >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).
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 ;-) !
> 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) ?
>
YES, I think... but Jeff is the boss ;-)
>
>
> ----- Original Message -----
> From: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
> To: "Jeff Dike" <jdike@addtoit.com>
> Cc: "roland" <for_spam@gmx.de>; <user-mode-linux-devel@lists.sourceforge.net>
> 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
>
> Le mar 18/05/2004 à 19:59, Jeff Dike a écrit :
> > On Tue, May 18, 2004 at 12:22:45AM +0200, roland wrote:
> > > 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.
> >
> > > 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.
> >
> > > 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
> >
>
-------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 19:39 ` roland
@ 2004-05-19 19:49 ` Laurent Vivier
2004-05-20 2:30 ` roland
0 siblings, 1 reply; 31+ messages in thread
From: Laurent Vivier @ 2004-05-19 19:49 UTC (permalink / raw)
To: roland; +Cc: user-mode-linux-devel
[-- Attachment #1: Type: text/plain, Size: 5599 bytes --]
In include/linux/ptrace.h ,
change
#define PTRACE_SCEMU 25
by
#define PTRACE_SCEMU 31
Le mer 19/05/2004 à 21:39, roland a écrit :
> >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" <LaurentVivier@wanadoo.fr>
> To: "roland" <for_spam@gmx.de>
> Cc: "Jeff Dike" <jdike@addtoit.com>; <user-mode-linux-devel@lists.sourceforge.net>
> Sent: Wednesday, May 19, 2004 8:17 PM
> Subject: Re: [uml-devel] [PATCH] host context switch reduction
>
>
> Le mer 19/05/2004 à 20:01, roland a écrit :
> > Hi Laurent !
> > Great!
> > Thanks a lot for your work :)
> >
> > but i have a question:
> >
> > old mail from jeff:
> > >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).
>
> 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 ;-) !
>
> > 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) ?
> >
>
> YES, I think... but Jeff is the boss ;-)
>
> >
> >
> > ----- Original Message -----
> > From: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
> > To: "Jeff Dike" <jdike@addtoit.com>
> > Cc: "roland" <for_spam@gmx.de>; <user-mode-linux-devel@lists.sourceforge.net>
> > 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
> >
> > Le mar 18/05/2004 à 19:59, Jeff Dike a écrit :
> > > On Tue, May 18, 2004 at 12:22:45AM +0200, roland wrote:
> > > > 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.
> > >
> > > > 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.
> > >
> > > > 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
> > >
> >
>
[-- Attachment #2: Ceci est une partie de message numériquement signée. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 19:49 ` Laurent Vivier
@ 2004-05-20 2:30 ` roland
2004-05-20 12:49 ` Laurent Vivier
0 siblings, 1 reply; 31+ messages in thread
From: roland @ 2004-05-20 2:30 UTC (permalink / raw)
To: Laurent Vivier; +Cc: user-mode-linux-devel, Jeff Dike, blaisorblade_spam
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/ ?
>in include/linux/ptrace.h ,
>change
>#define PTRACE_SCEMU 25
>by
>#define PTRACE_SCEMU 31
----- Original Message -----
From: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
To: "roland" <for_spam@gmx.de>
Cc: <user-mode-linux-devel@lists.sourceforge.net>
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-20 2:30 ` roland
@ 2004-05-20 12:49 ` Laurent Vivier
2004-05-23 0:42 ` [uml-devel] [PATCH] commandline switch for sysemu patch roland
2004-05-23 13:31 ` [uml-devel] [PATCH] host context switch reduction roland
0 siblings, 2 replies; 31+ messages in thread
From: Laurent Vivier @ 2004-05-20 12:49 UTC (permalink / raw)
To: roland; +Cc: user-mode-linux-devel, Jeff Dike, blaisorblade_spam
[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]
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
Le 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:
> 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/ ?
>
>
>
>
>
>
> >in include/linux/ptrace.h ,
> >change
> >#define PTRACE_SCEMU 25
> >by
> >#define PTRACE_SCEMU 31
>
>
>
>
>
> ----- Original Message -----
> From: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
> To: "roland" <for_spam@gmx.de>
> Cc: <user-mode-linux-devel@lists.sourceforge.net>
> Sent: Wednesday, May 19, 2004 9:49 PM
> Subject: Re: [uml-devel] [PATCH] host context switch reduction
>
>
[-- Attachment #2: Ceci est une partie de message numériquement signée. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread
* [uml-devel] [PATCH] commandline switch for sysemu patch
2004-05-20 12:49 ` Laurent Vivier
@ 2004-05-23 0:42 ` roland
2004-05-23 13:31 ` [uml-devel] [PATCH] host context switch reduction roland
1 sibling, 0 replies; 31+ messages in thread
From: roland @ 2004-05-23 0:42 UTC (permalink / raw)
To: Laurent Vivier; +Cc: user-mode-linux-devel, Jeff Dike, blaisorblade_spam, uml
[-- Attachment #1: Type: text/plain, Size: 2615 bytes --]
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 don`t specify it, uml doesn`t 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. :)
>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
>
>Le 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:
> 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/ ?
>
>
>
>
>
>
> >in include/linux/ptrace.h ,
> >change
> >#define PTRACE_SCEMU 25
> >by
> >#define PTRACE_SCEMU 31
>
>
>
>
>
> ----- Original Message -----
> From: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
> To: "roland" <for_spam@gmx.de>
> Cc: <user-mode-linux-devel@lists.sourceforge.net>
> Sent: Wednesday, May 19, 2004 9:49 PM
> Subject: Re: [uml-devel] [PATCH] host context switch reduction
>
[-- Attachment #2: sysemu_cmdline.patch --]
[-- Type: application/octet-stream, Size: 2294 bytes --]
--- linux-2.6.6/arch/um/kernel/process.c 2004-07-07 06:21:19.144801856 +0200
+++ linux-2.6.6/arch/um/kernel/process.c.sysemu 2004-07-07 06:21:09.136323376 +0200
@@ -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;
^ permalink raw reply [flat|nested] 31+ messages in thread* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-20 12:49 ` Laurent Vivier
2004-05-23 0:42 ` [uml-devel] [PATCH] commandline switch for sysemu patch roland
@ 2004-05-23 13:31 ` roland
1 sibling, 0 replies; 31+ messages in thread
From: roland @ 2004-05-23 13:31 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: Laurent Vivier
hi,
i know - i`m an awful bad programmer - but perhaps someone can help me implementing /proc/sysemu ?
that`s 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 used
arch/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 shouldn`t start with such complex things -
but i don`t like to program the tutorials written down in a c-programming book :)
----- Original Message -----
From: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
To: "roland" <for_spam@gmx.de>
Cc: <user-mode-linux-devel@lists.sourceforge.net>; "Jeff Dike" <jdike@addtoit.com>; <blaisorblade_spam@yahoo.it>
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 18:17 ` Laurent Vivier
2004-05-19 19:39 ` roland
@ 2004-05-19 23:54 ` Jeff Dike
2004-05-20 1:01 ` roland
2 siblings, 0 replies; 31+ messages in thread
From: Jeff Dike @ 2004-05-19 23:54 UTC (permalink / raw)
To: Laurent Vivier; +Cc: roland, user-mode-linux-devel
LaurentVivier@wanadoo.fr said:
> Le mer 19/05/2004 à 20:01, roland a écrit :
> > 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_id66&opÌk
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 18:17 ` Laurent Vivier
2004-05-19 19:39 ` roland
2004-05-19 23:54 ` Jeff Dike
@ 2004-05-20 1:01 ` roland
2004-05-20 14:12 ` Henrik Nordstrom
2 siblings, 1 reply; 31+ messages in thread
From: roland @ 2004-05-20 1:01 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Jeff Dike, 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 uml`s behaviour becomes
quite sluggish - this doesn`t 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 isn`t good enough, to explain , what`s 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" <LaurentVivier@wanadoo.fr>
To: "roland" <for_spam@gmx.de>
Cc: "Jeff Dike" <jdike@addtoit.com>; <user-mode-linux-devel@lists.sourceforge.net>
Sent: Wednesday, May 19, 2004 8:17 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Le mer 19/05/2004 à 20:01, roland a écrit :
> Hi Laurent !
> Great!
> Thanks a lot for your work :)
>
> but i have a question:
>
> old mail from jeff:
> >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).
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 ;-) !
> 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) ?
>
YES, I think... but Jeff is the boss ;-)
>
>
> ----- Original Message -----
> From: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
> To: "Jeff Dike" <jdike@addtoit.com>
> Cc: "roland" <for_spam@gmx.de>; <user-mode-linux-devel@lists.sourceforge.net>
> 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
>
> Le mar 18/05/2004 à 19:59, Jeff Dike a écrit :
> > On Tue, May 18, 2004 at 12:22:45AM +0200, roland wrote:
> > > 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.
> >
> > > 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.
> >
> > > 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
> >
>
-------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-20 1:01 ` roland
@ 2004-05-20 14:12 ` Henrik Nordstrom
2004-05-20 15:27 ` roland
0 siblings, 1 reply; 31+ messages in thread
From: Henrik Nordstrom @ 2004-05-20 14:12 UTC (permalink / raw)
To: roland; +Cc: Laurent Vivier, Jeff Dike, user-mode-linux-devel
On Thu, 20 May 2004, roland wrote:
> if i run a getpid-loop inside one uml, the other uml`s behaviour becomes
> quite sluggish - this doesn`t 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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-20 14:12 ` Henrik Nordstrom
@ 2004-05-20 15:27 ` roland
2004-05-20 15:35 ` Henrik Nordstrom
0 siblings, 1 reply; 31+ messages in thread
From: roland @ 2004-05-20 15:27 UTC (permalink / raw)
To: Henrik Nordstrom; +Cc: Laurent Vivier, Jeff Dike, user-mode-linux-devel
> 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" <uml@hno.marasystems.com>
To: "roland" <for_spam@gmx.de>
Cc: "Laurent Vivier" <LaurentVivier@wanadoo.fr>; "Jeff Dike" <jdike@addtoit.com>; <user-mode-linux-devel@lists.sourceforge.net>
Sent: Thursday, May 20, 2004 4:12 PM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
> On Thu, 20 May 2004, roland wrote:
>
> > if i run a getpid-loop inside one uml, the other uml`s behaviour becomes
> > quite sluggish - this doesn`t 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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-20 15:27 ` roland
@ 2004-05-20 15:35 ` Henrik Nordstrom
0 siblings, 0 replies; 31+ messages in thread
From: Henrik Nordstrom @ 2004-05-20 15:35 UTC (permalink / raw)
To: roland; +Cc: Henrik Nordstrom, Laurent Vivier, Jeff Dike,
user-mode-linux-devel
On Thu, 20 May 2004, roland wrote:
> 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..
> 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.
> if i run getpid inside an uml - i see cs on the host raise from ~400 to ~230000 !!
Yes.
> the same getpid in a sysemu-patched uml/host results in a raise from ~400 to ~173000 cs -
> so this is noticeably better.
Good.
> 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..
> "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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 17:27 ` Laurent Vivier
2004-05-19 18:01 ` roland
@ 2004-05-19 22:40 ` Nuno Silva
2004-05-20 18:28 ` roland
2004-05-27 6:16 ` Christopher S. Aker
3 siblings, 0 replies; 31+ messages in thread
From: Nuno Silva @ 2004-05-19 22:40 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Jeff Dike, roland, 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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 17:27 ` Laurent Vivier
2004-05-19 18:01 ` roland
2004-05-19 22:40 ` Nuno Silva
@ 2004-05-20 18:28 ` roland
2004-05-20 18:47 ` Henrik Nordstrom
2004-05-27 6:16 ` Christopher S. Aker
3 siblings, 1 reply; 31+ messages in thread
From: roland @ 2004-05-20 18:28 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: Jeff Dike
hi,
i had a conversation with laurent regarding dynamic toggling of the new sysemu feature via procfs.
>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,
....
>> if not, via kernel-commandline-param, maybe this is even possible dynamically, from
inside uml ?
>
>yes, from a /proc/sys toggle 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" <LaurentVivier@wanadoo.fr>
To: "Jeff Dike" <jdike@addtoit.com>
Cc: "roland" <for_spam@gmx.de>; <user-mode-linux-devel@lists.sourceforge.net>
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
Le mar 18/05/2004 à 19:59, Jeff Dike a écrit :
> On Tue, May 18, 2004 at 12:22:45AM +0200, roland wrote:
> > 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.
>
> > 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.
>
> > 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
>
-------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-20 18:28 ` roland
@ 2004-05-20 18:47 ` Henrik Nordstrom
0 siblings, 0 replies; 31+ messages in thread
From: Henrik Nordstrom @ 2004-05-20 18:47 UTC (permalink / raw)
To: roland; +Cc: user-mode-linux-devel, Jeff Dike
On Thu, 20 May 2004, roland wrote:
> 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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
2004-05-19 17:27 ` Laurent Vivier
` (2 preceding siblings ...)
2004-05-20 18:28 ` roland
@ 2004-05-27 6:16 ` Christopher S. Aker
2004-05-27 8:22 ` Laurent Vivier
3 siblings, 1 reply; 31+ messages in thread
From: Christopher S. Aker @ 2004-05-27 6:16 UTC (permalink / raw)
To: Laurent Vivier; +Cc: 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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [uml-devel] [PATCH] host context switch reduction
@ 2004-05-20 2:34 roland
0 siblings, 0 replies; 31+ messages in thread
From: roland @ 2004-05-20 2:34 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Jeff Dike, user-mode-linux-devel, blaisorblade_spam
ohh..
that mail was still open in the background....waiting to be send :)
i recognized that blaisorblades skas-patch doesn`t seem to activate
skas in .config by default, so my uml`s accidently ran in TT Mode.
Recompiled the HOST and the effect i mentioned doesn`t happen with skas.
btw: the getpid-loop is more than THREE TIMES faster with skas.
i hope skas will do it`s way into the mainstream-kernel, so TT is obsolete soon.
skas should be a MUST for uml :)
jeff - can we expect this happening soon, or doesn`t that happen before skas4 ?
suse-distro has skas in their kernels - in 9.0 and also in 9.1 - so i would think, skas
is ready for the kernel.....but....linus decides :)
so - that`s enough mails.
sorry for that "spamming" today. i promise to reduce my output :)
regards
roland
----- Original Message -----
From: "roland" <for_spam@gmx.de>
To: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
Cc: "Jeff Dike" <jdike@addtoit.com>; <user-mode-linux-devel@lists.sourceforge.net>
Sent: Thursday, May 20, 2004 3:01 AM
Subject: Re: [uml-devel] [PATCH] host context switch reduction
> while testing laurents patch,
> i have made the following interesting observation:
>
> if i run a getpid-loop inside one uml, the other uml`s behaviour becomes
> quite sluggish - this doesn`t 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 isn`t good enough, to explain , what`s 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" <LaurentVivier@wanadoo.fr>
> To: "roland" <for_spam@gmx.de>
> Cc: "Jeff Dike" <jdike@addtoit.com>; <user-mode-linux-devel@lists.sourceforge.net>
> Sent: Wednesday, May 19, 2004 8:17 PM
> Subject: Re: [uml-devel] [PATCH] host context switch reduction
>
>
> Le mer 19/05/2004 à 20:01, roland a écrit :
> > Hi Laurent !
> > Great!
> > Thanks a lot for your work :)
> >
> > but i have a question:
> >
> > old mail from jeff:
> > >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).
>
> 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 ;-) !
>
> > 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) ?
> >
>
> YES, I think... but Jeff is the boss ;-)
>
> >
> >
> > ----- Original Message -----
> > From: "Laurent Vivier" <LaurentVivier@wanadoo.fr>
> > To: "Jeff Dike" <jdike@addtoit.com>
> > Cc: "roland" <for_spam@gmx.de>; <user-mode-linux-devel@lists.sourceforge.net>
> > 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
> >
> > Le mar 18/05/2004 à 19:59, Jeff Dike a écrit :
> > > On Tue, May 18, 2004 at 12:22:45AM +0200, roland wrote:
> > > > 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.
> > >
> > > > 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.
> > >
> > > > 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
> > >
> >
>
-------------------------------------------------------
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2004-05-28 4:52 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-29 4:35 [uml-devel] [PATCH] host context switch reduction Jeff Dike
2004-02-29 16:48 ` BlaisorBlade
2004-03-15 11:42 ` Sven 'Darkman' Michels
2004-03-15 19:13 ` Jeff Dike
2004-05-17 20:08 ` roland
2004-05-17 22:00 ` Laurent Vivier
2004-05-17 22:22 ` roland
2004-05-18 17:59 ` Jeff Dike
2004-05-19 17:27 ` Laurent Vivier
2004-05-19 18:01 ` roland
2004-05-19 18:17 ` Laurent Vivier
2004-05-19 19:39 ` roland
2004-05-19 19:49 ` Laurent Vivier
2004-05-20 2:30 ` roland
2004-05-20 12:49 ` Laurent Vivier
2004-05-23 0:42 ` [uml-devel] [PATCH] commandline switch for sysemu patch roland
2004-05-23 13:31 ` [uml-devel] [PATCH] host context switch reduction roland
2004-05-19 23:54 ` Jeff Dike
2004-05-20 1:01 ` roland
2004-05-20 14:12 ` Henrik Nordstrom
2004-05-20 15:27 ` roland
2004-05-20 15:35 ` Henrik Nordstrom
2004-05-19 22:40 ` Nuno Silva
2004-05-20 18:28 ` roland
2004-05-20 18:47 ` Henrik Nordstrom
2004-05-27 6:16 ` Christopher S. Aker
2004-05-27 8:22 ` Laurent Vivier
2004-05-27 9:25 ` Christopher S. Aker
2004-05-27 11:50 ` Laurent Vivier
2004-05-28 4:53 ` [uml-devel] [PATCH] host context switch reduction Benchmarks Christopher S. Aker
-- strict thread matches above, loose matches on Subject: below --
2004-05-20 2:34 [uml-devel] [PATCH] host context switch reduction roland
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.