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
Subject: Re: [uml-devel] [PATCH] host context switch reduction
Date: Wed, 19 May 2004 20:17:43 +0200 [thread overview]
Message-ID: <1084990661.2255.28.camel@chartreuse> (raw)
In-Reply-To: <012201c43dcb$402ca6a0$2000000a@schlepptopp>
[-- 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 --]
next prev parent reply other threads:[~2004-05-19 18:17 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
2004-05-19 18:01 ` roland
2004-05-19 18:17 ` Laurent Vivier [this message]
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=1084990661.2255.28.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 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.