Recent patches of note
Subsystems (2)
I'd like to call attention to some recent patches that may be of interest to people before they hit mainline. These are all on my incremental patches page, http://user-mode-linux.sf.net/patches.html
First, sched-starve (http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.12-rc6-mm1/patches/sched-starve)
This fixes a timer initialization botch which resulted in soft lockup warnings in recent kernels, total non-responsiveness (i.e. nothing else would be scheduled) under any workload which avoided idling the kernel, and may be responsible for the load average >= 1 problem.
I don't see that last here for some reason, so I'd like some confirmation (or not) that this patch fixes that.
Second, I implemented soft interrupts, which reimplements interrupt enabling and disabling with a flag rather than with sigprocmask. This cuts down hugely on the number of system calls that UML makes, resulting in a very noticable performance increase. This patch, plus the other system call reducing patches which immediately follow it, speed up my kernel builds by 20-25%. By far the largest piece of this is softints, although skas-no-flush-kernel also is noticable.
I'd like people to check out softints, at least, and report any problems. It's running fine here, but interrupt handling is a sensitive area, so I'd like to know people are running it without problems before pushing it to mainline.
Jeff
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 14 lines · Jeff Dike
I'd like to call attention to some recent patches that may be of interest to people before they hit mainline. These are all on my incremental patches page, http://user-mode-linux.sf.net/patches.html
First, sched-starve (http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.12-rc6-mm1/patches/sched-starve)
This fixes a timer initialization botch which resulted in soft lockup warnings in recent kernels, total non-responsiveness (i.e. nothing else would be scheduled) under any workload which avoided idling the kernel, and may be responsible for the load average >= 1 problem.
I don't see that last here for some reason, so I'd like some confirmation (or not) that this patch fixes that.
Quoted 7 lines
Second, I implemented soft interrupts, which reimplements interrupt enabling and disabling with a flag rather than with sigprocmask. This cuts down hugely on the number of system calls that UML makes, resulting in a very noticable performance increase. This patch, plus the other system call reducing patches which immediately follow it, speed up my kernel builds by 20-25%. By far the largest piece of this is softints, although skas-no-flush-kernel also is noticable.
Great!
Quoted 7 lines
I'd like people to check out softints, at least, and report any problems. It's running fine here, but interrupt handling is a sensitive area, so I'd like to know people are running it without problems before pushing it to mainline.
Jeff
Currently my time is *very* limited, so I can't test. Reading the patches only the one that makes me worry is "dont-save-fpregs".
To not save fpregs on every syscall or interrupt is O.K.
But you also have to modify signal-handling, that currently relies on fpregs being saved. And you have to save and restore fpregs in switch_to for SKAS3 and also for SKAS0, if processes share the same mm. Then, I think special handling is needed for the fpregs in copy_thread and probably in execve also.
Bodo
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 8 lines · Bodo Stroesser
Reading the patches
only the one that makes me worry is "dont-save-fpregs".
To not save fpregs on every syscall or interrupt is O.K.
But you also have to modify signal-handling, that currently relies on fpregs being saved. And you have to save and restore fpregs inswitch_tofor SKAS3 and also for SKAS0, if processes share the same mm. Then, I think special handling is needed for the fpregs incopy_threadand probably in execve also.
Good points, I'll fix things accordingly.
Jeff
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 2 lines · Jeff Dike
I'll fix things accordingly.
Could you please make handling in switch_to subarch-specific, e.g. in arch_switch_to?
s390 might have some special handling for fpregs and debug-regs in a single syscall.
Bodo
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 10 lines · Bodo Stroesser
Quoted 2 lines · Jeff Dike
I'll fix things accordingly.
Could you please make handling in
switch_tosubarch-specific, e.g. inarch_switch_to?
s390 might have some special handling for fpregs and debug-regs in a single syscall.Bodo
Oh, I guess I forgot to add ptrace to the list of changes. If a debugger in UML wants to read childs fpregs via ptrace while UML runs SKAS0 and ptraced child doesn't share it's mm, fpregs need to be read before they can be given to the debugger.
Bodo
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 5 lines · Bodo Stroesser
Quoted 1 line · Jeff Dike
I'll fix things accordingly.
Could you please make handling in
switch_tosubarch-specific, e.g. inarch_switch_to?
arch_switch already exists (wasn't used for SKAS). About improving it and making it more "general-purpose" (I've written this for the TLS code needs), could you have a look to the attached patches? do_fork-* is another thing (a cleanup discussed some time ago with Jeff) but may be needed to apply the second.
Quoted 2 lines
s390 might have some special handling for fpregs and debug-regs in a single syscall.
Signature · 3 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!". Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894) http://www.user-mode-linux.org/~blaisorblade
Call arch_switch also in switch_to_skas, even if it's a no-op for that case (and mark this in the comment).
Also, arch_switch for TT mode is actually useless when the PT proxy (a complicate debugging instrumentation for TT mode) is not enabled. In fact, it only calls update_debugregs, which checks debugregs_seq against seq (to check if the registers are up-to-date - seq here means a "version number" of the registers).
If the ptrace proxy is not enabled, debugregs_seq always stays 0 and update_debugregs will be a no-op. So, optimize this out (the compiler can't do it).
Also, I've been disappointed by the fact that it would make a lot of sense if, after calling a successful update_debugregs(current->thread.arch.debugregs_seq), current->thread.arch.debugregs_seq were updated with the new debugregs_seq. But this is not done. Is this a bug or a feature? For all purposes, it seems a bug (otherwise the whole mechanism does not make sense, which is also a possibility to check), which causes some performance only problems (not correctness), since we write_debugregs when not needed.
---
linux-2.6.git-paolo/arch/um/include/kern_util.h | 5 ++++- linux-2.6.git-paolo/arch/um/include/sysdep-i386/ptrace.h | 5 +++++ linux-2.6.git-paolo/arch/um/kernel/skas/process_kern.c | 4 +++- linux-2.6.git-paolo/arch/um/kernel/tt/process_kern.c | 13 +++++++++++-- linux-2.6.git-paolo/arch/um/sys-i386/ptrace.c | 4 ++-- linux-2.6.git-paolo/arch/um/sys-i386/ptrace_user.c | 10 +++++++++- 6 files changed, 34 insertions(+), 7 deletions(-)
arch/um/include/sysdep-i386/ptrace.h renamed from arch/um/include/sysdep-i386/ptrace.h~uml-clean-arch_switch +5 -0
@@ -12,7 +12,12 @@#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))#define MAX_REG_OFFSET (UM_FRAME_SIZE) +#ifdef UML_CONFIG_PT_PROXY extern void update_debugregs (int seq); +#else +static inline void update_debugregs (int seq) {} +#endif +/* syscall emulation path in ptrace */
arch/um/kernel/skas/process_kern.c renamed from arch/um/kernel/skas/process_kern.c~uml-clean-arch_switch +3 -1
@@ -41,10 +41,12 @@ void *switch_to_skas(void *prev, void *nswitch_threads (&from->thread.mode.skas.switch_buf, to->thread.mode.skas.switch_buf); +arch_switch (current->thread.prev_sched, current); +if (current->pid ==0 )switch_timers (1 ); -return (current->thread.prev_sched); +return current->thread.prev_sched; }extern void schedule_tail (struct task_struct *prev);
arch/um/sys-i386/ptrace.c renamed from arch/um/sys-i386/ptrace.c~uml-clean-arch_switch +2 -2
@@ -14,9 +14,9 @@#include "sysdep/sigcontext.h" #include "sysdep/sc.h" -void arch_switch (void ) +void arch_switch (struct task_struct *from,struct task_struct *to) { -update_debugregs (current->thread.arch.debugregs_seq); +CHOOSE_MODE (update_debugregs (to->thread.arch.debugregs_seq),0 ); }int is_syscall (unsigned long addr)
arch/um/sys-i386/ptrace_user.c renamed from arch/um/sys-i386/ptrace_user.c~uml-clean-arch_switch +9 -1
@@ -14,6 +14,7 @@#include "sysdep/thread.h" #include "user.h" #include "os.h" +#include "uml-config.h" int ptrace_getregs (long pid,unsigned long *regs_out) {
@@ -43,6 +44,7 @@ int ptrace_setfpregs(long pid, unsignedreturn 0 ; } +/* All the below stuff is of interest for TT mode only */ static void write_debugregs (int pid,unsigned long *regs) {struct user *dummy;
@@ -75,7 +77,6 @@ static void read_debugregs(int pid, unsi/* Accessed only by the tracing thread */ static unsigned long kernel_debugregs[8 ] = { [0 ...7 ] =0 }; -static int debugregs_seq =0 ;void arch_enter_kernel (void *task,int pid) {
@@ -89,6 +90,11 @@ void arch_leave_kernel(void *task, int pwrite_debugregs (pid,TASK_DEBUGREGS (task)); } +#ifdef UML_CONFIG_PT_PROXY +/* Accessed only by the tracing thread */ +static int debugregs_seq =0 ; + +/* Only called by the ptrace proxy */ void ptrace_pokeuser (unsigned long addr,unsigned long data) { if((addr < offsetof(struct user, u_debugreg[0])) ||
@@ -109,6 +115,7 @@ static void update_debugregs_cb(void *arwrite_debugregs (pid, kernel_debugregs); } +/* Optimized out in its header when not defined */ void update_debugregs (int seq) {int me;
@@ -118,6 +125,7 @@ void update_debugregs(int seq) me =os_getpid (); initial_thread_cb(update_debugregs_cb, &me); } +#endif /* * Overrides for Emacs so that we follow Linus's tabbing style.
arch/um/include/kern_util.h renamed from arch/um/include/kern_util.h~uml-clean-arch_switch +4 -1
@@ -107,7 +107,10 @@ extern void *get_current(void);extern struct task_struct *get_task (int pid,int require);extern void machine_halt (void );extern int is_syscall (unsigned long addr); -extern void arch_switch (void ); + +struct task_struct ; +extern void arch_switch (struct task_struct *from,struct task_struct *to); +extern void free_irq (unsigned int ,void *);extern int um_in_interrupt (void );extern int cpu (void );
arch/um/kernel/tt/process_kern.c renamed from arch/um/kernel/tt/process_kern.c~uml-clean-arch_switch +11 -2
@@ -55,6 +55,13 @@ void *switch_to_tt(void *prev, void *nex c =0 ;set_current (to); +/* Notice that here we "up" the semaphore on which "to" is waiting, and +* below (the read) we wait on this semaphore (which is implemented by +* switch_pipe) and go sleeping. Thus, after that, we have resumed in +* "to", and can't use any more the value of "from" (which is outdated), +* nor the value in "to" (since it was the task which stole us the CPU, +* which we don't care about). */ + err =os_write_file (to->thread.mode.tt.switch_pipe[1 ], &c,sizeof (c));if (err !=sizeof (c))panic ("write of switch_pipe failed, err = %d" , -err);
@@ -81,12 +88,12 @@ void *switch_to_tt(void *prev, void *nexchange_sig (SIGALRM , alrm);change_sig (SIGPROF , prof); -arch_switch (); +arch_switch (prev_sched, current);flush_tlb_all ();local_irq_restore (flags); -return (current->thread.prev_sched); +return prev_sched; }void release_thread_tt (struct task_struct *task)
@@ -147,6 +154,8 @@ static void new_thread_handler(int sig)set_cmdline ("(kernel thread)" );change_sig (SIGUSR1 ,1 ); +/* XXX: This is bogus, it's already done in local_irq_enable. Or does +* ordering matters? */ change_sig (SIGVTALRM ,1 );change_sig (SIGPROF ,1 );local_irq_enable ();
_
Fix the do_fork calling convention: normal arch pass the regs and the new sp value to do_fork instead of NULL.
Currently the arch-independent code ignores these values, while the UML code (actually it's copy_thread) gets the right values by itself.
With this patch, things are fixed up.
Low-priority.
---
linux-2.6.git-paolo/arch/um/kernel/process_kern.c | 5 ++- linux-2.6.git-paolo/arch/um/kernel/skas/process_kern.c | 13 ---------- linux-2.6.git-paolo/arch/um/kernel/syscall_kern.c | 19 +++----------- linux-2.6.git-paolo/arch/um/kernel/tt/process_kern.c | 15 +---------- linux-2.6.git-paolo/arch/um/sys-i386/syscalls.c | 22 ++--------------- linux-2.6.git-paolo/arch/um/sys-x86_64/syscalls.c | 22 ++--------------- 6 files changed, 17 insertions(+), 79 deletions(-)
arch/um/sys-i386/syscalls.c renamed from arch/um/sys-i386/syscalls.c~uml-do_fork-param-cleanup +3 -19
@@ -69,15 +69,10 @@ long sys_clone(unsigned long clone_flags {long ret; -/* XXX: normal arch do here this pass, and also pass the regs to -* do_fork, instead of NULL. Currently the arch-independent code -* ignores these values, while the UML code (actually it's -* copy_thread) does the right thing. But this should change, -probably. */ -/*if (!newsp) -newsp = UPT_SP(current->thread.regs);*/ +if (!newsp) + newsp =UPT_SP (¤t->thread.regs.regs); current->thread.forking =1 ; - ret =do_fork (clone_flags, newsp,NULL ,0 , parent_tid, child_tid); + ret =do_fork (clone_flags, newsp, ¤t->thread.regs,0 , parent_tid, child_tid); current->thread.forking =0 ;return (ret); }
@@ -197,14 +192,3 @@ long sys_sigaction(int sig, const structreturn ret; } - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/kernel/tt/process_kern.c renamed from arch/um/kernel/tt/process_kern.c~uml-do_fork-param-cleanup +2 -13
@@ -266,8 +266,8 @@ int copy_thread_tt(int nr, unsigned long }if (current->thread.forking){ -sc_to_sc (UPT_SC (&p->thread.regs.regs), -UPT_SC (¤t->thread.regs.regs)); +sc_to_sc (UPT_SC (&p->thread.regs.regs), +UPT_SC (®s->regs));SC_SET_SYSCALL_RETURN (UPT_SC (&p->thread.regs.regs),0 );if (sp !=0 )SC_SP (UPT_SC (&p->thread.regs.regs)) = sp; }
@@ -459,14 +459,3 @@ int is_valid_pid(int pid)read_unlock (&tasklist_lock);return (0 ); } - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/kernel/skas/process_kern.c renamed from arch/um/kernel/skas/process_kern.c~uml-do_fork-param-cleanup +1 -12
@@ -107,7 +107,7 @@ int copy_thread_skas(int nr, unsigned loif (current->thread.forking){memcpy (&p->thread.regs.regs.skas, - ¤t->thread.regs.regs.skas, + ®s->regs.skas,sizeof (p->thread.regs.regs.skas));REGS_SET_SYSCALL_RETURN (p->thread.regs.regs.skas.regs,0 );if (sp !=0 )REGS_SP (p->thread.regs.regs.skas.regs) = sp;
@@ -196,14 +196,3 @@ int thread_pid_skas(struct task_struct *#warning Need to look up userspace_pid by cpureturn (userspace_pid[0 ]); } - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/kernel/syscall_kern.c renamed from arch/um/kernel/syscall_kern.c~uml-do_fork-param-cleanup +5 -14
@@ -31,7 +31,8 @@ long sys_fork(void)long ret; current->thread.forking =1 ; - ret =do_fork (SIGCHLD ,0 ,NULL ,0 ,NULL ,NULL ); + ret =do_fork (SIGCHLD ,UPT_SP (¤t->thread.regs.regs), + ¤t->thread.regs,0 ,NULL ,NULL ); current->thread.forking =0 ;return (ret); }
@@ -41,8 +42,9 @@ long sys_vfork(void)long ret; current->thread.forking =1 ; - ret =do_fork (CLONE_VFORK |CLONE_VM |SIGCHLD ,0 ,NULL ,0 ,NULL , -NULL ); + ret =do_fork (CLONE_VFORK |CLONE_VM |SIGCHLD , +UPT_SP (¤t->thread.regs.regs), ¤t->thread.regs,0 , +NULL ,NULL ); current->thread.forking =0 ;return (ret); }
@@ -162,14 +164,3 @@ int next_syscall_index(int limit)spin_unlock (&syscall_lock);return (ret); } - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
arch/um/kernel/process_kern.c renamed from arch/um/kernel/process_kern.c~uml-do_fork-param-cleanup +3 -2
@@ -95,8 +95,9 @@ int kernel_thread(int (*fn)(void *), voi current->thread.request.u.thread.proc = fn; current->thread.request.u.thread.arg = arg; - pid =do_fork (CLONE_VM |CLONE_UNTRACED | flags,0 ,NULL ,0 ,NULL , -NULL ); + pid =do_fork (CLONE_VM |CLONE_UNTRACED | flags, +0 , ¤t->thread.regs,0 , +NULL ,NULL );if (pid <0 )panic ("do_fork failed in kernel_thread, errno = %d" , pid);return (pid);
arch/um/sys-x86_64/syscalls.c renamed from arch/um/sys-x86_64/syscalls.c~uml-do_fork-param-cleanup +3 -19
@@ -174,26 +174,10 @@ long sys_clone(unsigned long clone_flags {long ret; -/* XXX: normal arch do here this pass, and also pass the regs to -* do_fork, instead of NULL. Currently the arch-independent code -* ignores these values, while the UML code (actually it's -* copy_thread) does the right thing. But this should change, -probably. */ -/*if (!newsp) -newsp = UPT_SP(current->thread.regs);*/ +if (!newsp) + newsp =UPT_SP (¤t->thread.regs.regs); current->thread.forking =1 ; - ret =do_fork (clone_flags, newsp,NULL ,0 , parent_tid, child_tid); + ret =do_fork (clone_flags, newsp, ¤t->thread.regs,0 , parent_tid, child_tid); current->thread.forking =0 ;return (ret); } - -/* -* Overrides for Emacs so that we follow Linus's tabbing style. -* Emacs will notice this stuff at the end of the file and automatically -* adjust the settings for this buffer only. This must remain at the end -* of the file. -* --------------------------------------------------------------------------- -* Local variables: -* c-file-style: "linux" -* End: -*/
_
Quoted 1 line · Blaisorblade
arch_switchalready exists (wasn't used for SKAS). About improving it and making it more "general-purpose" (I've written this for the TLS code needs), could you have a look to the attached patches? do_fork-* is another thing (a cleanup discussed some time ago with Jeff) but may be needed to apply the second.
Wouldn't it be better to have separate arch_switch_tt and arch_switch_skas? I think, arch_switch has to do different things for tt and skas (and maybe even for skas0 and skas3)
Bodo
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 10 lines · Bodo Stroesser
Quoted 5 lines · Blaisorblade
arch_switchalready exists (wasn't used for SKAS). About improving it and making it more "general-purpose" (I've written this for the TLS code needs), could you have a look to the attached patches? do_fork-* is another thing (a cleanup discussed some time ago with Jeff) but may be needed to apply the second.Wouldn't it be better to have separate
arch_switch_ttandarch_switch_skas? I think,arch_switchhas to do different things for tt and skas (and maybe even for skas0 and skas3)
Let's not go creating too many layers. switch_to_* calls arch_switch, then it can use CHOOSE_MODE if it needs (see the TLS patch I'm working on, it's in the -devel tarball here:
http://www.user-mode-linux.org/~blaisorblade/patches/devel-guest/
(pick the latest)
).
Signature · 23 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!". Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894) http://www.user-mode-linux.org/~blaisorblade ___________________________________ Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB http://mail.yahoo.it ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 10 lines · Blaisorblade
Quoted 8 lines · Bodo Stroesser
Quoted 5 lines · Blaisorblade
arch_switchalready exists (wasn't used for SKAS). About improving it and making it more "general-purpose" (I've written this for the TLS code needs), could you have a look to the attached patches? do_fork-* is another thing (a cleanup discussed some time ago with Jeff) but may be needed to apply the second.
Quoted 5 lines
Quoted 3 lines
Wouldn't it be better to have separate
arch_switch_ttandarch_switch_skas? I think,arch_switchhas to do different things for tt and skas (and maybe even for skas0 and skas3)Let's not go creating too many layers. switch_to_* calls
arch_switch, then it can useCHOOSE_MODEif it needs (see the TLS patch I'm working on, it's in the -devel tarball here:
Then swtich_to_tt should call arch_switch_tt and switch_to_skas should call arch_switch_skas. This avoids a CHOOSE_MODE and a function call. And also it makes tt a bit more removable, if Jeff decides to.
Bodo
Quoted 5 lines
http://www.user-mode-linux.org/~blaisorblade/patches/devel-guest/
(pick the latest)
).
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 13 lines · Bodo Stroesser
Quoted 12 lines · Blaisorblade
Quoted 10 lines · Bodo Stroesser
Quoted 5 lines · Blaisorblade
arch_switchalready exists (wasn't used for SKAS). About improving it and making it more "general-purpose" (I've written this for the TLS code needs), could you have a look to the attached patches? do_fork-* is another thing (a cleanup discussed some time ago with Jeff) but may be needed to apply the second.Wouldn't it be better to have separate
arch_switch_ttandarch_switch_skas? I think,arch_switchhas to do different things for tt and skas (and maybe even for skas0 and skas3)
Quoted 6 lines
Quoted 3 lines
Let's not go creating too many layers. switch_to_* calls
arch_switch, then it can useCHOOSE_MODEif it needs (see the TLS patch I'm working on, it's in the -devel tarball here:Then
swtich_to_ttshould callarch_switch_ttandswitch_to_skasshould callarch_switch_skas. This avoids aCHOOSE_MODEand a function call.
Hmm, yes, I thought too but for common code you have anyway a call... but it can be inlined, so it may make sense.
Quoted 1 line
And also it makes tt a bit more removable, if Jeff decides to.
Well, on this point I'd be cautious.
Currently there is no way to even test UML in SMP mode other than using TT mode, so at least this must be solved.
Signature · 23 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!". Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894) http://www.user-mode-linux.org/~blaisorblade ___________________________________ Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB http://mail.yahoo.it ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 5 lines · Blaisorblade
Quoted 1 line
And also it makes tt a bit more removable, if Jeff decides to.
Well, on this point I'd be cautious.
Currently there is no way to even test UML in SMP mode other than using TT mode, so at least this must be solved.
Yeah, we need to provide SMP on skas. That, and the performance of page fault handling were the only two things stopping me from removing tt mode in favor of skas0.
Bodo and have talked about this, and it seems that skas0 SMP is impractical because a malicious threaded app could interfere with the stub operation.
However, skas3 SMP is quite doable, and I think an unsafe skas0 SMP mode that you can enable with a switch might be OK, too.
I've since decided that page fault performance is not a show-stopper. It appears that tt mode is not supportable in recent libcs due to the errno problem.
We can get page fault performance back by pushing PTRACE_FAULTINFO into mainline, which should have been done a long time ago. Same for sysemu, BTW.
At this point, I'm -><- this close to deciding to get rid of tt mode in 2.6.13 or 2.6.14. I want skas0 in mainline early in 2.6.13 so it can be exercised. Getting skas SMP fixed, and PTRACE_FAULTINFO in mainline would make me happy about trashing tt mode at some later point.
Jeff
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
arch/um/include/kern_util.h extern void *get_current(void); · line 112
Quoted 2 lines · Blaisorblade
arch/um/include/kern_util.h renamed from arch/um/include/kern_util.h~uml-clean-arch_switch +2
-0+struct task_struct ; +extern void arch_switch (struct task_struct *from,struct task_struct *to);
Is the task_struct; needed, considering that there is get_task returning one a few lines higher?
arch/um/kernel/tt/process_kern.c static void new_thread_handler(int sig) · line 158
Quoted 2 lines
arch/um/kernel/tt/process_kern.c renamed from arch/um/kernel/tt/process_kern.c~uml-clean-arch_switch +2
-0+/* XXX: This is bogus, it's already done in local_irq_enable. Or does +* ordering matters? */
No, my signal handler initialization is confused and redundant in places. Just fix that and resend.
Quoted 9 lines
Fix the
do_forkcalling convention: normal arch pass the regs and the new sp value todo_forkinstead of NULL.Currently the arch-independent code ignores these values, while the UML code (actually it's
copy_thread) gets the right values by itself.With this patch, things are fixed up.
Low-priority.
But long-overdue. This one is applied.
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 23 lines · Jeff Dike
Quoted 5 lines · Blaisorblade
Quoted 1 line
And also it makes tt a bit more removable, if Jeff decides to.
Well, on this point I'd be cautious.
Currently there is no way to even test UML in SMP mode other than using TT mode, so at least this must be solved.
Yeah, we need to provide SMP on skas. That, and the performance of page fault handling were the only two things stopping me from removing tt mode in favor of skas0.
Bodo and have talked about this, and it seems that skas0 SMP is impractical because a malicious threaded app could interfere with the stub operation.
However, skas3 SMP is quite doable, and I think an unsafe skas0 SMP mode that you can enable with a switch might be OK, too.
I've since decided that page fault performance is not a show-stopper. It appears that tt mode is not supportable in recent libcs due to the errno problem.
Quoted 8 lines
We can get page fault performance back by pushing
PTRACE_FAULTINFOinto mainline, which should have been done a long time ago. Same for sysemu, BTW.At this point, I'm -><- this close to deciding to get rid of tt mode in 2.6.13 or 2.6.14. I want skas0 in mainline early in 2.6.13 so it can be exercised. Getting skas SMP fixed, and
PTRACE_FAULTINFOin mainline would make me happy about trashing tt mode at some later point.Jeff
To make skas3 consistent, we should have a mainline version of add-stub-vmas. Also, the LDT-changes should go in at the same time.
Bodo
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 11 lines · Jeff Dike
Quoted 6 lines · Blaisorblade
Quoted 1 line
And also it makes tt a bit more removable, if Jeff decides to.
Well, on this point I'd be cautious.
Currently there is no way to even test UML in SMP mode other than using TT mode, so at least this must be solved.
Yeah, we need to provide SMP on skas. That, and the performance of page fault handling were the only two things stopping me from removing tt mode in favor of skas0.
Well, the stub SIGSTOPs itself when it has finished. This is a big-latency operation, so using futexes (or POSIX semaphores, which don't seem to be implemented in terms of futexes) will increase a lot the stub's speed.
Quoted 5 lines
Bodo and have talked about this, and it seems that skas0 SMP is impractical because a malicious threaded app could interfere with the stub operation.
However, skas3 SMP is quite doable, and I think an unsafe skas0 SMP mode that you can enable with a switch might be OK, too.
Yes, we must simply write some for's (I already have in my patches the fixes for the #warning you added), fix some semaphores (it appears that I finished it, and turning the winch_handler_sem into a spinlock fixed all remaining deadlocks with console), and finally implement IPIs, right?
It will be harder to write a SMP-safe version of copy_*_user_skas but that exists inside the 4G-4G patch. And at that point, we'll enable PREEMPTION.
Btw, ever tried putting preemption in, just a compile shoot? Well, I'll work on all this stuff starting on July (supposing I succeed).
Quoted 3 lines
I've since decided that page fault performance is not a show-stopper. It appears that tt mode is not supportable in recent libcs due to the errno problem.
No, it doesn't, I must just trick a bit with the patch to fix that, simply it wasn't urgent and I'm busy for other stuff (aka exams).
Quoted 3 lines
We can get page fault performance back by pushing
PTRACE_FAULTINFOinto mainline, which should have been done a long time ago. Same for sysemu, BTW.
Yes, but since FAULTINFO will be recoded in terms of SIGINFO, we must do a bit of coding, trivial but a bit lenghty (fixing all SIGSEGVs senders in host kernel).
Plus, sysemu is probably causing the debugger problems (a TRAP at every instructions) we are getting - I can't think of anything else, at least.
Quoted 3 lines
At this point, I'm -><- this close to deciding to get rid of tt mode in 2.6.13 or 2.6.14. I want skas0 in mainline early in 2.6.13 so it can be exercised.
Say 2.6.13-git1. But you must prepare a patch which does not change *at all* SKAS3, not in terms of code but in terms of "strace output" (not "well, we change this but it won't affect things").
Btw, where did you lost SA_NODEFER for SIGSEGV handling?
Quoted 2 lines
Getting skas SMP fixed, and
PTRACE_FAULTINFOin mainline would make me happy about trashing tt mode at some later point.
Deprecating TT mode is Ok, but removing it will cause SMP to stop *compiling* at all after a few days of patches, and we would get more work when introducing SMP.
So, fir
Signature · 24 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!". Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894) http://www.user-mode-linux.org/~blaisorblade ___________________________________ Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB http://mail.yahoo.it ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 7 lines · Jeff Dike
Quoted 3 lines · Blaisorblade
(quoted diff) +2
-0+struct task_struct; +extern void arch_switch(struct task_struct *from, struct task_struct*to);
Is the
task_struct; needed, considering that there isget_taskreturning one a few lines higher?
I've not checked the rest of the header; if it compiles without the line it's ok.
Quoted 9 lines
arch/um/kernel/tt/process_kern.c static void new_thread_handler(int sig) · line 158
Quoted 2 lines
arch/um/kernel/tt/process_kern.c renamed from arch/um/kernel/tt/process_kern.c~uml-clean-arch_switch +2
-0+/* XXX: This is bogus, it's already done in local_irq_enable. Or does +* ordering matters? */ No, my signal handler initialization is confused and redundant in places. Just fix that and resend.
Quoted 3 lines
Fix the
do_forkcalling convention: normal arch pass the regs and the new sp value todo_forkinstead of NULL.
Quoted 8 lines
Quoted 6 lines
Currently the arch-independent code ignores these values, while the UML code (actually it's
copy_thread) gets the right values by itself.With this patch, things are fixed up.
Low-priority.
But long-overdue. This one is applied.
Please retest in all configurations, the first version did an innocent change to kernel_thread() which killed TT mode. And I did a change to switch_to(), replacing prev_sched with current->thread.prev_sched (or something like that) after the last testing (if I understood things properly, it won't change anything, but give it a bit of testing; it should fail loudly if I did something wrong).
Signature · 24 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!". Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894) http://www.user-mode-linux.org/~blaisorblade ___________________________________ Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB http://mail.yahoo.it ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel