diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2006-03-31 05:30:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-31 15:18:52 -0500 |
commit | 972410b0232e97609fcefc8e408fe3037fcd607b (patch) | |
tree | 2de18ed5d823dc7e24c0171f720f6354a9cd57e4 /arch/um/kernel | |
parent | fbdf2161552a2065047e5df2dbf9ebf69d66a0e9 (diff) |
[PATCH] uml: clean arch_switch usage
Call arch_switch also in switch_to_skas, even if it's, for now, a no-op for
that case (and mark this in the comment); this will change soon.
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.
Also, as suggested by Jeff, remove a redundant enabling of SIGVTALRM,
comprised in the subsequent local_irq_enable(). I'm just a bit dubious if
ordering matters there...
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/skas/process_kern.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/tt/process_kern.c | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c index 3f70a2e12f06..14360ac17f02 100644 --- a/arch/um/kernel/skas/process_kern.c +++ b/arch/um/kernel/skas/process_kern.c | |||
@@ -35,6 +35,8 @@ void switch_to_skas(void *prev, void *next) | |||
35 | switch_threads(&from->thread.mode.skas.switch_buf, | 35 | switch_threads(&from->thread.mode.skas.switch_buf, |
36 | to->thread.mode.skas.switch_buf); | 36 | to->thread.mode.skas.switch_buf); |
37 | 37 | ||
38 | arch_switch_to_skas(current->thread.prev_sched, current); | ||
39 | |||
38 | if(current->pid == 0) | 40 | if(current->pid == 0) |
39 | switch_timers(1); | 41 | switch_timers(1); |
40 | } | 42 | } |
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c index 295c1ac817b3..a9c1443fc548 100644 --- a/arch/um/kernel/tt/process_kern.c +++ b/arch/um/kernel/tt/process_kern.c | |||
@@ -51,6 +51,13 @@ void switch_to_tt(void *prev, void *next) | |||
51 | 51 | ||
52 | c = 0; | 52 | c = 0; |
53 | 53 | ||
54 | /* Notice that here we "up" the semaphore on which "to" is waiting, and | ||
55 | * below (the read) we wait on this semaphore (which is implemented by | ||
56 | * switch_pipe) and go sleeping. Thus, after that, we have resumed in | ||
57 | * "to", and can't use any more the value of "from" (which is outdated), | ||
58 | * nor the value in "to" (since it was the task which stole us the CPU, | ||
59 | * which we don't care about). */ | ||
60 | |||
54 | err = os_write_file(to->thread.mode.tt.switch_pipe[1], &c, sizeof(c)); | 61 | err = os_write_file(to->thread.mode.tt.switch_pipe[1], &c, sizeof(c)); |
55 | if(err != sizeof(c)) | 62 | if(err != sizeof(c)) |
56 | panic("write of switch_pipe failed, err = %d", -err); | 63 | panic("write of switch_pipe failed, err = %d", -err); |
@@ -77,7 +84,7 @@ void switch_to_tt(void *prev, void *next) | |||
77 | change_sig(SIGALRM, alrm); | 84 | change_sig(SIGALRM, alrm); |
78 | change_sig(SIGPROF, prof); | 85 | change_sig(SIGPROF, prof); |
79 | 86 | ||
80 | arch_switch(); | 87 | arch_switch_to_tt(prev_sched, current); |
81 | 88 | ||
82 | flush_tlb_all(); | 89 | flush_tlb_all(); |
83 | local_irq_restore(flags); | 90 | local_irq_restore(flags); |
@@ -141,7 +148,6 @@ static void new_thread_handler(int sig) | |||
141 | set_cmdline("(kernel thread)"); | 148 | set_cmdline("(kernel thread)"); |
142 | 149 | ||
143 | change_sig(SIGUSR1, 1); | 150 | change_sig(SIGUSR1, 1); |
144 | change_sig(SIGVTALRM, 1); | ||
145 | change_sig(SIGPROF, 1); | 151 | change_sig(SIGPROF, 1); |
146 | local_irq_enable(); | 152 | local_irq_enable(); |
147 | if(!run_kernel_thread(fn, arg, ¤t->thread.exec_buf)) | 153 | if(!run_kernel_thread(fn, arg, ¤t->thread.exec_buf)) |