lkml.org 
[lkml]   [1999]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] more entry.S fixes. [was: Re: scheduling problem?]

On Fri, 17 Dec 1999, William Montgomery wrote:

> Would it be possible to do a resched in resched_idle since a decision
> for need_resched is made there anyway? Would this cause problems?

we basically do a reschedule in resched_idle(), but no, it cannot really
be done there - we must not schedule interrupts. I'm working on a scheme
that enables us to do a 'direct context switch' if reschedule_idle() is
preempting a process on any CPU - this prevents the goodness() loop in
schedule and prevents other problems as well [like the case where some CPU
'steals' a freshly woken up process.]. I'm preparing a set of patches that
fix these things, but this should not affect your problem though.

about the other entry.S need_resched race Jamie noticed, the attached
patch should fix both the signal and the need_resched race. (patch works
here just fine. You still need the separate idle thread fix.) This is a
very interesting bug category and it's a 2.2 problem as well so the same
fixes apply there too.

fixing up the return address from IRQ handlers is a faster but also more
complex solution (due to eg. vm86's different kernel stack layout). Unless
there is some subtle problem with it we should definitely use it in the
long term because otherwise we add 6 cycles overhead to every system call.
Lets first see wether we have found all places. Can you still see missed
reschedules?

-- mingo
--- linux/arch/i386/kernel/entry.S.orig Fri Dec 17 07:48:24 1999
+++ linux/arch/i386/kernel/entry.S Sat Dec 18 01:23:34 1999
@@ -207,6 +207,7 @@
andl SYMBOL_NAME(bh_active),%eax
jne handle_bottom_half
ret_with_reschedule:
+ cli
cmpl $0,need_resched(%ebx)
jne reschedule
cmpl $0,sigpending(%ebx)
@@ -222,7 +223,16 @@
jne v86_signal_return
xorl %edx,%edx
call SYMBOL_NAME(do_signal)
- jmp restore_all
+signal_resched:
+ cli
+ cmpl $0,need_resched(%ebx)
+ je restore_all
+ /*
+ * do not recurse signal handlers. This is the slow path.
+ */
+ sti
+ call SYMBOL_NAME(schedule)
+ jmp signal_resched

ALIGN
v86_signal_return:
@@ -230,7 +240,7 @@
movl %eax,%esp
xorl %edx,%edx
call SYMBOL_NAME(do_signal)
- jmp restore_all
+ jmp signal_resched

ALIGN
tracesys:
@@ -269,6 +279,7 @@

ALIGN
reschedule:
+ sti
call SYMBOL_NAME(schedule) # test
jmp ret_from_sys_call
\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.069 / U:1.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site