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
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Date: Wed, 19 May 2004 19:27:36 +0200 [thread overview]
Message-ID: <1084987654.2250.4.camel@chartreuse> (raw)
In-Reply-To: <20040518175904.GB29114@ccure.user-mode-linux.org>
[-- 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 --]
next prev parent reply other threads:[~2004-05-19 17:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1084987654.2250.4.camel@chartreuse \
--to=laurentvivier@wanadoo.fr \
--cc=for_spam@gmx.de \
--cc=jdike@addtoit.com \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox