Skip to contentSkip to conversation

2.5.8: Preempt problems

DISCUSSION Russell King 1 participant 2 messages Apr 17, 2002

lore
Share & tools
lore
#0 lore raw

Hi,

I'm trying to debug a flood of:

error: sh[81] exited with preempt_count 1

messages on ARM with kernel 2.5.8, and its looking like a generic kernel bug is causing it.

The point at which preempt_count gets set to '1' for each task is at the lock_kernel() in start_kernel(). Why?

We start booting the kernel. One of the very first things we do is call lock_kernel(), which increments the preempt_count for PID0. We initialise stuff, and then clone the thread for PID1, init.

When we clone a thread, dup_task_struct() creates a new kernel stack and thread_info structure. The childs thread_info structure inherits from the parent, which includes the preempt_count of 1.

We start the user space init(8) program, and run various other programs, forking as we do. Each time we fork(), we call dup_task_struct() which causes each task to inherit the non-zero preempt_count.

Thus, we never reach a preempt_count of 0, and never actually preempt.

Comments? Is there some fiddle in the x86 code somewhere that we've missed in the ARM tree to get this to work?

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#1 lore raw
Quoted 2 lines · Russell King

Comments? Is there some fiddle in the x86 code somewhere that we've missed in the ARM tree to get this to work?

Appologies - just found the problem. We were missing the call to schedule_tail() after a fork.

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html