Commit 3a0cb2d3 authored by Andy Ross's avatar Andy Ross Committed by Andrew Boie
Browse files

kernel: Remove legacy preemption checking



The metairq feature exposed the fact that all of our arch code (and a
few mistaken spots in the scheduler too) was trying to interpret
"preemptible" threads independently.

As of the scheduler rewrite, that logic is entirely within sched.c and
doing it externally is redundant.  And now that "cooperative" threads
can be preempted, it's wrong and produces test failures when used with
metairq threads.

Signed-off-by: default avatarAndy Ross <andrew.j.ross@intel.com>
parent 21792fa0
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -149,13 +149,6 @@ SECTION_FUNC(TEXT, _firq_exit)
	mov_s r1, _kernel
	ld_s r2, [r1, _kernel_offset_to_current]

	/*
	 * Non-preemptible thread ? Do not schedule (see explanation of
	 * preempt field in kernel_struct.h).
	 */
	ldh_s r0, [r2, _thread_offset_to_preempt]
	brhs r0, _NON_PREEMPT_THRESHOLD, _firq_no_reschedule

	/* Check if the current thread (in r2) is the cached thread */
	ld_s r0, [r1, _kernel_offset_to_ready_q_cache]
	brne r0, r2, _firq_reschedule
+0 −10
Original line number Diff line number Diff line
@@ -109,16 +109,6 @@ SECTION_FUNC(TEXT, _rirq_exit)
	 * point on until return from interrupt.
	 */


	/*
	 * Non-preemptible thread ? Do not schedule (see explanation of
	 * preempt field in kernel_struct.h).
	 */
	ldh_s r0, [r2, _thread_offset_to_preempt]
	mov r3, _NON_PREEMPT_THRESHOLD
	cmp_s r0, r3
	bhs.d _rirq_no_reschedule

	/*
	 * Both (a)reschedule and (b)non-reschedule cases need to load the
	 * current thread's stack, but don't have to use it until the decision
+0 −8
Original line number Diff line number Diff line
@@ -75,14 +75,6 @@ SECTION_SUBSEC_FUNC(TEXT, _HandlerModeExit, _ExcExit)

    ldr r1, [r0, #_kernel_offset_to_current]

    /*
     * Non-preemptible thread ? Do not schedule (see explanation of
     * preempt field in kernel_struct.h).
     */
    ldrh r2, [r1, #_thread_offset_to_preempt]
    cmp r2, #_PREEMPT_THRESHOLD
    bhi _EXIT_EXC

    ldr r0, [r0, _kernel_offset_to_ready_q_cache]
    cmp r0, r1
    beq _EXIT_EXC
+0 −8
Original line number Diff line number Diff line
@@ -123,14 +123,6 @@ on_irq_stack:
	 * switch
	 */

	/*
	 * Non-preemptible thread ? Do not schedule (see explanation of
	 * preempt field in kernel_struct.h).
	 */
	ldhu r12, _thread_offset_to_preempt(r11)
	movui r3, _NON_PREEMPT_THRESHOLD
	bgeu r12, r3, no_reschedule

	/* Call into the kernel to see if a scheduling decision is necessary */
	ldw  r2, _kernel_offset_to_ready_q_cache(r10)
	beq  r2, r11, no_reschedule
+0 −8
Original line number Diff line number Diff line
@@ -291,14 +291,6 @@ on_thread_stack:
	/* Get pointer to _kernel.current */
	lw t2, _kernel_offset_to_current(t1)

	/*
	 * If non-preemptible thread, do not schedule
	 * (see explanation of preempt field in kernel_structs.h
	 */
	lhu t3, _thread_offset_to_preempt(t2)
	li t4, _NON_PREEMPT_THRESHOLD
	bgeu t3, t4, no_reschedule

	/*
	 * Check if next thread to schedule is current thread.
	 * If yes do not perform a reschedule
Loading